src/share/classes/com/sun/tools/javac/code/Symtab.java

Mon, 26 Mar 2012 15:28:49 +0100

author
mcimadamore
date
Mon, 26 Mar 2012 15:28:49 +0100
changeset 1239
2827076dbf64
parent 1230
b14d9583ce92
child 1313
873ddd9f4900
permissions
-rw-r--r--

7133185: Update 292 overload resolution logic to match JLS
Summary: Re-implement special overload resolution support for method handles according to the JLS SE 7 definition
Reviewed-by: jjg, dlsmith, jrose

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

mercurial