author | jjg |
Tue, 01 Mar 2011 12:00:06 -0800 | |
changeset 8621 | ce0bce60cffc |
parent 8242 | 3873b4aaf4a8 |
child 9076 | 45c73da050e9 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
8621
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
2 |
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. |
10 | 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 |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 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 |
* |
|
5520 | 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. |
|
10 | 24 |
*/ |
25 |
||
26 |
package com.sun.tools.javac.code; |
|
27 |
||
28 |
import java.util.*; |
|
8621
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
29 |
import javax.lang.model.type.TypeVisitor; |
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
30 |
import javax.lang.model.element.ElementVisitor; |
10 | 31 |
|
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.*; |
|
37 |
||
38 |
import static com.sun.tools.javac.jvm.ByteCodes.*; |
|
39 |
import static com.sun.tools.javac.code.Flags.*; |
|
40 |
||
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 |
* |
|
5847
1908176fd6e3
6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents:
5520
diff
changeset
|
47 |
* <p><b>This is NOT part of any supported API. |
1908176fd6e3
6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents:
5520
diff
changeset
|
48 |
* If you write code that depends on this, you do so at your own risk. |
10 | 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>(); |
|
56 |
||
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 |
} |
|
64 |
||
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); |
|
77 |
||
1260
a772ba9ba43d
6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
1257
diff
changeset
|
78 |
private final Names names; |
10 | 79 |
private final ClassReader reader; |
1037
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
80 |
private final Target target; |
10 | 81 |
|
82 |
/** A symbol for the root package. |
|
83 |
*/ |
|
84 |
public final PackageSymbol rootPackage; |
|
85 |
||
86 |
/** A symbol for the unnamed package. |
|
87 |
*/ |
|
88 |
public final PackageSymbol unnamedPackage; |
|
89 |
||
90 |
/** A symbol that stands for a missing symbol. |
|
91 |
*/ |
|
92 |
public final TypeSymbol noSymbol; |
|
93 |
||
94 |
/** The error symbol. |
|
95 |
*/ |
|
96 |
public final ClassSymbol errSymbol; |
|
97 |
||
6594
d43f068fba19
6970584: Flow.java should be more error-friendly
mcimadamore
parents:
6148
diff
changeset
|
98 |
/** The unknown symbol. |
d43f068fba19
6970584: Flow.java should be more error-friendly
mcimadamore
parents:
6148
diff
changeset
|
99 |
*/ |
d43f068fba19
6970584: Flow.java should be more error-friendly
mcimadamore
parents:
6148
diff
changeset
|
100 |
public final ClassSymbol unknownSymbol; |
d43f068fba19
6970584: Flow.java should be more error-friendly
mcimadamore
parents:
6148
diff
changeset
|
101 |
|
1257
873b053bf757
6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents:
1037
diff
changeset
|
102 |
/** A value for the errType, with a originalType of noType */ |
10 | 103 |
public final Type errType; |
104 |
||
105 |
/** A value for the unknown type. */ |
|
106 |
public final Type unknownType; |
|
107 |
||
108 |
/** The builtin type of all arrays. */ |
|
109 |
public final ClassSymbol arrayClass; |
|
110 |
public final MethodSymbol arrayCloneMethod; |
|
111 |
||
112 |
/** VGJ: The (singleton) type of all bound types. */ |
|
113 |
public final ClassSymbol boundClass; |
|
114 |
||
115 |
/** The builtin type of all methods. */ |
|
116 |
public final ClassSymbol methodClass; |
|
117 |
||
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; |
|
8241
4161b56e0d20
7017414: before the move of JSR 292 to package java.lang.invoke, javac must recognize the new package
mcimadamore
parents:
8036
diff
changeset
|
128 |
public final Type transientMethodHandleType; // transient - 292 |
2723
b659ca23d5f5
6829189: Java programming with JSR 292 needs language support
jrose
parents:
1471
diff
changeset
|
129 |
public final Type methodHandleType; |
8241
4161b56e0d20
7017414: before the move of JSR 292 to package java.lang.invoke, javac must recognize the new package
mcimadamore
parents:
8036
diff
changeset
|
130 |
public final Type transientPolymorphicSignatureType; // transient - 292 |
5736
ee0850472ca1
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
3555
diff
changeset
|
131 |
public final Type polymorphicSignatureType; |
10 | 132 |
public final Type throwableType; |
133 |
public final Type errorType; |
|
134 |
public final Type illegalArgumentExceptionType; |
|
135 |
public final Type exceptionType; |
|
136 |
public final Type runtimeExceptionType; |
|
137 |
public final Type classNotFoundExceptionType; |
|
138 |
public final Type noClassDefFoundErrorType; |
|
139 |
public final Type noSuchFieldErrorType; |
|
140 |
public final Type assertionErrorType; |
|
141 |
public final Type cloneNotSupportedExceptionType; |
|
142 |
public final Type annotationType; |
|
143 |
public final TypeSymbol enumSym; |
|
144 |
public final Type listType; |
|
145 |
public final Type collectionsType; |
|
146 |
public final Type comparableType; |
|
147 |
public final Type arraysType; |
|
148 |
public final Type iterableType; |
|
149 |
public final Type iteratorType; |
|
150 |
public final Type annotationTargetType; |
|
151 |
public final Type overrideType; |
|
152 |
public final Type retentionType; |
|
153 |
public final Type deprecatedType; |
|
154 |
public final Type suppressWarningsType; |
|
155 |
public final Type inheritedType; |
|
156 |
public final Type proprietaryType; |
|
1037
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
157 |
public final Type systemType; |
6148
3a8158299c51
6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents:
5857
diff
changeset
|
158 |
public final Type autoCloseableType; |
7643
a067a0cda531
6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents:
6709
diff
changeset
|
159 |
public final Type trustMeType; |
10 | 160 |
|
161 |
/** The symbol representing the length field of an array. |
|
162 |
*/ |
|
163 |
public final VarSymbol lengthVar; |
|
164 |
||
165 |
/** The null check operator. */ |
|
166 |
public final OperatorSymbol nullcheck; |
|
167 |
||
168 |
/** The symbol representing the final finalize method on enums */ |
|
169 |
public final MethodSymbol enumFinalFinalize; |
|
170 |
||
6148
3a8158299c51
6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents:
5857
diff
changeset
|
171 |
/** The symbol representing the close method on TWR AutoCloseable type */ |
3a8158299c51
6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents:
5857
diff
changeset
|
172 |
public final MethodSymbol autoCloseableClose; |
3a8158299c51
6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents:
5857
diff
changeset
|
173 |
|
10 | 174 |
/** The predefined type that belongs to a tag. |
175 |
*/ |
|
176 |
public final Type[] typeOfTag = new Type[TypeTags.TypeTagCount]; |
|
177 |
||
178 |
/** The name of the class that belongs to a basix type tag. |
|
179 |
*/ |
|
180 |
public final Name[] boxedName = new Name[TypeTags.TypeTagCount]; |
|
181 |
||
182 |
/** A hashtable containing the encountered top-level and member classes, |
|
183 |
* indexed by flat names. The table does not contain local classes. |
|
184 |
* It should be updated from the outside to reflect classes defined |
|
185 |
* by compiled source files. |
|
186 |
*/ |
|
187 |
public final Map<Name, ClassSymbol> classes = new HashMap<Name, ClassSymbol>(); |
|
188 |
||
189 |
/** A hashtable containing the encountered packages. |
|
190 |
* the table should be updated from outside to reflect packages defined |
|
191 |
* by compiled source files. |
|
192 |
*/ |
|
193 |
public final Map<Name, PackageSymbol> packages = new HashMap<Name, PackageSymbol>(); |
|
194 |
||
195 |
public void initType(Type type, ClassSymbol c) { |
|
196 |
type.tsym = c; |
|
197 |
typeOfTag[type.tag] = type; |
|
198 |
} |
|
199 |
||
200 |
public void initType(Type type, String name) { |
|
201 |
initType( |
|
202 |
type, |
|
203 |
new ClassSymbol( |
|
204 |
PUBLIC, names.fromString(name), type, rootPackage)); |
|
205 |
} |
|
206 |
||
207 |
public void initType(Type type, String name, String bname) { |
|
208 |
initType(type, name); |
|
3555
a6fd77fe81df
6390045: Unexpected error "cannot access java.lang.Void" with '-target cldc1.0' with -source >=1.5
mcimadamore
parents:
2723
diff
changeset
|
209 |
boxedName[type.tag] = names.fromString("java.lang." + bname); |
10 | 210 |
} |
211 |
||
212 |
/** The class symbol that owns all predefined symbols. |
|
213 |
*/ |
|
214 |
public final ClassSymbol predefClass; |
|
215 |
||
216 |
/** Enter a constant into symbol table. |
|
217 |
* @param name The constant's name. |
|
218 |
* @param type The constant's type. |
|
219 |
*/ |
|
220 |
private VarSymbol enterConstant(String name, Type type) { |
|
221 |
VarSymbol c = new VarSymbol( |
|
222 |
PUBLIC | STATIC | FINAL, |
|
223 |
names.fromString(name), |
|
224 |
type, |
|
225 |
predefClass); |
|
226 |
c.setData(type.constValue()); |
|
227 |
predefClass.members().enter(c); |
|
228 |
return c; |
|
229 |
} |
|
230 |
||
231 |
/** Enter a binary operation into symbol table. |
|
232 |
* @param name The name of the operator. |
|
233 |
* @param left The type of the left operand. |
|
234 |
* @param right The type of the left operand. |
|
235 |
* @param res The operation's result type. |
|
236 |
* @param opcode The operation's bytecode instruction. |
|
237 |
*/ |
|
238 |
private void enterBinop(String name, |
|
239 |
Type left, Type right, Type res, |
|
240 |
int opcode) { |
|
241 |
predefClass.members().enter( |
|
242 |
new OperatorSymbol( |
|
243 |
names.fromString(name), |
|
244 |
new MethodType(List.of(left, right), res, |
|
245 |
List.<Type>nil(), methodClass), |
|
246 |
opcode, |
|
247 |
predefClass)); |
|
248 |
} |
|
249 |
||
250 |
/** Enter a binary operation, as above but with two opcodes, |
|
251 |
* which get encoded as (opcode1 << ByteCodeTags.preShift) + opcode2. |
|
252 |
* @param opcode1 First opcode. |
|
253 |
* @param opcode2 Second opcode. |
|
254 |
*/ |
|
255 |
private void enterBinop(String name, |
|
256 |
Type left, Type right, Type res, |
|
257 |
int opcode1, int opcode2) { |
|
258 |
enterBinop( |
|
259 |
name, left, right, res, (opcode1 << ByteCodes.preShift) | opcode2); |
|
260 |
} |
|
261 |
||
262 |
/** Enter a unary operation into symbol table. |
|
263 |
* @param name The name of the operator. |
|
264 |
* @param arg The type of the operand. |
|
265 |
* @param res The operation's result type. |
|
266 |
* @param opcode The operation's bytecode instruction. |
|
267 |
*/ |
|
268 |
private OperatorSymbol enterUnop(String name, |
|
269 |
Type arg, |
|
270 |
Type res, |
|
271 |
int opcode) { |
|
272 |
OperatorSymbol sym = |
|
273 |
new OperatorSymbol(names.fromString(name), |
|
274 |
new MethodType(List.of(arg), |
|
275 |
res, |
|
276 |
List.<Type>nil(), |
|
277 |
methodClass), |
|
278 |
opcode, |
|
279 |
predefClass); |
|
280 |
predefClass.members().enter(sym); |
|
281 |
return sym; |
|
282 |
} |
|
283 |
||
284 |
/** Enter a class into symbol table. |
|
285 |
* @param The name of the class. |
|
286 |
*/ |
|
287 |
private Type enterClass(String s) { |
|
288 |
return reader.enterClass(names.fromString(s)).type; |
|
289 |
} |
|
290 |
||
1037
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
291 |
public void synthesizeEmptyInterfaceIfMissing(final Type type) { |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
292 |
final Completer completer = type.tsym.completer; |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
293 |
if (completer != null) { |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
294 |
type.tsym.completer = new Completer() { |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
295 |
public void complete(Symbol sym) throws CompletionFailure { |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
296 |
try { |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
297 |
completer.complete(sym); |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
298 |
} catch (CompletionFailure e) { |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
299 |
sym.flags_field |= (PUBLIC | INTERFACE); |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
300 |
((ClassType) sym.type).supertype_field = objectType; |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
301 |
} |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
302 |
} |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
303 |
}; |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
304 |
} |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
305 |
} |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
306 |
|
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
307 |
public void synthesizeBoxTypeIfMissing(final Type type) { |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
308 |
ClassSymbol sym = reader.enterClass(boxedName[type.tag]); |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
309 |
final Completer completer = sym.completer; |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
310 |
if (completer != null) { |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
311 |
sym.completer = new Completer() { |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
312 |
public void complete(Symbol sym) throws CompletionFailure { |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
313 |
try { |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
314 |
completer.complete(sym); |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
315 |
} catch (CompletionFailure e) { |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
316 |
sym.flags_field |= PUBLIC; |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
317 |
((ClassType) sym.type).supertype_field = objectType; |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
318 |
Name n = target.boxWithConstructors() ? names.init : names.valueOf; |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
319 |
MethodSymbol boxMethod = |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
320 |
new MethodSymbol(PUBLIC | STATIC, |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
321 |
n, |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
322 |
new MethodType(List.of(type), sym.type, |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
323 |
List.<Type>nil(), methodClass), |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
324 |
sym); |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
325 |
sym.members().enter(boxMethod); |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
326 |
MethodSymbol unboxMethod = |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
327 |
new MethodSymbol(PUBLIC, |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
328 |
type.tsym.name.append(names.Value), // x.intValue() |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
329 |
new MethodType(List.<Type>nil(), type, |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
330 |
List.<Type>nil(), methodClass), |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
331 |
sym); |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
332 |
sym.members().enter(unboxMethod); |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
333 |
} |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
334 |
} |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
335 |
}; |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
336 |
} |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
337 |
|
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
338 |
} |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
339 |
|
10 | 340 |
/** Constructor; enters all predefined identifiers and operators |
341 |
* into symbol table. |
|
342 |
*/ |
|
343 |
protected Symtab(Context context) throws CompletionFailure { |
|
344 |
context.put(symtabKey, this); |
|
345 |
||
1260
a772ba9ba43d
6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
1257
diff
changeset
|
346 |
names = Names.instance(context); |
1037
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
347 |
target = Target.instance(context); |
10 | 348 |
|
349 |
// Create the unknown type |
|
8621
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
350 |
unknownType = new Type(TypeTags.UNKNOWN, null) { |
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
351 |
@Override |
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
352 |
public <R, P> R accept(TypeVisitor<R, P> v, P p) { |
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
353 |
return v.visitUnknown(this, p); |
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
354 |
} |
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
355 |
}; |
10 | 356 |
|
357 |
// create the basic builtin symbols |
|
358 |
rootPackage = new PackageSymbol(names.empty, null); |
|
1471
57506cdfb7b4
6406133: JCDiagnostic.getMessage ignores locale argument
mcimadamore
parents:
1264
diff
changeset
|
359 |
final JavacMessages messages = JavacMessages.instance(context); |
10 | 360 |
unnamedPackage = new PackageSymbol(names.empty, rootPackage) { |
361 |
public String toString() { |
|
362 |
return messages.getLocalizedString("compiler.misc.unnamed.package"); |
|
363 |
} |
|
364 |
}; |
|
8621
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
365 |
noSymbol = new TypeSymbol(0, names.empty, Type.noType, rootPackage) { |
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
366 |
public <R, P> R accept(ElementVisitor<R, P> v, P p) { |
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
367 |
return v.visitUnknown(this, p); |
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
368 |
} |
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
369 |
}; |
10 | 370 |
noSymbol.kind = Kinds.NIL; |
371 |
||
372 |
// create the error symbols |
|
373 |
errSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.any, null, rootPackage); |
|
8621
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
374 |
errType = new ErrorType(errSymbol, Type.noType); |
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
375 |
|
6594
d43f068fba19
6970584: Flow.java should be more error-friendly
mcimadamore
parents:
6148
diff
changeset
|
376 |
unknownSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.fromString("<any?>"), null, rootPackage); |
8621
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
377 |
unknownSymbol.members_field = new Scope.ErrorScope(unknownSymbol); |
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
378 |
unknownSymbol.type = unknownType; |
10 | 379 |
|
380 |
// initialize builtin types |
|
381 |
initType(byteType, "byte", "Byte"); |
|
382 |
initType(shortType, "short", "Short"); |
|
383 |
initType(charType, "char", "Character"); |
|
384 |
initType(intType, "int", "Integer"); |
|
385 |
initType(longType, "long", "Long"); |
|
386 |
initType(floatType, "float", "Float"); |
|
387 |
initType(doubleType, "double", "Double"); |
|
388 |
initType(booleanType, "boolean", "Boolean"); |
|
389 |
initType(voidType, "void", "Void"); |
|
390 |
initType(botType, "<nulltype>"); |
|
391 |
initType(errType, errSymbol); |
|
6594
d43f068fba19
6970584: Flow.java should be more error-friendly
mcimadamore
parents:
6148
diff
changeset
|
392 |
initType(unknownType, unknownSymbol); |
10 | 393 |
|
394 |
// the builtin class of all arrays |
|
395 |
arrayClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Array, noSymbol); |
|
396 |
||
397 |
// VGJ |
|
398 |
boundClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Bound, noSymbol); |
|
8621
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
399 |
boundClass.members_field = new Scope.ErrorScope(boundClass); |
10 | 400 |
|
401 |
// the builtin class of all methods |
|
402 |
methodClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Method, noSymbol); |
|
8621
ce0bce60cffc
7021183: 269: assertion failure getting enclosing element of an undefined name
jjg
parents:
8242
diff
changeset
|
403 |
methodClass.members_field = new Scope.ErrorScope(boundClass); |
10 | 404 |
|
405 |
// Create class to hold all predefined constants and operations. |
|
406 |
predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage); |
|
8242
3873b4aaf4a8
7007615: java_util/generics/phase2/NameClashTest02 fails since jdk7/pit/b123.
mcimadamore
parents:
8241
diff
changeset
|
407 |
Scope scope = new Scope(predefClass); |
10 | 408 |
predefClass.members_field = scope; |
409 |
||
410 |
// Enter symbols for basic types. |
|
411 |
scope.enter(byteType.tsym); |
|
412 |
scope.enter(shortType.tsym); |
|
413 |
scope.enter(charType.tsym); |
|
414 |
scope.enter(intType.tsym); |
|
415 |
scope.enter(longType.tsym); |
|
416 |
scope.enter(floatType.tsym); |
|
417 |
scope.enter(doubleType.tsym); |
|
418 |
scope.enter(booleanType.tsym); |
|
419 |
scope.enter(errType.tsym); |
|
420 |
||
1257
873b053bf757
6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents:
1037
diff
changeset
|
421 |
// Enter symbol for the errSymbol |
873b053bf757
6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents:
1037
diff
changeset
|
422 |
scope.enter(errSymbol); |
873b053bf757
6557752: Original type of an AST should be made available even if it is replaced with an ErrorType
jjg
parents:
1037
diff
changeset
|
423 |
|
10 | 424 |
classes.put(predefClass.fullname, predefClass); |
425 |
||
426 |
reader = ClassReader.instance(context); |
|
427 |
reader.init(this); |
|
428 |
||
429 |
// Enter predefined classes. |
|
430 |
objectType = enterClass("java.lang.Object"); |
|
431 |
classType = enterClass("java.lang.Class"); |
|
432 |
stringType = enterClass("java.lang.String"); |
|
433 |
stringBufferType = enterClass("java.lang.StringBuffer"); |
|
434 |
stringBuilderType = enterClass("java.lang.StringBuilder"); |
|
435 |
cloneableType = enterClass("java.lang.Cloneable"); |
|
436 |
throwableType = enterClass("java.lang.Throwable"); |
|
437 |
serializableType = enterClass("java.io.Serializable"); |
|
8241
4161b56e0d20
7017414: before the move of JSR 292 to package java.lang.invoke, javac must recognize the new package
mcimadamore
parents:
8036
diff
changeset
|
438 |
transientMethodHandleType = enterClass("java.dyn.MethodHandle"); // transient - 292 |
4161b56e0d20
7017414: before the move of JSR 292 to package java.lang.invoke, javac must recognize the new package
mcimadamore
parents:
8036
diff
changeset
|
439 |
methodHandleType = enterClass("java.lang.invoke.MethodHandle"); |
4161b56e0d20
7017414: before the move of JSR 292 to package java.lang.invoke, javac must recognize the new package
mcimadamore
parents:
8036
diff
changeset
|
440 |
transientPolymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature"); // transient - 292 |
4161b56e0d20
7017414: before the move of JSR 292 to package java.lang.invoke, javac must recognize the new package
mcimadamore
parents:
8036
diff
changeset
|
441 |
polymorphicSignatureType = enterClass("java.lang.invoke.MethodHandle$PolymorphicSignature"); |
10 | 442 |
errorType = enterClass("java.lang.Error"); |
443 |
illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException"); |
|
444 |
exceptionType = enterClass("java.lang.Exception"); |
|
445 |
runtimeExceptionType = enterClass("java.lang.RuntimeException"); |
|
446 |
classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException"); |
|
447 |
noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError"); |
|
448 |
noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError"); |
|
449 |
assertionErrorType = enterClass("java.lang.AssertionError"); |
|
450 |
cloneNotSupportedExceptionType = enterClass("java.lang.CloneNotSupportedException"); |
|
451 |
annotationType = enterClass("java.lang.annotation.Annotation"); |
|
452 |
classLoaderType = enterClass("java.lang.ClassLoader"); |
|
453 |
enumSym = reader.enterClass(names.java_lang_Enum); |
|
454 |
enumFinalFinalize = |
|
455 |
new MethodSymbol(PROTECTED|FINAL|HYPOTHETICAL, |
|
456 |
names.finalize, |
|
457 |
new MethodType(List.<Type>nil(), voidType, |
|
458 |
List.<Type>nil(), methodClass), |
|
459 |
enumSym); |
|
460 |
listType = enterClass("java.util.List"); |
|
461 |
collectionsType = enterClass("java.util.Collections"); |
|
462 |
comparableType = enterClass("java.lang.Comparable"); |
|
463 |
arraysType = enterClass("java.util.Arrays"); |
|
1037
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
464 |
iterableType = target.hasIterable() |
10 | 465 |
? enterClass("java.lang.Iterable") |
466 |
: enterClass("java.util.Collection"); |
|
467 |
iteratorType = enterClass("java.util.Iterator"); |
|
468 |
annotationTargetType = enterClass("java.lang.annotation.Target"); |
|
469 |
overrideType = enterClass("java.lang.Override"); |
|
470 |
retentionType = enterClass("java.lang.annotation.Retention"); |
|
471 |
deprecatedType = enterClass("java.lang.Deprecated"); |
|
472 |
suppressWarningsType = enterClass("java.lang.SuppressWarnings"); |
|
473 |
inheritedType = enterClass("java.lang.annotation.Inherited"); |
|
1037
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
474 |
systemType = enterClass("java.lang.System"); |
6148
3a8158299c51
6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents:
5857
diff
changeset
|
475 |
autoCloseableType = enterClass("java.lang.AutoCloseable"); |
3a8158299c51
6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents:
5857
diff
changeset
|
476 |
autoCloseableClose = new MethodSymbol(PUBLIC, |
3a8158299c51
6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents:
5857
diff
changeset
|
477 |
names.close, |
3a8158299c51
6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents:
5857
diff
changeset
|
478 |
new MethodType(List.<Type>nil(), voidType, |
3a8158299c51
6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents:
5857
diff
changeset
|
479 |
List.of(exceptionType), methodClass), |
3a8158299c51
6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents:
5857
diff
changeset
|
480 |
autoCloseableType.tsym); |
7643
a067a0cda531
6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents:
6709
diff
changeset
|
481 |
trustMeType = enterClass("java.lang.SafeVarargs"); |
1037
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
482 |
|
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
483 |
synthesizeEmptyInterfaceIfMissing(cloneableType); |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
484 |
synthesizeEmptyInterfaceIfMissing(serializableType); |
8241
4161b56e0d20
7017414: before the move of JSR 292 to package java.lang.invoke, javac must recognize the new package
mcimadamore
parents:
8036
diff
changeset
|
485 |
synthesizeEmptyInterfaceIfMissing(transientPolymorphicSignatureType); // transient - 292 |
5736
ee0850472ca1
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
3555
diff
changeset
|
486 |
synthesizeEmptyInterfaceIfMissing(polymorphicSignatureType); |
1037
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
487 |
synthesizeBoxTypeIfMissing(doubleType); |
c6b315a34dc6
6627362: javac generates code that uses array.clone, which is not available on JavaCard
jjg
parents:
10
diff
changeset
|
488 |
synthesizeBoxTypeIfMissing(floatType); |
3555
a6fd77fe81df
6390045: Unexpected error "cannot access java.lang.Void" with '-target cldc1.0' with -source >=1.5
mcimadamore
parents:
2723
diff
changeset
|
489 |
synthesizeBoxTypeIfMissing(voidType); |
10 | 490 |
|
5848
c5a4ce47e780
6960407: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents:
5847
diff
changeset
|
491 |
// Enter a synthetic class that is used to mark internal |
10 | 492 |
// proprietary classes in ct.sym. This class does not have a |
493 |
// class file. |
|
494 |
ClassType proprietaryType = (ClassType)enterClass("sun.Proprietary+Annotation"); |
|
495 |
this.proprietaryType = proprietaryType; |
|
496 |
ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym; |
|
497 |
proprietarySymbol.completer = null; |
|
498 |
proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE; |
|
499 |
proprietarySymbol.erasure_field = proprietaryType; |
|
8242
3873b4aaf4a8
7007615: java_util/generics/phase2/NameClashTest02 fails since jdk7/pit/b123.
mcimadamore
parents:
8241
diff
changeset
|
500 |
proprietarySymbol.members_field = new Scope(proprietarySymbol); |
10 | 501 |
proprietaryType.typarams_field = List.nil(); |
502 |
proprietaryType.allparams_field = List.nil(); |
|
503 |
proprietaryType.supertype_field = annotationType; |
|
504 |
proprietaryType.interfaces_field = List.nil(); |
|
505 |
||
506 |
// Enter a class for arrays. |
|
507 |
// The class implements java.lang.Cloneable and java.io.Serializable. |
|
508 |
// It has a final length field and a clone method. |
|
509 |
ClassType arrayClassType = (ClassType)arrayClass.type; |
|
510 |
arrayClassType.supertype_field = objectType; |
|
511 |
arrayClassType.interfaces_field = List.of(cloneableType, serializableType); |
|
8242
3873b4aaf4a8
7007615: java_util/generics/phase2/NameClashTest02 fails since jdk7/pit/b123.
mcimadamore
parents:
8241
diff
changeset
|
512 |
arrayClass.members_field = new Scope(arrayClass); |
10 | 513 |
lengthVar = new VarSymbol( |
514 |
PUBLIC | FINAL, |
|
515 |
names.length, |
|
516 |
intType, |
|
517 |
arrayClass); |
|
518 |
arrayClass.members().enter(lengthVar); |
|
519 |
arrayCloneMethod = new MethodSymbol( |
|
520 |
PUBLIC, |
|
521 |
names.clone, |
|
522 |
new MethodType(List.<Type>nil(), objectType, |
|
523 |
List.<Type>nil(), methodClass), |
|
524 |
arrayClass); |
|
525 |
arrayClass.members().enter(arrayCloneMethod); |
|
526 |
||
527 |
// Enter operators. |
|
528 |
enterUnop("+", doubleType, doubleType, nop); |
|
529 |
enterUnop("+", floatType, floatType, nop); |
|
530 |
enterUnop("+", longType, longType, nop); |
|
531 |
enterUnop("+", intType, intType, nop); |
|
532 |
||
533 |
enterUnop("-", doubleType, doubleType, dneg); |
|
534 |
enterUnop("-", floatType, floatType, fneg); |
|
535 |
enterUnop("-", longType, longType, lneg); |
|
536 |
enterUnop("-", intType, intType, ineg); |
|
537 |
||
538 |
enterUnop("~", longType, longType, lxor); |
|
539 |
enterUnop("~", intType, intType, ixor); |
|
540 |
||
541 |
enterUnop("++", doubleType, doubleType, dadd); |
|
542 |
enterUnop("++", floatType, floatType, fadd); |
|
543 |
enterUnop("++", longType, longType, ladd); |
|
544 |
enterUnop("++", intType, intType, iadd); |
|
545 |
enterUnop("++", charType, charType, iadd); |
|
546 |
enterUnop("++", shortType, shortType, iadd); |
|
547 |
enterUnop("++", byteType, byteType, iadd); |
|
548 |
||
549 |
enterUnop("--", doubleType, doubleType, dsub); |
|
550 |
enterUnop("--", floatType, floatType, fsub); |
|
551 |
enterUnop("--", longType, longType, lsub); |
|
552 |
enterUnop("--", intType, intType, isub); |
|
553 |
enterUnop("--", charType, charType, isub); |
|
554 |
enterUnop("--", shortType, shortType, isub); |
|
555 |
enterUnop("--", byteType, byteType, isub); |
|
556 |
||
557 |
enterUnop("!", booleanType, booleanType, bool_not); |
|
558 |
nullcheck = enterUnop("<*nullchk*>", objectType, objectType, nullchk); |
|
559 |
||
560 |
// string concatenation |
|
561 |
enterBinop("+", stringType, objectType, stringType, string_add); |
|
562 |
enterBinop("+", objectType, stringType, stringType, string_add); |
|
563 |
enterBinop("+", stringType, stringType, stringType, string_add); |
|
564 |
enterBinop("+", stringType, intType, stringType, string_add); |
|
565 |
enterBinop("+", stringType, longType, stringType, string_add); |
|
566 |
enterBinop("+", stringType, floatType, stringType, string_add); |
|
567 |
enterBinop("+", stringType, doubleType, stringType, string_add); |
|
568 |
enterBinop("+", stringType, booleanType, stringType, string_add); |
|
569 |
enterBinop("+", stringType, botType, stringType, string_add); |
|
570 |
enterBinop("+", intType, stringType, stringType, string_add); |
|
571 |
enterBinop("+", longType, stringType, stringType, string_add); |
|
572 |
enterBinop("+", floatType, stringType, stringType, string_add); |
|
573 |
enterBinop("+", doubleType, stringType, stringType, string_add); |
|
574 |
enterBinop("+", booleanType, stringType, stringType, string_add); |
|
575 |
enterBinop("+", botType, stringType, stringType, string_add); |
|
576 |
||
577 |
// these errors would otherwise be matched as string concatenation |
|
578 |
enterBinop("+", botType, botType, botType, error); |
|
579 |
enterBinop("+", botType, intType, botType, error); |
|
580 |
enterBinop("+", botType, longType, botType, error); |
|
581 |
enterBinop("+", botType, floatType, botType, error); |
|
582 |
enterBinop("+", botType, doubleType, botType, error); |
|
583 |
enterBinop("+", botType, booleanType, botType, error); |
|
584 |
enterBinop("+", botType, objectType, botType, error); |
|
585 |
enterBinop("+", intType, botType, botType, error); |
|
586 |
enterBinop("+", longType, botType, botType, error); |
|
587 |
enterBinop("+", floatType, botType, botType, error); |
|
588 |
enterBinop("+", doubleType, botType, botType, error); |
|
589 |
enterBinop("+", booleanType, botType, botType, error); |
|
590 |
enterBinop("+", objectType, botType, botType, error); |
|
591 |
||
592 |
enterBinop("+", doubleType, doubleType, doubleType, dadd); |
|
593 |
enterBinop("+", floatType, floatType, floatType, fadd); |
|
594 |
enterBinop("+", longType, longType, longType, ladd); |
|
595 |
enterBinop("+", intType, intType, intType, iadd); |
|
596 |
||
597 |
enterBinop("-", doubleType, doubleType, doubleType, dsub); |
|
598 |
enterBinop("-", floatType, floatType, floatType, fsub); |
|
599 |
enterBinop("-", longType, longType, longType, lsub); |
|
600 |
enterBinop("-", intType, intType, intType, isub); |
|
601 |
||
602 |
enterBinop("*", doubleType, doubleType, doubleType, dmul); |
|
603 |
enterBinop("*", floatType, floatType, floatType, fmul); |
|
604 |
enterBinop("*", longType, longType, longType, lmul); |
|
605 |
enterBinop("*", intType, intType, intType, imul); |
|
606 |
||
607 |
enterBinop("/", doubleType, doubleType, doubleType, ddiv); |
|
608 |
enterBinop("/", floatType, floatType, floatType, fdiv); |
|
609 |
enterBinop("/", longType, longType, longType, ldiv); |
|
610 |
enterBinop("/", intType, intType, intType, idiv); |
|
611 |
||
612 |
enterBinop("%", doubleType, doubleType, doubleType, dmod); |
|
613 |
enterBinop("%", floatType, floatType, floatType, fmod); |
|
614 |
enterBinop("%", longType, longType, longType, lmod); |
|
615 |
enterBinop("%", intType, intType, intType, imod); |
|
616 |
||
617 |
enterBinop("&", booleanType, booleanType, booleanType, iand); |
|
618 |
enterBinop("&", longType, longType, longType, land); |
|
619 |
enterBinop("&", intType, intType, intType, iand); |
|
620 |
||
621 |
enterBinop("|", booleanType, booleanType, booleanType, ior); |
|
622 |
enterBinop("|", longType, longType, longType, lor); |
|
623 |
enterBinop("|", intType, intType, intType, ior); |
|
624 |
||
625 |
enterBinop("^", booleanType, booleanType, booleanType, ixor); |
|
626 |
enterBinop("^", longType, longType, longType, lxor); |
|
627 |
enterBinop("^", intType, intType, intType, ixor); |
|
628 |
||
629 |
enterBinop("<<", longType, longType, longType, lshll); |
|
630 |
enterBinop("<<", intType, longType, intType, ishll); |
|
631 |
enterBinop("<<", longType, intType, longType, lshl); |
|
632 |
enterBinop("<<", intType, intType, intType, ishl); |
|
633 |
||
634 |
enterBinop(">>", longType, longType, longType, lshrl); |
|
635 |
enterBinop(">>", intType, longType, intType, ishrl); |
|
636 |
enterBinop(">>", longType, intType, longType, lshr); |
|
637 |
enterBinop(">>", intType, intType, intType, ishr); |
|
638 |
||
639 |
enterBinop(">>>", longType, longType, longType, lushrl); |
|
640 |
enterBinop(">>>", intType, longType, intType, iushrl); |
|
641 |
enterBinop(">>>", longType, intType, longType, lushr); |
|
642 |
enterBinop(">>>", intType, intType, intType, iushr); |
|
643 |
||
644 |
enterBinop("<", doubleType, doubleType, booleanType, dcmpg, iflt); |
|
645 |
enterBinop("<", floatType, floatType, booleanType, fcmpg, iflt); |
|
646 |
enterBinop("<", longType, longType, booleanType, lcmp, iflt); |
|
647 |
enterBinop("<", intType, intType, booleanType, if_icmplt); |
|
648 |
||
649 |
enterBinop(">", doubleType, doubleType, booleanType, dcmpl, ifgt); |
|
650 |
enterBinop(">", floatType, floatType, booleanType, fcmpl, ifgt); |
|
651 |
enterBinop(">", longType, longType, booleanType, lcmp, ifgt); |
|
652 |
enterBinop(">", intType, intType, booleanType, if_icmpgt); |
|
653 |
||
654 |
enterBinop("<=", doubleType, doubleType, booleanType, dcmpg, ifle); |
|
655 |
enterBinop("<=", floatType, floatType, booleanType, fcmpg, ifle); |
|
656 |
enterBinop("<=", longType, longType, booleanType, lcmp, ifle); |
|
657 |
enterBinop("<=", intType, intType, booleanType, if_icmple); |
|
658 |
||
659 |
enterBinop(">=", doubleType, doubleType, booleanType, dcmpl, ifge); |
|
660 |
enterBinop(">=", floatType, floatType, booleanType, fcmpl, ifge); |
|
661 |
enterBinop(">=", longType, longType, booleanType, lcmp, ifge); |
|
662 |
enterBinop(">=", intType, intType, booleanType, if_icmpge); |
|
663 |
||
664 |
enterBinop("==", objectType, objectType, booleanType, if_acmpeq); |
|
665 |
enterBinop("==", booleanType, booleanType, booleanType, if_icmpeq); |
|
666 |
enterBinop("==", doubleType, doubleType, booleanType, dcmpl, ifeq); |
|
667 |
enterBinop("==", floatType, floatType, booleanType, fcmpl, ifeq); |
|
668 |
enterBinop("==", longType, longType, booleanType, lcmp, ifeq); |
|
669 |
enterBinop("==", intType, intType, booleanType, if_icmpeq); |
|
670 |
||
671 |
enterBinop("!=", objectType, objectType, booleanType, if_acmpne); |
|
672 |
enterBinop("!=", booleanType, booleanType, booleanType, if_icmpne); |
|
673 |
enterBinop("!=", doubleType, doubleType, booleanType, dcmpl, ifne); |
|
674 |
enterBinop("!=", floatType, floatType, booleanType, fcmpl, ifne); |
|
675 |
enterBinop("!=", longType, longType, booleanType, lcmp, ifne); |
|
676 |
enterBinop("!=", intType, intType, booleanType, if_icmpne); |
|
677 |
||
678 |
enterBinop("&&", booleanType, booleanType, booleanType, bool_and); |
|
679 |
enterBinop("||", booleanType, booleanType, booleanType, bool_or); |
|
680 |
} |
|
681 |
} |