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