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