1 /*
   2  * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.javac.code;
  27 
  28 import java.util.*;
  29 
  30 import com.sun.tools.javac.util.*;
  31 import com.sun.tools.javac.util.List;
  32 import com.sun.tools.javac.code.Symbol.*;
  33 import com.sun.tools.javac.code.Type.*;
  34 import com.sun.tools.javac.jvm.*;
  35 
  36 import static com.sun.tools.javac.jvm.ByteCodes.*;
  37 import static com.sun.tools.javac.code.Flags.*;
  38 
  39 /** A class that defines all predefined constants and operators
  40  *  as well as special classes such as java.lang.Object, which need
  41  *  to be known to the compiler. All symbols are held in instance
  42  *  fields. This makes it possible to work in multiple concurrent
  43  *  projects, which might use different class files for library classes.
  44  *
  45  *  <p><b>This is NOT part of any supported API.
  46  *  If you write code that depends on this, you do so at your own risk.
  47  *  This code and its internal interfaces are subject to change or
  48  *  deletion without notice.</b>
  49  */
  50 public class Symtab {
  51     /** The context key for the symbol table. */
  52     protected static final Context.Key<Symtab> symtabKey =
  53         new Context.Key<Symtab>();
  54 
  55     /** Get the symbol table instance. */
  56     public static Symtab instance(Context context) {
  57         Symtab instance = context.get(symtabKey);
  58         if (instance == null)
  59             instance = new Symtab(context);
  60         return instance;
  61     }
  62 
  63     /** Builtin types.
  64      */
  65     public final Type byteType = new Type(TypeTags.BYTE, null);
  66     public final Type charType = new Type(TypeTags.CHAR, null);
  67     public final Type shortType = new Type(TypeTags.SHORT, null);
  68     public final Type intType = new Type(TypeTags.INT, null);
  69     public final Type longType = new Type(TypeTags.LONG, null);
  70     public final Type floatType = new Type(TypeTags.FLOAT, null);
  71     public final Type doubleType = new Type(TypeTags.DOUBLE, null);
  72     public final Type booleanType = new Type(TypeTags.BOOLEAN, null);
  73     public final Type botType = new BottomType();
  74     public final JCNoType voidType = new JCNoType(TypeTags.VOID);
  75 
  76     private final Names names;
  77     private final ClassReader reader;
  78     private final Target target;
  79 
  80     /** A symbol for the root package.
  81      */
  82     public final PackageSymbol rootPackage;
  83 
  84     /** A symbol for the unnamed package.
  85      */
  86     public final PackageSymbol unnamedPackage;
  87 
  88     /** A symbol that stands for a missing symbol.
  89      */
  90     public final TypeSymbol noSymbol;
  91 
  92     /** The error symbol.
  93      */
  94     public final ClassSymbol errSymbol;
  95 
  96     /** A value for the errType, with a originalType of noType */
  97     public final Type errType;
  98 
  99     /** A value for the unknown type. */
 100     public final Type unknownType;
 101 
 102     /** The builtin type of all arrays. */
 103     public final ClassSymbol arrayClass;
 104     public final MethodSymbol arrayCloneMethod;
 105 
 106     /** VGJ: The (singleton) type of all bound types. */
 107     public final ClassSymbol boundClass;
 108 
 109     /** The builtin type of all methods. */
 110     public final ClassSymbol methodClass;
 111 
 112     /** Predefined types.
 113      */
 114     public final Type objectType;
 115     public final Type classType;
 116     public final Type classLoaderType;
 117     public final Type stringType;
 118     public final Type stringBufferType;
 119     public final Type stringBuilderType;
 120     public final Type cloneableType;
 121     public final Type serializableType;
 122     public final Type methodHandleType;
 123     public final Type polymorphicSignatureType;
 124     public final Type invokeDynamicType;
 125     public final Type throwableType;
 126     public final Type errorType;
 127     public final Type illegalArgumentExceptionType;
 128     public final Type exceptionType;
 129     public final Type runtimeExceptionType;
 130     public final Type classNotFoundExceptionType;
 131     public final Type noClassDefFoundErrorType;
 132     public final Type noSuchFieldErrorType;
 133     public final Type assertionErrorType;
 134     public final Type cloneNotSupportedExceptionType;
 135     public final Type annotationType;
 136     public final TypeSymbol enumSym;
 137     public final Type listType;
 138     public final Type collectionsType;
 139     public final Type comparableType;
 140     public final Type arraysType;
 141     public final Type iterableType;
 142     public final Type iteratorType;
 143     public final Type annotationTargetType;
 144     public final Type overrideType;
 145     public final Type retentionType;
 146     public final Type deprecatedType;
 147     public final Type suppressWarningsType;
 148     public final Type inheritedType;
 149     public final Type proprietaryType;
 150     public final Type systemType;
 151     public final Type autoCloseableType;
 152 
 153     /** The symbol representing the length field of an array.
 154      */
 155     public final VarSymbol lengthVar;
 156 
 157     /** The null check operator. */
 158     public final OperatorSymbol nullcheck;
 159 
 160     /** The symbol representing the final finalize method on enums */
 161     public final MethodSymbol enumFinalFinalize;
 162 
 163     /** The symbol representing the close method on TWR AutoCloseable type */
 164     public final MethodSymbol autoCloseableClose;
 165 
 166     /** The predefined type that belongs to a tag.
 167      */
 168     public final Type[] typeOfTag = new Type[TypeTags.TypeTagCount];
 169 
 170     /** The name of the class that belongs to a basix type tag.
 171      */
 172     public final Name[] boxedName = new Name[TypeTags.TypeTagCount];
 173 
 174     /** A hashtable containing the encountered top-level and member classes,
 175      *  indexed by flat names. The table does not contain local classes.
 176      *  It should be updated from the outside to reflect classes defined
 177      *  by compiled source files.
 178      */
 179     public final Map<Name, ClassSymbol> classes = new HashMap<Name, ClassSymbol>();
 180 
 181     /** A hashtable containing the encountered packages.
 182      *  the table should be updated from outside to reflect packages defined
 183      *  by compiled source files.
 184      */
 185     public final Map<Name, PackageSymbol> packages = new HashMap<Name, PackageSymbol>();
 186 
 187     public void initType(Type type, ClassSymbol c) {
 188         type.tsym = c;
 189         typeOfTag[type.tag] = type;
 190     }
 191 
 192     public void initType(Type type, String name) {
 193         initType(
 194             type,
 195             new ClassSymbol(
 196                 PUBLIC, names.fromString(name), type, rootPackage));
 197     }
 198 
 199     public void initType(Type type, String name, String bname) {
 200         initType(type, name);
 201             boxedName[type.tag] = names.fromString("java.lang." + bname);
 202     }
 203 
 204     /** The class symbol that owns all predefined symbols.
 205      */
 206     public final ClassSymbol predefClass;
 207 
 208     /** Enter a constant into symbol table.
 209      *  @param name   The constant's name.
 210      *  @param type   The constant's type.
 211      */
 212     private VarSymbol enterConstant(String name, Type type) {
 213         VarSymbol c = new VarSymbol(
 214             PUBLIC | STATIC | FINAL,
 215             names.fromString(name),
 216             type,
 217             predefClass);
 218         c.setData(type.constValue());
 219         predefClass.members().enter(c);
 220         return c;
 221     }
 222 
 223     /** Enter a binary operation into symbol table.
 224      *  @param name     The name of the operator.
 225      *  @param left     The type of the left operand.
 226      *  @param right    The type of the left operand.
 227      *  @param res      The operation's result type.
 228      *  @param opcode   The operation's bytecode instruction.
 229      */
 230     private void enterBinop(String name,
 231                             Type left, Type right, Type res,
 232                             int opcode) {
 233         predefClass.members().enter(
 234             new OperatorSymbol(
 235                 names.fromString(name),
 236                 new MethodType(List.of(left, right), res,
 237                                List.<Type>nil(), methodClass),
 238                 opcode,
 239                 predefClass));
 240     }
 241 
 242     /** Enter a binary operation, as above but with two opcodes,
 243      *  which get encoded as (opcode1 << ByteCodeTags.preShift) + opcode2.
 244      *  @param opcode1     First opcode.
 245      *  @param opcode2     Second opcode.
 246      */
 247     private void enterBinop(String name,
 248                             Type left, Type right, Type res,
 249                             int opcode1, int opcode2) {
 250         enterBinop(
 251             name, left, right, res, (opcode1 << ByteCodes.preShift) | opcode2);
 252     }
 253 
 254     /** Enter a unary operation into symbol table.
 255      *  @param name     The name of the operator.
 256      *  @param arg      The type of the operand.
 257      *  @param res      The operation's result type.
 258      *  @param opcode   The operation's bytecode instruction.
 259      */
 260     private OperatorSymbol enterUnop(String name,
 261                                      Type arg,
 262                                      Type res,
 263                                      int opcode) {
 264         OperatorSymbol sym =
 265             new OperatorSymbol(names.fromString(name),
 266                                new MethodType(List.of(arg),
 267                                               res,
 268                                               List.<Type>nil(),
 269                                               methodClass),
 270                                opcode,
 271                                predefClass);
 272         predefClass.members().enter(sym);
 273         return sym;
 274     }
 275 
 276     /** Enter a class into symbol table.
 277      *  @param    The name of the class.
 278      */
 279     private Type enterClass(String s) {
 280         return reader.enterClass(names.fromString(s)).type;
 281     }
 282 
 283     public void synthesizeEmptyInterfaceIfMissing(final Type type) {
 284         final Completer completer = type.tsym.completer;
 285         if (completer != null) {
 286             type.tsym.completer = new Completer() {
 287                 public void complete(Symbol sym) throws CompletionFailure {
 288                     try {
 289                         completer.complete(sym);
 290                     } catch (CompletionFailure e) {
 291                         sym.flags_field |= (PUBLIC | INTERFACE);
 292                         ((ClassType) sym.type).supertype_field = objectType;
 293                     }
 294                 }
 295             };
 296         }
 297     }
 298 
 299     public void synthesizeBoxTypeIfMissing(final Type type) {
 300         ClassSymbol sym = reader.enterClass(boxedName[type.tag]);
 301         final Completer completer = sym.completer;
 302         if (completer != null) {
 303             sym.completer = new Completer() {
 304                 public void complete(Symbol sym) throws CompletionFailure {
 305                     try {
 306                         completer.complete(sym);
 307                     } catch (CompletionFailure e) {
 308                         sym.flags_field |= PUBLIC;
 309                         ((ClassType) sym.type).supertype_field = objectType;
 310                         Name n = target.boxWithConstructors() ? names.init : names.valueOf;
 311                         MethodSymbol boxMethod =
 312                             new MethodSymbol(PUBLIC | STATIC,
 313                                 n,
 314                                 new MethodType(List.of(type), sym.type,
 315                                     List.<Type>nil(), methodClass),
 316                                 sym);
 317                         sym.members().enter(boxMethod);
 318                         MethodSymbol unboxMethod =
 319                             new MethodSymbol(PUBLIC,
 320                                 type.tsym.name.append(names.Value), // x.intValue()
 321                                 new MethodType(List.<Type>nil(), type,
 322                                     List.<Type>nil(), methodClass),
 323                                 sym);
 324                         sym.members().enter(unboxMethod);
 325                     }
 326                 }
 327             };
 328         }
 329 
 330     }
 331 
 332     /** Constructor; enters all predefined identifiers and operators
 333      *  into symbol table.
 334      */
 335     protected Symtab(Context context) throws CompletionFailure {
 336         context.put(symtabKey, this);
 337 
 338         names = Names.instance(context);
 339         target = Target.instance(context);
 340 
 341         // Create the unknown type
 342         unknownType = new Type(TypeTags.UNKNOWN, null);
 343 
 344         // create the basic builtin symbols
 345         rootPackage = new PackageSymbol(names.empty, null);
 346         final JavacMessages messages = JavacMessages.instance(context);
 347         unnamedPackage = new PackageSymbol(names.empty, rootPackage) {
 348                 public String toString() {
 349                     return messages.getLocalizedString("compiler.misc.unnamed.package");
 350                 }
 351             };
 352         noSymbol = new TypeSymbol(0, names.empty, Type.noType, rootPackage);
 353         noSymbol.kind = Kinds.NIL;
 354 
 355         // create the error symbols
 356         errSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.any, null, rootPackage);
 357         errType = new ErrorType(errSymbol, Type.noType);
 358 
 359         // initialize builtin types
 360         initType(byteType, "byte", "Byte");
 361         initType(shortType, "short", "Short");
 362         initType(charType, "char", "Character");
 363         initType(intType, "int", "Integer");
 364         initType(longType, "long", "Long");
 365         initType(floatType, "float", "Float");
 366         initType(doubleType, "double", "Double");
 367         initType(booleanType, "boolean", "Boolean");
 368         initType(voidType, "void", "Void");
 369         initType(botType, "<nulltype>");
 370         initType(errType, errSymbol);
 371         initType(unknownType, "<any?>");
 372 
 373         // the builtin class of all arrays
 374         arrayClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Array, noSymbol);
 375 
 376         // VGJ
 377         boundClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Bound, noSymbol);
 378 
 379         // the builtin class of all methods
 380         methodClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Method, noSymbol);
 381 
 382         // Create class to hold all predefined constants and operations.
 383         predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage);
 384         Scope scope = new Scope(predefClass);
 385         predefClass.members_field = scope;
 386 
 387         // Enter symbols for basic types.
 388         scope.enter(byteType.tsym);
 389         scope.enter(shortType.tsym);
 390         scope.enter(charType.tsym);
 391         scope.enter(intType.tsym);
 392         scope.enter(longType.tsym);
 393         scope.enter(floatType.tsym);
 394         scope.enter(doubleType.tsym);
 395         scope.enter(booleanType.tsym);
 396         scope.enter(errType.tsym);
 397 
 398         // Enter symbol for the errSymbol
 399         scope.enter(errSymbol);
 400 
 401         classes.put(predefClass.fullname, predefClass);
 402 
 403         reader = ClassReader.instance(context);
 404         reader.init(this);
 405 
 406         // Enter predefined classes.
 407         objectType = enterClass("java.lang.Object");
 408         classType = enterClass("java.lang.Class");
 409         stringType = enterClass("java.lang.String");
 410         stringBufferType = enterClass("java.lang.StringBuffer");
 411         stringBuilderType = enterClass("java.lang.StringBuilder");
 412         cloneableType = enterClass("java.lang.Cloneable");
 413         throwableType = enterClass("java.lang.Throwable");
 414         serializableType = enterClass("java.io.Serializable");
 415         methodHandleType = enterClass("java.dyn.MethodHandle");
 416         polymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature");
 417         invokeDynamicType = enterClass("java.dyn.InvokeDynamic");
 418         errorType = enterClass("java.lang.Error");
 419         illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
 420         exceptionType = enterClass("java.lang.Exception");
 421         runtimeExceptionType = enterClass("java.lang.RuntimeException");
 422         classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException");
 423         noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError");
 424         noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError");
 425         assertionErrorType = enterClass("java.lang.AssertionError");
 426         cloneNotSupportedExceptionType = enterClass("java.lang.CloneNotSupportedException");
 427         annotationType = enterClass("java.lang.annotation.Annotation");
 428         classLoaderType = enterClass("java.lang.ClassLoader");
 429         enumSym = reader.enterClass(names.java_lang_Enum);
 430         enumFinalFinalize =
 431             new MethodSymbol(PROTECTED|FINAL|HYPOTHETICAL,
 432                              names.finalize,
 433                              new MethodType(List.<Type>nil(), voidType,
 434                                             List.<Type>nil(), methodClass),
 435                              enumSym);
 436         listType = enterClass("java.util.List");
 437         collectionsType = enterClass("java.util.Collections");
 438         comparableType = enterClass("java.lang.Comparable");
 439         arraysType = enterClass("java.util.Arrays");
 440         iterableType = target.hasIterable()
 441             ? enterClass("java.lang.Iterable")
 442             : enterClass("java.util.Collection");
 443         iteratorType = enterClass("java.util.Iterator");
 444         annotationTargetType = enterClass("java.lang.annotation.Target");
 445         overrideType = enterClass("java.lang.Override");
 446         retentionType = enterClass("java.lang.annotation.Retention");
 447         deprecatedType = enterClass("java.lang.Deprecated");
 448         suppressWarningsType = enterClass("java.lang.SuppressWarnings");
 449         inheritedType = enterClass("java.lang.annotation.Inherited");
 450         systemType = enterClass("java.lang.System");
 451         autoCloseableType = enterClass("java.lang.AutoCloseable");
 452         autoCloseableClose = new MethodSymbol(PUBLIC,
 453                              names.close,
 454                              new MethodType(List.<Type>nil(), voidType,
 455                                             List.of(exceptionType), methodClass),
 456                              autoCloseableType.tsym);
 457 
 458         synthesizeEmptyInterfaceIfMissing(cloneableType);
 459         synthesizeEmptyInterfaceIfMissing(serializableType);
 460         synthesizeEmptyInterfaceIfMissing(polymorphicSignatureType);
 461         synthesizeBoxTypeIfMissing(doubleType);
 462         synthesizeBoxTypeIfMissing(floatType);
 463         synthesizeBoxTypeIfMissing(voidType);
 464 
 465         // Enter a synthetic class that is used to mark internal
 466         // proprietary classes in ct.sym.  This class does not have a
 467         // class file.
 468         ClassType proprietaryType = (ClassType)enterClass("sun.Proprietary+Annotation");
 469         this.proprietaryType = proprietaryType;
 470         ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym;
 471         proprietarySymbol.completer = null;
 472         proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
 473         proprietarySymbol.erasure_field = proprietaryType;
 474         proprietarySymbol.members_field = new Scope(proprietarySymbol);
 475         proprietaryType.typarams_field = List.nil();
 476         proprietaryType.allparams_field = List.nil();
 477         proprietaryType.supertype_field = annotationType;
 478         proprietaryType.interfaces_field = List.nil();
 479 
 480         // Enter a class for arrays.
 481         // The class implements java.lang.Cloneable and java.io.Serializable.
 482         // It has a final length field and a clone method.
 483         ClassType arrayClassType = (ClassType)arrayClass.type;
 484         arrayClassType.supertype_field = objectType;
 485         arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
 486         arrayClass.members_field = new Scope(arrayClass);
 487         lengthVar = new VarSymbol(
 488             PUBLIC | FINAL,
 489             names.length,
 490             intType,
 491             arrayClass);
 492         arrayClass.members().enter(lengthVar);
 493         arrayCloneMethod = new MethodSymbol(
 494             PUBLIC,
 495             names.clone,
 496             new MethodType(List.<Type>nil(), objectType,
 497                            List.<Type>nil(), methodClass),
 498             arrayClass);
 499         arrayClass.members().enter(arrayCloneMethod);
 500 
 501         // Enter operators.
 502         enterUnop("+", doubleType, doubleType, nop);
 503         enterUnop("+", floatType, floatType, nop);
 504         enterUnop("+", longType, longType, nop);
 505         enterUnop("+", intType, intType, nop);
 506 
 507         enterUnop("-", doubleType, doubleType, dneg);
 508         enterUnop("-", floatType, floatType, fneg);
 509         enterUnop("-", longType, longType, lneg);
 510         enterUnop("-", intType, intType, ineg);
 511 
 512         enterUnop("~", longType, longType, lxor);
 513         enterUnop("~", intType, intType, ixor);
 514 
 515         enterUnop("++", doubleType, doubleType, dadd);
 516         enterUnop("++", floatType, floatType, fadd);
 517         enterUnop("++", longType, longType, ladd);
 518         enterUnop("++", intType, intType, iadd);
 519         enterUnop("++", charType, charType, iadd);
 520         enterUnop("++", shortType, shortType, iadd);
 521         enterUnop("++", byteType, byteType, iadd);
 522 
 523         enterUnop("--", doubleType, doubleType, dsub);
 524         enterUnop("--", floatType, floatType, fsub);
 525         enterUnop("--", longType, longType, lsub);
 526         enterUnop("--", intType, intType, isub);
 527         enterUnop("--", charType, charType, isub);
 528         enterUnop("--", shortType, shortType, isub);
 529         enterUnop("--", byteType, byteType, isub);
 530 
 531         enterUnop("!", booleanType, booleanType, bool_not);
 532         nullcheck = enterUnop("<*nullchk*>", objectType, objectType, nullchk);
 533 
 534         // string concatenation
 535         enterBinop("+", stringType, objectType, stringType, string_add);
 536         enterBinop("+", objectType, stringType, stringType, string_add);
 537         enterBinop("+", stringType, stringType, stringType, string_add);
 538         enterBinop("+", stringType, intType, stringType, string_add);
 539         enterBinop("+", stringType, longType, stringType, string_add);
 540         enterBinop("+", stringType, floatType, stringType, string_add);
 541         enterBinop("+", stringType, doubleType, stringType, string_add);
 542         enterBinop("+", stringType, booleanType, stringType, string_add);
 543         enterBinop("+", stringType, botType, stringType, string_add);
 544         enterBinop("+", intType, stringType, stringType, string_add);
 545         enterBinop("+", longType, stringType, stringType, string_add);
 546         enterBinop("+", floatType, stringType, stringType, string_add);
 547         enterBinop("+", doubleType, stringType, stringType, string_add);
 548         enterBinop("+", booleanType, stringType, stringType, string_add);
 549         enterBinop("+", botType, stringType, stringType, string_add);
 550 
 551         // these errors would otherwise be matched as string concatenation
 552         enterBinop("+", botType, botType, botType, error);
 553         enterBinop("+", botType, intType, botType, error);
 554         enterBinop("+", botType, longType, botType, error);
 555         enterBinop("+", botType, floatType, botType, error);
 556         enterBinop("+", botType, doubleType, botType, error);
 557         enterBinop("+", botType, booleanType, botType, error);
 558         enterBinop("+", botType, objectType, botType, error);
 559         enterBinop("+", intType, botType, botType, error);
 560         enterBinop("+", longType, botType, botType, error);
 561         enterBinop("+", floatType, botType, botType, error);
 562         enterBinop("+", doubleType, botType, botType, error);
 563         enterBinop("+", booleanType, botType, botType, error);
 564         enterBinop("+", objectType, botType, botType, error);
 565 
 566         enterBinop("+", doubleType, doubleType, doubleType, dadd);
 567         enterBinop("+", floatType, floatType, floatType, fadd);
 568         enterBinop("+", longType, longType, longType, ladd);
 569         enterBinop("+", intType, intType, intType, iadd);
 570 
 571         enterBinop("-", doubleType, doubleType, doubleType, dsub);
 572         enterBinop("-", floatType, floatType, floatType, fsub);
 573         enterBinop("-", longType, longType, longType, lsub);
 574         enterBinop("-", intType, intType, intType, isub);
 575 
 576         enterBinop("*", doubleType, doubleType, doubleType, dmul);
 577         enterBinop("*", floatType, floatType, floatType, fmul);
 578         enterBinop("*", longType, longType, longType, lmul);
 579         enterBinop("*", intType, intType, intType, imul);
 580 
 581         enterBinop("/", doubleType, doubleType, doubleType, ddiv);
 582         enterBinop("/", floatType, floatType, floatType, fdiv);
 583         enterBinop("/", longType, longType, longType, ldiv);
 584         enterBinop("/", intType, intType, intType, idiv);
 585 
 586         enterBinop("%", doubleType, doubleType, doubleType, dmod);
 587         enterBinop("%", floatType, floatType, floatType, fmod);
 588         enterBinop("%", longType, longType, longType, lmod);
 589         enterBinop("%", intType, intType, intType, imod);
 590 
 591         enterBinop("&", booleanType, booleanType, booleanType, iand);
 592         enterBinop("&", longType, longType, longType, land);
 593         enterBinop("&", intType, intType, intType, iand);
 594 
 595         enterBinop("|", booleanType, booleanType, booleanType, ior);
 596         enterBinop("|", longType, longType, longType, lor);
 597         enterBinop("|", intType, intType, intType, ior);
 598 
 599         enterBinop("^", booleanType, booleanType, booleanType, ixor);
 600         enterBinop("^", longType, longType, longType, lxor);
 601         enterBinop("^", intType, intType, intType, ixor);
 602 
 603         enterBinop("<<", longType, longType, longType, lshll);
 604         enterBinop("<<", intType, longType, intType, ishll);
 605         enterBinop("<<", longType, intType, longType, lshl);
 606         enterBinop("<<", intType, intType, intType, ishl);
 607 
 608         enterBinop(">>", longType, longType, longType, lshrl);
 609         enterBinop(">>", intType, longType, intType, ishrl);
 610         enterBinop(">>", longType, intType, longType, lshr);
 611         enterBinop(">>", intType, intType, intType, ishr);
 612 
 613         enterBinop(">>>", longType, longType, longType, lushrl);
 614         enterBinop(">>>", intType, longType, intType, iushrl);
 615         enterBinop(">>>", longType, intType, longType, lushr);
 616         enterBinop(">>>", intType, intType, intType, iushr);
 617 
 618         enterBinop("<", doubleType, doubleType, booleanType, dcmpg, iflt);
 619         enterBinop("<", floatType, floatType, booleanType, fcmpg, iflt);
 620         enterBinop("<", longType, longType, booleanType, lcmp, iflt);
 621         enterBinop("<", intType, intType, booleanType, if_icmplt);
 622 
 623         enterBinop(">", doubleType, doubleType, booleanType, dcmpl, ifgt);
 624         enterBinop(">", floatType, floatType, booleanType, fcmpl, ifgt);
 625         enterBinop(">", longType, longType, booleanType, lcmp, ifgt);
 626         enterBinop(">", intType, intType, booleanType, if_icmpgt);
 627 
 628         enterBinop("<=", doubleType, doubleType, booleanType, dcmpg, ifle);
 629         enterBinop("<=", floatType, floatType, booleanType, fcmpg, ifle);
 630         enterBinop("<=", longType, longType, booleanType, lcmp, ifle);
 631         enterBinop("<=", intType, intType, booleanType, if_icmple);
 632 
 633         enterBinop(">=", doubleType, doubleType, booleanType, dcmpl, ifge);
 634         enterBinop(">=", floatType, floatType, booleanType, fcmpl, ifge);
 635         enterBinop(">=", longType, longType, booleanType, lcmp, ifge);
 636         enterBinop(">=", intType, intType, booleanType, if_icmpge);
 637 
 638         enterBinop("==", objectType, objectType, booleanType, if_acmpeq);
 639         enterBinop("==", booleanType, booleanType, booleanType, if_icmpeq);
 640         enterBinop("==", doubleType, doubleType, booleanType, dcmpl, ifeq);
 641         enterBinop("==", floatType, floatType, booleanType, fcmpl, ifeq);
 642         enterBinop("==", longType, longType, booleanType, lcmp, ifeq);
 643         enterBinop("==", intType, intType, booleanType, if_icmpeq);
 644 
 645         enterBinop("!=", objectType, objectType, booleanType, if_acmpne);
 646         enterBinop("!=", booleanType, booleanType, booleanType, if_icmpne);
 647         enterBinop("!=", doubleType, doubleType, booleanType, dcmpl, ifne);
 648         enterBinop("!=", floatType, floatType, booleanType, fcmpl, ifne);
 649         enterBinop("!=", longType, longType, booleanType, lcmp, ifne);
 650         enterBinop("!=", intType, intType, booleanType, if_icmpne);
 651 
 652         enterBinop("&&", booleanType, booleanType, booleanType, bool_and);
 653         enterBinop("||", booleanType, booleanType, booleanType, bool_or);
 654     }
 655 }