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 invokeDynamicType;
 124     public final Type throwableType;
 125     public final Type errorType;
 126     public final Type illegalArgumentExceptionType;
 127     public final Type exceptionType;
 128     public final Type runtimeExceptionType;
 129     public final Type classNotFoundExceptionType;
 130     public final Type noClassDefFoundErrorType;
 131     public final Type noSuchFieldErrorType;
 132     public final Type assertionErrorType;
 133     public final Type cloneNotSupportedExceptionType;
 134     public final Type annotationType;
 135     public final TypeSymbol enumSym;
 136     public final Type listType;
 137     public final Type collectionsType;
 138     public final Type comparableType;
 139     public final Type arraysType;
 140     public final Type iterableType;
 141     public final Type iteratorType;
 142     public final Type annotationTargetType;
 143     public final Type overrideType;
 144     public final Type retentionType;
 145     public final Type deprecatedType;
 146     public final Type suppressWarningsType;
 147     public final Type inheritedType;
 148     public final Type proprietaryType;
 149     public final Type systemType;
 150 
 151     /** The symbol representing the length field of an array.
 152      */
 153     public final VarSymbol lengthVar;
 154 
 155     /** The null check operator. */
 156     public final OperatorSymbol nullcheck;
 157 
 158     /** The symbol representing the final finalize method on enums */
 159     public final MethodSymbol enumFinalFinalize;
 160 
 161     /** The predefined type that belongs to a tag.
 162      */
 163     public final Type[] typeOfTag = new Type[TypeTags.TypeTagCount];
 164 
 165     /** The name of the class that belongs to a basix type tag.
 166      */
 167     public final Name[] boxedName = new Name[TypeTags.TypeTagCount];
 168 
 169     /** A hashtable containing the encountered top-level and member classes,
 170      *  indexed by flat names. The table does not contain local classes.
 171      *  It should be updated from the outside to reflect classes defined
 172      *  by compiled source files.
 173      */
 174     public final Map<Name, ClassSymbol> classes = new HashMap<Name, ClassSymbol>();
 175 
 176     /** A hashtable containing the encountered packages.
 177      *  the table should be updated from outside to reflect packages defined
 178      *  by compiled source files.
 179      */
 180     public final Map<Name, PackageSymbol> packages = new HashMap<Name, PackageSymbol>();
 181 
 182     public void initType(Type type, ClassSymbol c) {
 183         type.tsym = c;
 184         typeOfTag[type.tag] = type;
 185     }
 186 
 187     public void initType(Type type, String name) {
 188         initType(
 189             type,
 190             new ClassSymbol(
 191                 PUBLIC, names.fromString(name), type, rootPackage));
 192     }
 193 
 194     public void initType(Type type, String name, String bname) {
 195         initType(type, name);
 196             boxedName[type.tag] = names.fromString("java.lang." + bname);
 197     }
 198 
 199     /** The class symbol that owns all predefined symbols.
 200      */
 201     public final ClassSymbol predefClass;
 202 
 203     /** Enter a constant into symbol table.
 204      *  @param name   The constant's name.
 205      *  @param type   The constant's type.
 206      */
 207     private VarSymbol enterConstant(String name, Type type) {
 208         VarSymbol c = new VarSymbol(
 209             PUBLIC | STATIC | FINAL,
 210             names.fromString(name),
 211             type,
 212             predefClass);
 213         c.setData(type.constValue());
 214         predefClass.members().enter(c);
 215         return c;
 216     }
 217 
 218     /** Enter a binary operation into symbol table.
 219      *  @param name     The name of the operator.
 220      *  @param left     The type of the left operand.
 221      *  @param right    The type of the left operand.
 222      *  @param res      The operation's result type.
 223      *  @param opcode   The operation's bytecode instruction.
 224      */
 225     private void enterBinop(String name,
 226                             Type left, Type right, Type res,
 227                             int opcode) {
 228         predefClass.members().enter(
 229             new OperatorSymbol(
 230                 names.fromString(name),
 231                 new MethodType(List.of(left, right), res,
 232                                List.<Type>nil(), methodClass),
 233                 opcode,
 234                 predefClass));
 235     }
 236 
 237     /** Enter a binary operation, as above but with two opcodes,
 238      *  which get encoded as (opcode1 << ByteCodeTags.preShift) + opcode2.
 239      *  @param opcode1     First opcode.
 240      *  @param opcode2     Second opcode.
 241      */
 242     private void enterBinop(String name,
 243                             Type left, Type right, Type res,
 244                             int opcode1, int opcode2) {
 245         enterBinop(
 246             name, left, right, res, (opcode1 << ByteCodes.preShift) | opcode2);
 247     }
 248 
 249     /** Enter a unary operation into symbol table.
 250      *  @param name     The name of the operator.
 251      *  @param arg      The type of the operand.
 252      *  @param res      The operation's result type.
 253      *  @param opcode   The operation's bytecode instruction.
 254      */
 255     private OperatorSymbol enterUnop(String name,
 256                                      Type arg,
 257                                      Type res,
 258                                      int opcode) {
 259         OperatorSymbol sym =
 260             new OperatorSymbol(names.fromString(name),
 261                                new MethodType(List.of(arg),
 262                                               res,
 263                                               List.<Type>nil(),
 264                                               methodClass),
 265                                opcode,
 266                                predefClass);
 267         predefClass.members().enter(sym);
 268         return sym;
 269     }
 270 
 271     /** Enter a class into symbol table.
 272      *  @param    The name of the class.
 273      */
 274     private Type enterClass(String s) {
 275         return reader.enterClass(names.fromString(s)).type;
 276     }
 277 
 278     public void synthesizeEmptyInterfaceIfMissing(final Type type) {
 279         final Completer completer = type.tsym.completer;
 280         if (completer != null) {
 281             type.tsym.completer = new Completer() {
 282                 public void complete(Symbol sym) throws CompletionFailure {
 283                     try {
 284                         completer.complete(sym);
 285                     } catch (CompletionFailure e) {
 286                         sym.flags_field |= (PUBLIC | INTERFACE);
 287                         ((ClassType) sym.type).supertype_field = objectType;
 288                     }
 289                 }
 290             };
 291         }
 292     }
 293 
 294     public void synthesizeMHTypeIfMissing(final Type type) {
 295         final Completer completer = type.tsym.completer;
 296         if (completer != null) {
 297             type.tsym.completer = new Completer() {
 298                 public void complete(Symbol sym) throws CompletionFailure {
 299                     try {
 300                         completer.complete(sym);
 301                     } catch (CompletionFailure e) {
 302                         sym.flags_field |= (PUBLIC | ABSTRACT);
 303                         ((ClassType) sym.type).supertype_field = objectType;
 304                         // do not bother to create MH.type if not visibly declared
 305                         // this sym just accumulates invoke(...) methods
 306                     }
 307                 }
 308             };
 309         }
 310     }
 311 
 312     public void synthesizeBoxTypeIfMissing(final Type type) {
 313         ClassSymbol sym = reader.enterClass(boxedName[type.tag]);
 314         final Completer completer = sym.completer;
 315         if (completer != null) {
 316             sym.completer = new Completer() {
 317                 public void complete(Symbol sym) throws CompletionFailure {
 318                     try {
 319                         completer.complete(sym);
 320                     } catch (CompletionFailure e) {
 321                         sym.flags_field |= PUBLIC;
 322                         ((ClassType) sym.type).supertype_field = objectType;
 323                         Name n = target.boxWithConstructors() ? names.init : names.valueOf;
 324                         MethodSymbol boxMethod =
 325                             new MethodSymbol(PUBLIC | STATIC,
 326                                 n,
 327                                 new MethodType(List.of(type), sym.type,
 328                                     List.<Type>nil(), methodClass),
 329                                 sym);
 330                         sym.members().enter(boxMethod);
 331                         MethodSymbol unboxMethod =
 332                             new MethodSymbol(PUBLIC,
 333                                 type.tsym.name.append(names.Value), // x.intValue()
 334                                 new MethodType(List.<Type>nil(), type,
 335                                     List.<Type>nil(), methodClass),
 336                                 sym);
 337                         sym.members().enter(unboxMethod);
 338                     }
 339                 }
 340             };
 341         }
 342 
 343     }
 344 
 345     /** Constructor; enters all predefined identifiers and operators
 346      *  into symbol table.
 347      */
 348     protected Symtab(Context context) throws CompletionFailure {
 349         context.put(symtabKey, this);
 350 
 351         names = Names.instance(context);
 352         target = Target.instance(context);
 353 
 354         // Create the unknown type
 355         unknownType = new Type(TypeTags.UNKNOWN, null);
 356 
 357         // create the basic builtin symbols
 358         rootPackage = new PackageSymbol(names.empty, null);
 359         final JavacMessages messages = JavacMessages.instance(context);
 360         unnamedPackage = new PackageSymbol(names.empty, rootPackage) {
 361                 public String toString() {
 362                     return messages.getLocalizedString("compiler.misc.unnamed.package");
 363                 }
 364             };
 365         noSymbol = new TypeSymbol(0, names.empty, Type.noType, rootPackage);
 366         noSymbol.kind = Kinds.NIL;
 367 
 368         // create the error symbols
 369         errSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.any, null, rootPackage);
 370         errType = new ErrorType(errSymbol, Type.noType);
 371 
 372         // initialize builtin types
 373         initType(byteType, "byte", "Byte");
 374         initType(shortType, "short", "Short");
 375         initType(charType, "char", "Character");
 376         initType(intType, "int", "Integer");
 377         initType(longType, "long", "Long");
 378         initType(floatType, "float", "Float");
 379         initType(doubleType, "double", "Double");
 380         initType(booleanType, "boolean", "Boolean");
 381         initType(voidType, "void", "Void");
 382         initType(botType, "<nulltype>");
 383         initType(errType, errSymbol);
 384         initType(unknownType, "<any?>");
 385 
 386         // the builtin class of all arrays
 387         arrayClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Array, noSymbol);
 388 
 389         // VGJ
 390         boundClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Bound, noSymbol);
 391 
 392         // the builtin class of all methods
 393         methodClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Method, noSymbol);
 394 
 395         // Create class to hold all predefined constants and operations.
 396         predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage);
 397         Scope scope = new Scope(predefClass);
 398         predefClass.members_field = scope;
 399 
 400         // Enter symbols for basic types.
 401         scope.enter(byteType.tsym);
 402         scope.enter(shortType.tsym);
 403         scope.enter(charType.tsym);
 404         scope.enter(intType.tsym);
 405         scope.enter(longType.tsym);
 406         scope.enter(floatType.tsym);
 407         scope.enter(doubleType.tsym);
 408         scope.enter(booleanType.tsym);
 409         scope.enter(errType.tsym);
 410 
 411         // Enter symbol for the errSymbol
 412         scope.enter(errSymbol);
 413 
 414         classes.put(predefClass.fullname, predefClass);
 415 
 416         reader = ClassReader.instance(context);
 417         reader.init(this);
 418 
 419         // Enter predefined classes.
 420         objectType = enterClass("java.lang.Object");
 421         classType = enterClass("java.lang.Class");
 422         stringType = enterClass("java.lang.String");
 423         stringBufferType = enterClass("java.lang.StringBuffer");
 424         stringBuilderType = enterClass("java.lang.StringBuilder");
 425         cloneableType = enterClass("java.lang.Cloneable");
 426         throwableType = enterClass("java.lang.Throwable");
 427         serializableType = enterClass("java.io.Serializable");
 428         methodHandleType = enterClass("java.dyn.MethodHandle");
 429         invokeDynamicType = enterClass("java.dyn.InvokeDynamic");
 430         errorType = enterClass("java.lang.Error");
 431         illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
 432         exceptionType = enterClass("java.lang.Exception");
 433         runtimeExceptionType = enterClass("java.lang.RuntimeException");
 434         classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException");
 435         noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError");
 436         noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError");
 437         assertionErrorType = enterClass("java.lang.AssertionError");
 438         cloneNotSupportedExceptionType = enterClass("java.lang.CloneNotSupportedException");
 439         annotationType = enterClass("java.lang.annotation.Annotation");
 440         classLoaderType = enterClass("java.lang.ClassLoader");
 441         enumSym = reader.enterClass(names.java_lang_Enum);
 442         enumFinalFinalize =
 443             new MethodSymbol(PROTECTED|FINAL|HYPOTHETICAL,
 444                              names.finalize,
 445                              new MethodType(List.<Type>nil(), voidType,
 446                                             List.<Type>nil(), methodClass),
 447                              enumSym);
 448         listType = enterClass("java.util.List");
 449         collectionsType = enterClass("java.util.Collections");
 450         comparableType = enterClass("java.lang.Comparable");
 451         arraysType = enterClass("java.util.Arrays");
 452         iterableType = target.hasIterable()
 453             ? enterClass("java.lang.Iterable")
 454             : enterClass("java.util.Collection");
 455         iteratorType = enterClass("java.util.Iterator");
 456         annotationTargetType = enterClass("java.lang.annotation.Target");
 457         overrideType = enterClass("java.lang.Override");
 458         retentionType = enterClass("java.lang.annotation.Retention");
 459         deprecatedType = enterClass("java.lang.Deprecated");
 460         suppressWarningsType = enterClass("java.lang.SuppressWarnings");
 461         inheritedType = enterClass("java.lang.annotation.Inherited");
 462         systemType = enterClass("java.lang.System");
 463 
 464         synthesizeEmptyInterfaceIfMissing(cloneableType);
 465         synthesizeEmptyInterfaceIfMissing(serializableType);
 466         synthesizeMHTypeIfMissing(methodHandleType);
 467         synthesizeMHTypeIfMissing(invokeDynamicType);
 468         synthesizeBoxTypeIfMissing(doubleType);
 469         synthesizeBoxTypeIfMissing(floatType);
 470         synthesizeBoxTypeIfMissing(voidType);
 471 
 472         // Enter a synthetic class that is used to mark internal
 473         // proprietary classes in ct.sym.  This class does not have a
 474         // class file.
 475         ClassType proprietaryType = (ClassType)enterClass("sun.Proprietary+Annotation");
 476         this.proprietaryType = proprietaryType;
 477         ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym;
 478         proprietarySymbol.completer = null;
 479         proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
 480         proprietarySymbol.erasure_field = proprietaryType;
 481         proprietarySymbol.members_field = new Scope(proprietarySymbol);
 482         proprietaryType.typarams_field = List.nil();
 483         proprietaryType.allparams_field = List.nil();
 484         proprietaryType.supertype_field = annotationType;
 485         proprietaryType.interfaces_field = List.nil();
 486 
 487         // Enter a class for arrays.
 488         // The class implements java.lang.Cloneable and java.io.Serializable.
 489         // It has a final length field and a clone method.
 490         ClassType arrayClassType = (ClassType)arrayClass.type;
 491         arrayClassType.supertype_field = objectType;
 492         arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
 493         arrayClass.members_field = new Scope(arrayClass);
 494         lengthVar = new VarSymbol(
 495             PUBLIC | FINAL,
 496             names.length,
 497             intType,
 498             arrayClass);
 499         arrayClass.members().enter(lengthVar);
 500         arrayCloneMethod = new MethodSymbol(
 501             PUBLIC,
 502             names.clone,
 503             new MethodType(List.<Type>nil(), objectType,
 504                            List.<Type>nil(), methodClass),
 505             arrayClass);
 506         arrayClass.members().enter(arrayCloneMethod);
 507 
 508         // Enter operators.
 509         enterUnop("+", doubleType, doubleType, nop);
 510         enterUnop("+", floatType, floatType, nop);
 511         enterUnop("+", longType, longType, nop);
 512         enterUnop("+", intType, intType, nop);
 513 
 514         enterUnop("-", doubleType, doubleType, dneg);
 515         enterUnop("-", floatType, floatType, fneg);
 516         enterUnop("-", longType, longType, lneg);
 517         enterUnop("-", intType, intType, ineg);
 518 
 519         enterUnop("~", longType, longType, lxor);
 520         enterUnop("~", intType, intType, ixor);
 521 
 522         enterUnop("++", doubleType, doubleType, dadd);
 523         enterUnop("++", floatType, floatType, fadd);
 524         enterUnop("++", longType, longType, ladd);
 525         enterUnop("++", intType, intType, iadd);
 526         enterUnop("++", charType, charType, iadd);
 527         enterUnop("++", shortType, shortType, iadd);
 528         enterUnop("++", byteType, byteType, iadd);
 529 
 530         enterUnop("--", doubleType, doubleType, dsub);
 531         enterUnop("--", floatType, floatType, fsub);
 532         enterUnop("--", longType, longType, lsub);
 533         enterUnop("--", intType, intType, isub);
 534         enterUnop("--", charType, charType, isub);
 535         enterUnop("--", shortType, shortType, isub);
 536         enterUnop("--", byteType, byteType, isub);
 537 
 538         enterUnop("!", booleanType, booleanType, bool_not);
 539         nullcheck = enterUnop("<*nullchk*>", objectType, objectType, nullchk);
 540 
 541         // string concatenation
 542         enterBinop("+", stringType, objectType, stringType, string_add);
 543         enterBinop("+", objectType, stringType, stringType, string_add);
 544         enterBinop("+", stringType, stringType, stringType, string_add);
 545         enterBinop("+", stringType, intType, stringType, string_add);
 546         enterBinop("+", stringType, longType, stringType, string_add);
 547         enterBinop("+", stringType, floatType, stringType, string_add);
 548         enterBinop("+", stringType, doubleType, stringType, string_add);
 549         enterBinop("+", stringType, booleanType, stringType, string_add);
 550         enterBinop("+", stringType, botType, stringType, string_add);
 551         enterBinop("+", intType, stringType, stringType, string_add);
 552         enterBinop("+", longType, stringType, stringType, string_add);
 553         enterBinop("+", floatType, stringType, stringType, string_add);
 554         enterBinop("+", doubleType, stringType, stringType, string_add);
 555         enterBinop("+", booleanType, stringType, stringType, string_add);
 556         enterBinop("+", botType, stringType, stringType, string_add);
 557 
 558         // these errors would otherwise be matched as string concatenation
 559         enterBinop("+", botType, botType, botType, error);
 560         enterBinop("+", botType, intType, botType, error);
 561         enterBinop("+", botType, longType, botType, error);
 562         enterBinop("+", botType, floatType, botType, error);
 563         enterBinop("+", botType, doubleType, botType, error);
 564         enterBinop("+", botType, booleanType, botType, error);
 565         enterBinop("+", botType, objectType, botType, error);
 566         enterBinop("+", intType, botType, botType, error);
 567         enterBinop("+", longType, botType, botType, error);
 568         enterBinop("+", floatType, botType, botType, error);
 569         enterBinop("+", doubleType, botType, botType, error);
 570         enterBinop("+", booleanType, botType, botType, error);
 571         enterBinop("+", objectType, botType, botType, error);
 572 
 573         enterBinop("+", doubleType, doubleType, doubleType, dadd);
 574         enterBinop("+", floatType, floatType, floatType, fadd);
 575         enterBinop("+", longType, longType, longType, ladd);
 576         enterBinop("+", intType, intType, intType, iadd);
 577 
 578         enterBinop("-", doubleType, doubleType, doubleType, dsub);
 579         enterBinop("-", floatType, floatType, floatType, fsub);
 580         enterBinop("-", longType, longType, longType, lsub);
 581         enterBinop("-", intType, intType, intType, isub);
 582 
 583         enterBinop("*", doubleType, doubleType, doubleType, dmul);
 584         enterBinop("*", floatType, floatType, floatType, fmul);
 585         enterBinop("*", longType, longType, longType, lmul);
 586         enterBinop("*", intType, intType, intType, imul);
 587 
 588         enterBinop("/", doubleType, doubleType, doubleType, ddiv);
 589         enterBinop("/", floatType, floatType, floatType, fdiv);
 590         enterBinop("/", longType, longType, longType, ldiv);
 591         enterBinop("/", intType, intType, intType, idiv);
 592 
 593         enterBinop("%", doubleType, doubleType, doubleType, dmod);
 594         enterBinop("%", floatType, floatType, floatType, fmod);
 595         enterBinop("%", longType, longType, longType, lmod);
 596         enterBinop("%", intType, intType, intType, imod);
 597 
 598         enterBinop("&", booleanType, booleanType, booleanType, iand);
 599         enterBinop("&", longType, longType, longType, land);
 600         enterBinop("&", intType, intType, intType, iand);
 601 
 602         enterBinop("|", booleanType, booleanType, booleanType, ior);
 603         enterBinop("|", longType, longType, longType, lor);
 604         enterBinop("|", intType, intType, intType, ior);
 605 
 606         enterBinop("^", booleanType, booleanType, booleanType, ixor);
 607         enterBinop("^", longType, longType, longType, lxor);
 608         enterBinop("^", intType, intType, intType, ixor);
 609 
 610         enterBinop("<<", longType, longType, longType, lshll);
 611         enterBinop("<<", intType, longType, intType, ishll);
 612         enterBinop("<<", longType, intType, longType, lshl);
 613         enterBinop("<<", intType, intType, intType, ishl);
 614 
 615         enterBinop(">>", longType, longType, longType, lshrl);
 616         enterBinop(">>", intType, longType, intType, ishrl);
 617         enterBinop(">>", longType, intType, longType, lshr);
 618         enterBinop(">>", intType, intType, intType, ishr);
 619 
 620         enterBinop(">>>", longType, longType, longType, lushrl);
 621         enterBinop(">>>", intType, longType, intType, iushrl);
 622         enterBinop(">>>", longType, intType, longType, lushr);
 623         enterBinop(">>>", intType, intType, intType, iushr);
 624 
 625         enterBinop("<", doubleType, doubleType, booleanType, dcmpg, iflt);
 626         enterBinop("<", floatType, floatType, booleanType, fcmpg, iflt);
 627         enterBinop("<", longType, longType, booleanType, lcmp, iflt);
 628         enterBinop("<", intType, intType, booleanType, if_icmplt);
 629 
 630         enterBinop(">", doubleType, doubleType, booleanType, dcmpl, ifgt);
 631         enterBinop(">", floatType, floatType, booleanType, fcmpl, ifgt);
 632         enterBinop(">", longType, longType, booleanType, lcmp, ifgt);
 633         enterBinop(">", intType, intType, booleanType, if_icmpgt);
 634 
 635         enterBinop("<=", doubleType, doubleType, booleanType, dcmpg, ifle);
 636         enterBinop("<=", floatType, floatType, booleanType, fcmpg, ifle);
 637         enterBinop("<=", longType, longType, booleanType, lcmp, ifle);
 638         enterBinop("<=", intType, intType, booleanType, if_icmple);
 639 
 640         enterBinop(">=", doubleType, doubleType, booleanType, dcmpl, ifge);
 641         enterBinop(">=", floatType, floatType, booleanType, fcmpl, ifge);
 642         enterBinop(">=", longType, longType, booleanType, lcmp, ifge);
 643         enterBinop(">=", intType, intType, booleanType, if_icmpge);
 644 
 645         enterBinop("==", objectType, objectType, booleanType, if_acmpeq);
 646         enterBinop("==", booleanType, booleanType, booleanType, if_icmpeq);
 647         enterBinop("==", doubleType, doubleType, booleanType, dcmpl, ifeq);
 648         enterBinop("==", floatType, floatType, booleanType, fcmpl, ifeq);
 649         enterBinop("==", longType, longType, booleanType, lcmp, ifeq);
 650         enterBinop("==", intType, intType, booleanType, if_icmpeq);
 651 
 652         enterBinop("!=", objectType, objectType, booleanType, if_acmpne);
 653         enterBinop("!=", booleanType, booleanType, booleanType, if_icmpne);
 654         enterBinop("!=", doubleType, doubleType, booleanType, dcmpl, ifne);
 655         enterBinop("!=", floatType, floatType, booleanType, fcmpl, ifne);
 656         enterBinop("!=", longType, longType, booleanType, lcmp, ifne);
 657         enterBinop("!=", intType, intType, booleanType, if_icmpne);
 658 
 659         enterBinop("&&", booleanType, booleanType, booleanType, bool_and);
 660         enterBinop("||", booleanType, booleanType, booleanType, bool_or);
 661     }
 662 }