Thu, 05 Jan 2017 18:58:06 +0000
8168774: Polymorhic signature method check crashes javac
Summary: Check for polysig method assumes arity is greater than zero
Reviewed-by: vromero
1 /*
2 * Copyright (c) 1999, 2013, 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.*;
30 import javax.lang.model.element.ElementVisitor;
32 import com.sun.tools.javac.code.Symbol.*;
33 import com.sun.tools.javac.code.Type.*;
34 import com.sun.tools.javac.jvm.*;
35 import com.sun.tools.javac.util.*;
36 import com.sun.tools.javac.util.List;
37 import static com.sun.tools.javac.code.Flags.*;
38 import static com.sun.tools.javac.jvm.ByteCodes.*;
39 import static com.sun.tools.javac.code.TypeTag.*;
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 JCPrimitiveType byteType = new JCPrimitiveType(BYTE, null);
68 public final JCPrimitiveType charType = new JCPrimitiveType(CHAR, null);
69 public final JCPrimitiveType shortType = new JCPrimitiveType(SHORT, null);
70 public final JCPrimitiveType intType = new JCPrimitiveType(INT, null);
71 public final JCPrimitiveType longType = new JCPrimitiveType(LONG, null);
72 public final JCPrimitiveType floatType = new JCPrimitiveType(FLOAT, null);
73 public final JCPrimitiveType doubleType = new JCPrimitiveType(DOUBLE, null);
74 public final JCPrimitiveType booleanType = new JCPrimitiveType(BOOLEAN, null);
75 public final Type botType = new BottomType();
76 public final JCVoidType voidType = new JCVoidType();
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 serializedLambdaType;
129 public final Type methodHandleType;
130 public final Type methodHandleLookupType;
131 public final Type methodTypeType;
132 public final Type nativeHeaderType;
133 public final Type throwableType;
134 public final Type errorType;
135 public final Type interruptedExceptionType;
136 public final Type illegalArgumentExceptionType;
137 public final Type exceptionType;
138 public final Type runtimeExceptionType;
139 public final Type classNotFoundExceptionType;
140 public final Type noClassDefFoundErrorType;
141 public final Type noSuchFieldErrorType;
142 public final Type assertionErrorType;
143 public final Type cloneNotSupportedExceptionType;
144 public final Type annotationType;
145 public final TypeSymbol enumSym;
146 public final Type listType;
147 public final Type collectionsType;
148 public final Type comparableType;
149 public final Type comparatorType;
150 public final Type arraysType;
151 public final Type iterableType;
152 public final Type iteratorType;
153 public final Type annotationTargetType;
154 public final Type overrideType;
155 public final Type retentionType;
156 public final Type deprecatedType;
157 public final Type suppressWarningsType;
158 public final Type inheritedType;
159 public final Type profileType;
160 public final Type proprietaryType;
161 public final Type systemType;
162 public final Type autoCloseableType;
163 public final Type trustMeType;
164 public final Type lambdaMetafactory;
165 public final Type repeatableType;
166 public final Type documentedType;
167 public final Type elementTypeType;
168 public final Type functionalInterfaceType;
170 /** The symbol representing the length field of an array.
171 */
172 public final VarSymbol lengthVar;
174 /** The null check operator. */
175 public final OperatorSymbol nullcheck;
177 /** The symbol representing the final finalize method on enums */
178 public final MethodSymbol enumFinalFinalize;
180 /** The symbol representing the close method on TWR AutoCloseable type */
181 public final MethodSymbol autoCloseableClose;
183 /** The predefined type that belongs to a tag.
184 */
185 public final Type[] typeOfTag = new Type[TypeTag.getTypeTagCount()];
187 /** The name of the class that belongs to a basix type tag.
188 */
189 public final Name[] boxedName = new Name[TypeTag.getTypeTagCount()];
191 /** A set containing all operator names.
192 */
193 public final Set<Name> operatorNames = new HashSet<Name>();
195 /** A hashtable containing the encountered top-level and member classes,
196 * indexed by flat names. The table does not contain local classes.
197 * It should be updated from the outside to reflect classes defined
198 * by compiled source files.
199 */
200 public final Map<Name, ClassSymbol> classes = new HashMap<Name, ClassSymbol>();
202 /** A hashtable containing the encountered packages.
203 * the table should be updated from outside to reflect packages defined
204 * by compiled source files.
205 */
206 public final Map<Name, PackageSymbol> packages = new HashMap<Name, PackageSymbol>();
208 public void initType(Type type, ClassSymbol c) {
209 type.tsym = c;
210 typeOfTag[type.getTag().ordinal()] = type;
211 }
213 public void initType(Type type, String name) {
214 initType(
215 type,
216 new ClassSymbol(
217 PUBLIC, names.fromString(name), type, rootPackage));
218 }
220 public void initType(Type type, String name, String bname) {
221 initType(type, name);
222 boxedName[type.getTag().ordinal()] = names.fromString("java.lang." + bname);
223 }
225 /** The class symbol that owns all predefined symbols.
226 */
227 public final ClassSymbol predefClass;
229 /** Enter a constant into symbol table.
230 * @param name The constant's name.
231 * @param type The constant's type.
232 */
233 private VarSymbol enterConstant(String name, Type type) {
234 VarSymbol c = new VarSymbol(
235 PUBLIC | STATIC | FINAL,
236 names.fromString(name),
237 type,
238 predefClass);
239 c.setData(type.constValue());
240 predefClass.members().enter(c);
241 return c;
242 }
244 /** Enter a binary operation into symbol table.
245 * @param name The name of the operator.
246 * @param left The type of the left operand.
247 * @param right The type of the left operand.
248 * @param res The operation's result type.
249 * @param opcode The operation's bytecode instruction.
250 */
251 private void enterBinop(String name,
252 Type left, Type right, Type res,
253 int opcode) {
254 predefClass.members().enter(
255 new OperatorSymbol(
256 makeOperatorName(name),
257 new MethodType(List.of(left, right), res,
258 List.<Type>nil(), methodClass),
259 opcode,
260 predefClass));
261 }
263 /** Enter a binary operation, as above but with two opcodes,
264 * which get encoded as
265 * {@code (opcode1 << ByteCodeTags.preShift) + opcode2 }.
266 * @param opcode1 First opcode.
267 * @param opcode2 Second opcode.
268 */
269 private void enterBinop(String name,
270 Type left, Type right, Type res,
271 int opcode1, int opcode2) {
272 enterBinop(
273 name, left, right, res, (opcode1 << ByteCodes.preShift) | opcode2);
274 }
276 /** Enter a unary operation into symbol table.
277 * @param name The name of the operator.
278 * @param arg The type of the operand.
279 * @param res The operation's result type.
280 * @param opcode The operation's bytecode instruction.
281 */
282 private OperatorSymbol enterUnop(String name,
283 Type arg,
284 Type res,
285 int opcode) {
286 OperatorSymbol sym =
287 new OperatorSymbol(makeOperatorName(name),
288 new MethodType(List.of(arg),
289 res,
290 List.<Type>nil(),
291 methodClass),
292 opcode,
293 predefClass);
294 predefClass.members().enter(sym);
295 return sym;
296 }
298 /**
299 * Create a new operator name from corresponding String representation
300 * and add the name to the set of known operator names.
301 */
302 private Name makeOperatorName(String name) {
303 Name opName = names.fromString(name);
304 operatorNames.add(opName);
305 return opName;
306 }
308 /** Enter a class into symbol table.
309 * @param s The name of the class.
310 */
311 private Type enterClass(String s) {
312 return reader.enterClass(names.fromString(s)).type;
313 }
315 public void synthesizeEmptyInterfaceIfMissing(final Type type) {
316 final Completer completer = type.tsym.completer;
317 if (completer != null) {
318 type.tsym.completer = new Completer() {
319 public void complete(Symbol sym) throws CompletionFailure {
320 try {
321 completer.complete(sym);
322 } catch (CompletionFailure e) {
323 sym.flags_field |= (PUBLIC | INTERFACE);
324 ((ClassType) sym.type).supertype_field = objectType;
325 }
326 }
327 };
328 }
329 }
331 public void synthesizeBoxTypeIfMissing(final Type type) {
332 ClassSymbol sym = reader.enterClass(boxedName[type.getTag().ordinal()]);
333 final Completer completer = sym.completer;
334 if (completer != null) {
335 sym.completer = new Completer() {
336 public void complete(Symbol sym) throws CompletionFailure {
337 try {
338 completer.complete(sym);
339 } catch (CompletionFailure e) {
340 sym.flags_field |= PUBLIC;
341 ((ClassType) sym.type).supertype_field = objectType;
342 Name n = target.boxWithConstructors() ? names.init : names.valueOf;
343 MethodSymbol boxMethod =
344 new MethodSymbol(PUBLIC | STATIC,
345 n,
346 new MethodType(List.of(type), sym.type,
347 List.<Type>nil(), methodClass),
348 sym);
349 sym.members().enter(boxMethod);
350 MethodSymbol unboxMethod =
351 new MethodSymbol(PUBLIC,
352 type.tsym.name.append(names.Value), // x.intValue()
353 new MethodType(List.<Type>nil(), type,
354 List.<Type>nil(), methodClass),
355 sym);
356 sym.members().enter(unboxMethod);
357 }
358 }
359 };
360 }
362 }
364 // Enter a synthetic class that is used to mark classes in ct.sym.
365 // This class does not have a class file.
366 private Type enterSyntheticAnnotation(String name) {
367 ClassType type = (ClassType)enterClass(name);
368 ClassSymbol sym = (ClassSymbol)type.tsym;
369 sym.completer = null;
370 sym.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
371 sym.erasure_field = type;
372 sym.members_field = new Scope(sym);
373 type.typarams_field = List.nil();
374 type.allparams_field = List.nil();
375 type.supertype_field = annotationType;
376 type.interfaces_field = List.nil();
377 return type;
378 }
380 /** Constructor; enters all predefined identifiers and operators
381 * into symbol table.
382 */
383 protected Symtab(Context context) throws CompletionFailure {
384 context.put(symtabKey, this);
386 names = Names.instance(context);
387 target = Target.instance(context);
389 // Create the unknown type
390 unknownType = new UnknownType();
392 // create the basic builtin symbols
393 rootPackage = new PackageSymbol(names.empty, null);
394 final JavacMessages messages = JavacMessages.instance(context);
395 unnamedPackage = new PackageSymbol(names.empty, rootPackage) {
396 public String toString() {
397 return messages.getLocalizedString("compiler.misc.unnamed.package");
398 }
399 };
400 noSymbol = new TypeSymbol(Kinds.NIL, 0, names.empty, Type.noType, rootPackage) {
401 public <R, P> R accept(ElementVisitor<R, P> v, P p) {
402 return v.visitUnknown(this, p);
403 }
404 };
406 // create the error symbols
407 errSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.any, null, rootPackage);
408 errType = new ErrorType(errSymbol, Type.noType);
410 unknownSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.fromString("<any?>"), null, rootPackage);
411 unknownSymbol.members_field = new Scope.ErrorScope(unknownSymbol);
412 unknownSymbol.type = unknownType;
414 // initialize builtin types
415 initType(byteType, "byte", "Byte");
416 initType(shortType, "short", "Short");
417 initType(charType, "char", "Character");
418 initType(intType, "int", "Integer");
419 initType(longType, "long", "Long");
420 initType(floatType, "float", "Float");
421 initType(doubleType, "double", "Double");
422 initType(booleanType, "boolean", "Boolean");
423 initType(voidType, "void", "Void");
424 initType(botType, "<nulltype>");
425 initType(errType, errSymbol);
426 initType(unknownType, unknownSymbol);
428 // the builtin class of all arrays
429 arrayClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Array, noSymbol);
431 // VGJ
432 boundClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Bound, noSymbol);
433 boundClass.members_field = new Scope.ErrorScope(boundClass);
435 // the builtin class of all methods
436 methodClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Method, noSymbol);
437 methodClass.members_field = new Scope.ErrorScope(boundClass);
439 // Create class to hold all predefined constants and operations.
440 predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage);
441 Scope scope = new Scope(predefClass);
442 predefClass.members_field = scope;
444 // Enter symbols for basic types.
445 scope.enter(byteType.tsym);
446 scope.enter(shortType.tsym);
447 scope.enter(charType.tsym);
448 scope.enter(intType.tsym);
449 scope.enter(longType.tsym);
450 scope.enter(floatType.tsym);
451 scope.enter(doubleType.tsym);
452 scope.enter(booleanType.tsym);
453 scope.enter(errType.tsym);
455 // Enter symbol for the errSymbol
456 scope.enter(errSymbol);
458 classes.put(predefClass.fullname, predefClass);
460 reader = ClassReader.instance(context);
461 reader.init(this);
463 // Enter predefined classes.
464 objectType = enterClass("java.lang.Object");
465 classType = enterClass("java.lang.Class");
466 stringType = enterClass("java.lang.String");
467 stringBufferType = enterClass("java.lang.StringBuffer");
468 stringBuilderType = enterClass("java.lang.StringBuilder");
469 cloneableType = enterClass("java.lang.Cloneable");
470 throwableType = enterClass("java.lang.Throwable");
471 serializableType = enterClass("java.io.Serializable");
472 serializedLambdaType = enterClass("java.lang.invoke.SerializedLambda");
473 methodHandleType = enterClass("java.lang.invoke.MethodHandle");
474 methodHandleLookupType = enterClass("java.lang.invoke.MethodHandles$Lookup");
475 methodTypeType = enterClass("java.lang.invoke.MethodType");
476 errorType = enterClass("java.lang.Error");
477 illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
478 interruptedExceptionType = enterClass("java.lang.InterruptedException");
479 exceptionType = enterClass("java.lang.Exception");
480 runtimeExceptionType = enterClass("java.lang.RuntimeException");
481 classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException");
482 noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError");
483 noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError");
484 assertionErrorType = enterClass("java.lang.AssertionError");
485 cloneNotSupportedExceptionType = enterClass("java.lang.CloneNotSupportedException");
486 annotationType = enterClass("java.lang.annotation.Annotation");
487 classLoaderType = enterClass("java.lang.ClassLoader");
488 enumSym = reader.enterClass(names.java_lang_Enum);
489 enumFinalFinalize =
490 new MethodSymbol(PROTECTED|FINAL|HYPOTHETICAL,
491 names.finalize,
492 new MethodType(List.<Type>nil(), voidType,
493 List.<Type>nil(), methodClass),
494 enumSym);
495 listType = enterClass("java.util.List");
496 collectionsType = enterClass("java.util.Collections");
497 comparableType = enterClass("java.lang.Comparable");
498 comparatorType = enterClass("java.util.Comparator");
499 arraysType = enterClass("java.util.Arrays");
500 iterableType = target.hasIterable()
501 ? enterClass("java.lang.Iterable")
502 : enterClass("java.util.Collection");
503 iteratorType = enterClass("java.util.Iterator");
504 annotationTargetType = enterClass("java.lang.annotation.Target");
505 overrideType = enterClass("java.lang.Override");
506 retentionType = enterClass("java.lang.annotation.Retention");
507 deprecatedType = enterClass("java.lang.Deprecated");
508 suppressWarningsType = enterClass("java.lang.SuppressWarnings");
509 inheritedType = enterClass("java.lang.annotation.Inherited");
510 repeatableType = enterClass("java.lang.annotation.Repeatable");
511 documentedType = enterClass("java.lang.annotation.Documented");
512 elementTypeType = enterClass("java.lang.annotation.ElementType");
513 systemType = enterClass("java.lang.System");
514 autoCloseableType = enterClass("java.lang.AutoCloseable");
515 autoCloseableClose = new MethodSymbol(PUBLIC,
516 names.close,
517 new MethodType(List.<Type>nil(), voidType,
518 List.of(exceptionType), methodClass),
519 autoCloseableType.tsym);
520 trustMeType = enterClass("java.lang.SafeVarargs");
521 nativeHeaderType = enterClass("java.lang.annotation.Native");
522 lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
523 functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
525 synthesizeEmptyInterfaceIfMissing(autoCloseableType);
526 synthesizeEmptyInterfaceIfMissing(cloneableType);
527 synthesizeEmptyInterfaceIfMissing(serializableType);
528 synthesizeEmptyInterfaceIfMissing(lambdaMetafactory);
529 synthesizeEmptyInterfaceIfMissing(serializedLambdaType);
530 synthesizeBoxTypeIfMissing(doubleType);
531 synthesizeBoxTypeIfMissing(floatType);
532 synthesizeBoxTypeIfMissing(voidType);
534 // Enter a synthetic class that is used to mark internal
535 // proprietary classes in ct.sym. This class does not have a
536 // class file.
537 proprietaryType = enterSyntheticAnnotation("sun.Proprietary+Annotation");
539 // Enter a synthetic class that is used to provide profile info for
540 // classes in ct.sym. This class does not have a class file.
541 profileType = enterSyntheticAnnotation("jdk.Profile+Annotation");
542 MethodSymbol m = new MethodSymbol(PUBLIC | ABSTRACT, names.value, intType, profileType.tsym);
543 profileType.tsym.members().enter(m);
545 // Enter a class for arrays.
546 // The class implements java.lang.Cloneable and java.io.Serializable.
547 // It has a final length field and a clone method.
548 ClassType arrayClassType = (ClassType)arrayClass.type;
549 arrayClassType.supertype_field = objectType;
550 arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
551 arrayClass.members_field = new Scope(arrayClass);
552 lengthVar = new VarSymbol(
553 PUBLIC | FINAL,
554 names.length,
555 intType,
556 arrayClass);
557 arrayClass.members().enter(lengthVar);
558 arrayCloneMethod = new MethodSymbol(
559 PUBLIC,
560 names.clone,
561 new MethodType(List.<Type>nil(), objectType,
562 List.<Type>nil(), methodClass),
563 arrayClass);
564 arrayClass.members().enter(arrayCloneMethod);
566 // Enter operators.
567 /* Internally we use +++, --- for unary +, - to reduce +, - operators
568 * overloading
569 */
570 enterUnop("+++", doubleType, doubleType, nop);
571 enterUnop("+++", floatType, floatType, nop);
572 enterUnop("+++", longType, longType, nop);
573 enterUnop("+++", intType, intType, nop);
575 enterUnop("---", doubleType, doubleType, dneg);
576 enterUnop("---", floatType, floatType, fneg);
577 enterUnop("---", longType, longType, lneg);
578 enterUnop("---", intType, intType, ineg);
580 enterUnop("~", longType, longType, lxor);
581 enterUnop("~", intType, intType, ixor);
583 enterUnop("++", doubleType, doubleType, dadd);
584 enterUnop("++", floatType, floatType, fadd);
585 enterUnop("++", longType, longType, ladd);
586 enterUnop("++", intType, intType, iadd);
587 enterUnop("++", charType, charType, iadd);
588 enterUnop("++", shortType, shortType, iadd);
589 enterUnop("++", byteType, byteType, iadd);
591 enterUnop("--", doubleType, doubleType, dsub);
592 enterUnop("--", floatType, floatType, fsub);
593 enterUnop("--", longType, longType, lsub);
594 enterUnop("--", intType, intType, isub);
595 enterUnop("--", charType, charType, isub);
596 enterUnop("--", shortType, shortType, isub);
597 enterUnop("--", byteType, byteType, isub);
599 enterUnop("!", booleanType, booleanType, bool_not);
600 nullcheck = enterUnop("<*nullchk*>", objectType, objectType, nullchk);
602 // string concatenation
603 enterBinop("+", stringType, objectType, stringType, string_add);
604 enterBinop("+", objectType, stringType, stringType, string_add);
605 enterBinop("+", stringType, stringType, stringType, string_add);
606 enterBinop("+", stringType, intType, stringType, string_add);
607 enterBinop("+", stringType, longType, stringType, string_add);
608 enterBinop("+", stringType, floatType, stringType, string_add);
609 enterBinop("+", stringType, doubleType, stringType, string_add);
610 enterBinop("+", stringType, booleanType, stringType, string_add);
611 enterBinop("+", stringType, botType, stringType, string_add);
612 enterBinop("+", intType, stringType, stringType, string_add);
613 enterBinop("+", longType, stringType, stringType, string_add);
614 enterBinop("+", floatType, stringType, stringType, string_add);
615 enterBinop("+", doubleType, stringType, stringType, string_add);
616 enterBinop("+", booleanType, stringType, stringType, string_add);
617 enterBinop("+", botType, stringType, stringType, string_add);
619 // these errors would otherwise be matched as string concatenation
620 enterBinop("+", botType, botType, botType, error);
621 enterBinop("+", botType, intType, botType, error);
622 enterBinop("+", botType, longType, botType, error);
623 enterBinop("+", botType, floatType, botType, error);
624 enterBinop("+", botType, doubleType, botType, error);
625 enterBinop("+", botType, booleanType, botType, error);
626 enterBinop("+", botType, objectType, botType, error);
627 enterBinop("+", intType, botType, botType, error);
628 enterBinop("+", longType, botType, botType, error);
629 enterBinop("+", floatType, botType, botType, error);
630 enterBinop("+", doubleType, botType, botType, error);
631 enterBinop("+", booleanType, botType, botType, error);
632 enterBinop("+", objectType, botType, botType, error);
634 enterBinop("+", doubleType, doubleType, doubleType, dadd);
635 enterBinop("+", floatType, floatType, floatType, fadd);
636 enterBinop("+", longType, longType, longType, ladd);
637 enterBinop("+", intType, intType, intType, iadd);
639 enterBinop("-", doubleType, doubleType, doubleType, dsub);
640 enterBinop("-", floatType, floatType, floatType, fsub);
641 enterBinop("-", longType, longType, longType, lsub);
642 enterBinop("-", intType, intType, intType, isub);
644 enterBinop("*", doubleType, doubleType, doubleType, dmul);
645 enterBinop("*", floatType, floatType, floatType, fmul);
646 enterBinop("*", longType, longType, longType, lmul);
647 enterBinop("*", intType, intType, intType, imul);
649 enterBinop("/", doubleType, doubleType, doubleType, ddiv);
650 enterBinop("/", floatType, floatType, floatType, fdiv);
651 enterBinop("/", longType, longType, longType, ldiv);
652 enterBinop("/", intType, intType, intType, idiv);
654 enterBinop("%", doubleType, doubleType, doubleType, dmod);
655 enterBinop("%", floatType, floatType, floatType, fmod);
656 enterBinop("%", longType, longType, longType, lmod);
657 enterBinop("%", intType, intType, intType, imod);
659 enterBinop("&", booleanType, booleanType, booleanType, iand);
660 enterBinop("&", longType, longType, longType, land);
661 enterBinop("&", intType, intType, intType, iand);
663 enterBinop("|", booleanType, booleanType, booleanType, ior);
664 enterBinop("|", longType, longType, longType, lor);
665 enterBinop("|", intType, intType, intType, ior);
667 enterBinop("^", booleanType, booleanType, booleanType, ixor);
668 enterBinop("^", longType, longType, longType, lxor);
669 enterBinop("^", intType, intType, intType, ixor);
671 enterBinop("<<", longType, longType, longType, lshll);
672 enterBinop("<<", intType, longType, intType, ishll);
673 enterBinop("<<", longType, intType, longType, lshl);
674 enterBinop("<<", intType, intType, intType, ishl);
676 enterBinop(">>", longType, longType, longType, lshrl);
677 enterBinop(">>", intType, longType, intType, ishrl);
678 enterBinop(">>", longType, intType, longType, lshr);
679 enterBinop(">>", intType, intType, intType, ishr);
681 enterBinop(">>>", longType, longType, longType, lushrl);
682 enterBinop(">>>", intType, longType, intType, iushrl);
683 enterBinop(">>>", longType, intType, longType, lushr);
684 enterBinop(">>>", intType, intType, intType, iushr);
686 enterBinop("<", doubleType, doubleType, booleanType, dcmpg, iflt);
687 enterBinop("<", floatType, floatType, booleanType, fcmpg, iflt);
688 enterBinop("<", longType, longType, booleanType, lcmp, iflt);
689 enterBinop("<", intType, intType, booleanType, if_icmplt);
691 enterBinop(">", doubleType, doubleType, booleanType, dcmpl, ifgt);
692 enterBinop(">", floatType, floatType, booleanType, fcmpl, ifgt);
693 enterBinop(">", longType, longType, booleanType, lcmp, ifgt);
694 enterBinop(">", intType, intType, booleanType, if_icmpgt);
696 enterBinop("<=", doubleType, doubleType, booleanType, dcmpg, ifle);
697 enterBinop("<=", floatType, floatType, booleanType, fcmpg, ifle);
698 enterBinop("<=", longType, longType, booleanType, lcmp, ifle);
699 enterBinop("<=", intType, intType, booleanType, if_icmple);
701 enterBinop(">=", doubleType, doubleType, booleanType, dcmpl, ifge);
702 enterBinop(">=", floatType, floatType, booleanType, fcmpl, ifge);
703 enterBinop(">=", longType, longType, booleanType, lcmp, ifge);
704 enterBinop(">=", intType, intType, booleanType, if_icmpge);
706 enterBinop("==", objectType, objectType, booleanType, if_acmpeq);
707 enterBinop("==", booleanType, booleanType, booleanType, if_icmpeq);
708 enterBinop("==", doubleType, doubleType, booleanType, dcmpl, ifeq);
709 enterBinop("==", floatType, floatType, booleanType, fcmpl, ifeq);
710 enterBinop("==", longType, longType, booleanType, lcmp, ifeq);
711 enterBinop("==", intType, intType, booleanType, if_icmpeq);
713 enterBinop("!=", objectType, objectType, booleanType, if_acmpne);
714 enterBinop("!=", booleanType, booleanType, booleanType, if_icmpne);
715 enterBinop("!=", doubleType, doubleType, booleanType, dcmpl, ifne);
716 enterBinop("!=", floatType, floatType, booleanType, fcmpl, ifne);
717 enterBinop("!=", longType, longType, booleanType, lcmp, ifne);
718 enterBinop("!=", intType, intType, booleanType, if_icmpne);
720 enterBinop("&&", booleanType, booleanType, booleanType, bool_and);
721 enterBinop("||", booleanType, booleanType, booleanType, bool_or);
722 }
723 }