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