1
2
3
4 package joeq.Compiler.Quad;
5
6 import joeq.Class.PrimordialClassLoader;
7 import joeq.Class.jq_Array;
8 import joeq.Class.jq_Class;
9 import joeq.Class.jq_InstanceField;
10 import joeq.Class.jq_Method;
11 import joeq.Class.jq_Primitive;
12 import joeq.Class.jq_Reference;
13 import joeq.Class.jq_StaticField;
14 import joeq.Class.jq_Type;
15 import joeq.Compiler.BytecodeAnalysis.BytecodeVisitor;
16 import joeq.Compiler.Quad.Operand.AConstOperand;
17 import joeq.Compiler.Quad.Operand.BasicBlockTableOperand;
18 import joeq.Compiler.Quad.Operand.ConditionOperand;
19 import joeq.Compiler.Quad.Operand.DConstOperand;
20 import joeq.Compiler.Quad.Operand.FConstOperand;
21 import joeq.Compiler.Quad.Operand.FieldOperand;
22 import joeq.Compiler.Quad.Operand.IConstOperand;
23 import joeq.Compiler.Quad.Operand.IntValueTableOperand;
24 import joeq.Compiler.Quad.Operand.LConstOperand;
25 import joeq.Compiler.Quad.Operand.MethodOperand;
26 import joeq.Compiler.Quad.Operand.PConstOperand;
27 import joeq.Compiler.Quad.Operand.ParamListOperand;
28 import joeq.Compiler.Quad.Operand.RegisterOperand;
29 import joeq.Compiler.Quad.Operand.TargetOperand;
30 import joeq.Compiler.Quad.Operand.TypeOperand;
31 import joeq.Compiler.Quad.RegisterFactory.Register;
32 import joeq.Interpreter.QuadInterpreter;
33 import joeq.Interpreter.QuadInterpreter.UninitializedReference;
34 import joeq.Main.jq;
35 import joeq.Memory.Address;
36 import joeq.Memory.HeapAddress;
37 import joeq.Runtime.Reflection;
38 import joeq.Runtime.TypeCheck;
39 import joeq.Util.Templates.UnmodifiableList;
40 import jwutil.util.Assert;
41
42 /***
43 * @author John Whaley <jwhaley@alum.mit.edu>
44 * @version $Id: Operator.java 2465 2006-06-07 23:03:17Z joewhaley $
45 */
46 public abstract class Operator {
47
48 public void accept(Quad q, QuadVisitor qv) {
49 qv.visitQuad(q);
50 }
51 public UnmodifiableList.jq_Class getThrownExceptions() {
52 return noexceptions;
53 }
54 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) {
55 return noregisters;
56 }
57 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) {
58 return noregisters;
59 }
60
61 public abstract boolean hasSideEffects();
62
63 public abstract void interpret(Quad q, QuadInterpreter s);
64
65 static int getIntOpValue(Operand op, QuadInterpreter s) {
66 if (op instanceof RegisterOperand)
67 return ((Number)s.getReg(((RegisterOperand)op).getRegister())).intValue();
68 else
69 return ((IConstOperand)op).getValue();
70 }
71
72 static float getFloatOpValue(Operand op, QuadInterpreter s) {
73 if (op instanceof RegisterOperand)
74 return ((Float)s.getReg(((RegisterOperand)op).getRegister())).floatValue();
75 else
76 return ((FConstOperand)op).getValue();
77 }
78
79 static long getLongOpValue(Operand op, QuadInterpreter s) {
80 if (op instanceof RegisterOperand)
81 return ((Long)s.getReg(((RegisterOperand)op).getRegister())).longValue();
82 else
83 return ((LConstOperand)op).getValue();
84 }
85
86 static double getDoubleOpValue(Operand op, QuadInterpreter s) {
87 if (op instanceof RegisterOperand)
88 return ((Double)s.getReg(((RegisterOperand)op).getRegister())).doubleValue();
89 else
90 return ((DConstOperand)op).getValue();
91 }
92
93 static Object getObjectOpValue(Operand op, QuadInterpreter s) {
94 if (op instanceof RegisterOperand)
95 return s.getReg(((RegisterOperand)op).getRegister());
96 else
97 return ((AConstOperand)op).getValue();
98 }
99
100 static Address getAddressOpValue(Operand op, QuadInterpreter s) {
101 if (op instanceof RegisterOperand)
102 return (Address)s.getReg(((RegisterOperand)op).getRegister());
103 else
104 return ((PConstOperand)op).getValue();
105
106 }
107
108 static Object getWrappedOpValue(Operand op, QuadInterpreter s) {
109 if (op instanceof RegisterOperand)
110 return s.getReg(((RegisterOperand)op).getRegister());
111 else if (op instanceof AConstOperand)
112 return ((AConstOperand)op).getValue();
113 else if (op instanceof PConstOperand)
114 Assert.TODO();
115 else if (op instanceof IConstOperand)
116 return new Integer(((IConstOperand)op).getValue());
117 else if (op instanceof FConstOperand)
118 return new Float(((FConstOperand)op).getValue());
119 else if (op instanceof LConstOperand)
120 return new Long(((LConstOperand)op).getValue());
121 else if (op instanceof DConstOperand)
122 return new Double(((DConstOperand)op).getValue());
123 Assert.UNREACHABLE();
124 return null;
125 }
126
127 public static UnmodifiableList.RegisterOperand getReg1(Quad q) {
128 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1());
129 }
130 public static UnmodifiableList.RegisterOperand getReg1_check(Quad q) {
131 if (q.getOp1() instanceof RegisterOperand)
132 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1());
133 else
134 return noregisters;
135 }
136 public static UnmodifiableList.RegisterOperand getReg2(Quad q) {
137 if (q.getOp2() instanceof RegisterOperand)
138 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp2());
139 else
140 return noregisters;
141 }
142 public static UnmodifiableList.RegisterOperand getReg3(Quad q) {
143 if (q.getOp3() instanceof RegisterOperand)
144 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp3());
145 else
146 return noregisters;
147 }
148 protected static UnmodifiableList.RegisterOperand getReg12(Quad q) {
149 if (q.getOp1() instanceof RegisterOperand) {
150 if (q.getOp2() instanceof RegisterOperand)
151 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp2());
152 else
153 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1());
154 } else {
155 if (q.getOp2() instanceof RegisterOperand)
156 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp2());
157 else
158 return noregisters;
159 }
160 }
161 protected static UnmodifiableList.RegisterOperand getReg23(Quad q) {
162 if (q.getOp2() instanceof RegisterOperand) {
163 if (q.getOp3() instanceof RegisterOperand)
164 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp2(), (RegisterOperand)q.getOp3());
165 else
166 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp2());
167 } else {
168 if (q.getOp3() instanceof RegisterOperand)
169 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp3());
170 else
171 return noregisters;
172 }
173 }
174 protected static UnmodifiableList.RegisterOperand getReg24(Quad q) {
175 if (q.getOp2() instanceof RegisterOperand) {
176 if (q.getOp4() instanceof RegisterOperand)
177 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp2(), (RegisterOperand)q.getOp4());
178 else
179 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp2());
180 } else {
181 if (q.getOp4() instanceof RegisterOperand)
182 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp4());
183 else
184 return noregisters;
185 }
186 }
187 protected static UnmodifiableList.RegisterOperand getReg124(Quad q) {
188 if (q.getOp1() instanceof RegisterOperand) {
189 if (q.getOp2() instanceof RegisterOperand) {
190 if (q.getOp4() instanceof RegisterOperand)
191 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp2(), (RegisterOperand)q.getOp4());
192 else
193 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp2());
194 } else {
195 if (q.getOp4() instanceof RegisterOperand)
196 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp4());
197 else
198 return noregisters;
199 }
200 } else return getReg24(q);
201 }
202 protected static UnmodifiableList.RegisterOperand getReg123(Quad q) {
203 if (q.getOp1() instanceof RegisterOperand) {
204 if (q.getOp2() instanceof RegisterOperand) {
205 if (q.getOp3() instanceof RegisterOperand)
206 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp2(), (RegisterOperand)q.getOp3());
207 else
208 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp2());
209 } else {
210 if (q.getOp3() instanceof RegisterOperand)
211 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp3());
212 else
213 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1());
214 }
215 } else return getReg23(q);
216 }
217 protected static UnmodifiableList.RegisterOperand getReg234(Quad q) {
218 if (q.getOp2() instanceof RegisterOperand) {
219 if (q.getOp3() instanceof RegisterOperand) {
220 if (q.getOp4() instanceof RegisterOperand)
221 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp2(), (RegisterOperand)q.getOp3(), (RegisterOperand)q.getOp4());
222 else
223 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp2(), (RegisterOperand)q.getOp3());
224 } else {
225 if (q.getOp4() instanceof RegisterOperand)
226 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp2(), (RegisterOperand)q.getOp4());
227 else
228 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp2());
229 }
230 } else {
231 if (q.getOp3() instanceof RegisterOperand) {
232 if (q.getOp4() instanceof RegisterOperand)
233 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp3(), (RegisterOperand)q.getOp4());
234 else
235 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp3());
236 } else {
237 if (q.getOp4() instanceof RegisterOperand)
238 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp4());
239 else
240 return noregisters;
241 }
242 }
243 }
244 protected static UnmodifiableList.RegisterOperand getReg1234(Quad q) {
245 if (q.getOp1() instanceof RegisterOperand) {
246 if (q.getOp2() instanceof RegisterOperand) {
247 if (q.getOp3() instanceof RegisterOperand) {
248 if (q.getOp4() instanceof RegisterOperand)
249 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp2(), (RegisterOperand)q.getOp3(), (RegisterOperand)q.getOp4());
250 else
251 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp2(), (RegisterOperand)q.getOp3());
252 } else {
253 if (q.getOp4() instanceof RegisterOperand)
254 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp2(), (RegisterOperand)q.getOp4());
255 else
256 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp2());
257 }
258 } else {
259 if (q.getOp3() instanceof RegisterOperand) {
260 if (q.getOp4() instanceof RegisterOperand)
261 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp3(), (RegisterOperand)q.getOp4());
262 else
263 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp3());
264 } else {
265 if (q.getOp4() instanceof RegisterOperand)
266 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1(), (RegisterOperand)q.getOp4());
267 else
268 return new UnmodifiableList.RegisterOperand((RegisterOperand)q.getOp1());
269 }
270 }
271 } else return getReg234(q);
272 }
273
274 public static final UnmodifiableList.RegisterOperand noregisters;
275 public static final UnmodifiableList.jq_Class noexceptions;
276 public static final UnmodifiableList.jq_Class anyexception;
277 public static final UnmodifiableList.jq_Class resolutionexceptions;
278 public static final UnmodifiableList.jq_Class nullptrexception;
279 public static final UnmodifiableList.jq_Class arrayboundsexception;
280 public static final UnmodifiableList.jq_Class arithexception;
281 public static final UnmodifiableList.jq_Class arraystoreexception;
282 public static final UnmodifiableList.jq_Class negativesizeexception;
283 public static final UnmodifiableList.jq_Class classcastexceptions;
284 public static final UnmodifiableList.jq_Class illegalmonitorstateexception;
285 static {
286 noregisters = new UnmodifiableList.RegisterOperand( new RegisterOperand[0] );
287 noexceptions = new UnmodifiableList.jq_Class( new jq_Class[0] );
288 anyexception = new UnmodifiableList.jq_Class(
289 PrimordialClassLoader.getJavaLangThrowable()
290 );
291 resolutionexceptions = anyexception;
292 nullptrexception = new UnmodifiableList.jq_Class(
293 PrimordialClassLoader.getJavaLangNullPointerException()
294 );
295 arrayboundsexception = new UnmodifiableList.jq_Class(
296 PrimordialClassLoader.getJavaLangArrayIndexOutOfBoundsException()
297 );
298 arraystoreexception = new UnmodifiableList.jq_Class(
299 PrimordialClassLoader.getJavaLangArrayStoreException()
300 );
301 negativesizeexception = new UnmodifiableList.jq_Class(
302 PrimordialClassLoader.getJavaLangNegativeArraySizeException()
303 );
304 arithexception = new UnmodifiableList.jq_Class(
305 PrimordialClassLoader.getJavaLangArithmeticException()
306 );
307 classcastexceptions = new UnmodifiableList.jq_Class(
308 PrimordialClassLoader.getJavaLangThrowable()
309 );
310 illegalmonitorstateexception = new UnmodifiableList.jq_Class(
311 PrimordialClassLoader.getJavaLangIllegalMonitorStateException()
312 );
313 }
314
315 public abstract static class Move extends Operator {
316
317 public static Quad create(int id, Move operator, RegisterOperand dst, Operand src) {
318 return new Quad(id, operator, dst, src);
319 }
320 public static Quad create(int id, Register r1, Register r2, jq_Type t) {
321 Move mv = getMoveOp(t);
322 RegisterOperand o1 = new RegisterOperand(r1, t);
323 RegisterOperand o2 = new RegisterOperand(r2, t);
324 Quad s = create(id, mv, o1, o2);
325 return s;
326 }
327 public static Move getMoveOp(jq_Type type) {
328 if (type.isAddressType()) return MOVE_P.INSTANCE;
329 if (type.isReferenceType()) return MOVE_A.INSTANCE;
330 if (type.isIntLike()) return MOVE_I.INSTANCE;
331 if (type == jq_Primitive.FLOAT) return MOVE_F.INSTANCE;
332 if (type == jq_Primitive.LONG) return MOVE_L.INSTANCE;
333 if (type == jq_Primitive.DOUBLE) return MOVE_D.INSTANCE;
334 Assert.UNREACHABLE(); return null;
335 }
336 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
337 public static Operand getSrc(Quad q) { return q.getOp2(); }
338 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
339 public static void setSrc(Quad q, Operand o) { q.setOp2(o); }
340 public boolean hasSideEffects() { return false; }
341 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
342 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
343
344 public void accept(Quad q, QuadVisitor qv) {
345 qv.visitMove(q);
346 super.accept(q, qv);
347 }
348
349 public static class MOVE_I extends Move {
350 public static final MOVE_I INSTANCE = new MOVE_I();
351 private MOVE_I() { }
352 public String toString() { return "MOVE_I"; }
353 public void interpret(Quad q, QuadInterpreter s) {
354 s.putReg_I(getDest(q).getRegister(), getIntOpValue(getSrc(q), s));
355 }
356 }
357 public static class MOVE_F extends Move {
358 public static final MOVE_F INSTANCE = new MOVE_F();
359 private MOVE_F() { }
360 public String toString() { return "MOVE_F"; }
361 public void interpret(Quad q, QuadInterpreter s) {
362 s.putReg_F(getDest(q).getRegister(), getFloatOpValue(getSrc(q), s));
363 }
364 }
365 public static class MOVE_L extends Move {
366 public static final MOVE_L INSTANCE = new MOVE_L();
367 private MOVE_L() { }
368 public String toString() { return "MOVE_L"; }
369 public void interpret(Quad q, QuadInterpreter s) {
370 s.putReg_L(getDest(q).getRegister(), getLongOpValue(getSrc(q), s));
371 }
372 }
373 public static class MOVE_D extends Move {
374 public static final MOVE_D INSTANCE = new MOVE_D();
375 private MOVE_D() { }
376 public String toString() { return "MOVE_D"; }
377 public void interpret(Quad q, QuadInterpreter s) {
378 s.putReg_D(getDest(q).getRegister(), getDoubleOpValue(getSrc(q), s));
379 }
380 }
381 public static class MOVE_A extends Move {
382 public static final MOVE_A INSTANCE = new MOVE_A();
383 private MOVE_A() { }
384 public String toString() { return "MOVE_A"; }
385 public void interpret(Quad q, QuadInterpreter s) {
386 s.putReg_A(getDest(q).getRegister(), getObjectOpValue(getSrc(q), s));
387 }
388 }
389 public static class MOVE_P extends Move {
390 public static final MOVE_P INSTANCE = new MOVE_P();
391 private MOVE_P() { }
392 public String toString() { return "MOVE_P"; }
393 public void interpret(Quad q, QuadInterpreter s) {
394 s.putReg_P(getDest(q).getRegister(), getAddressOpValue(getSrc(q), s));
395 }
396 }
397 }
398
399 public abstract static class Phi extends Operator {
400 public static Quad create(int id, Phi operator, RegisterOperand res, int length) {
401 return new Quad(id, operator, res,
402 new ParamListOperand(new RegisterOperand[length]),
403 new BasicBlockTableOperand(new BasicBlock[length]));
404 }
405 public static void setSrc(Quad q, int i, RegisterOperand t) {
406 ((ParamListOperand)q.getOp2()).set(i, t);
407 }
408 public static void setPred(Quad q, int i, BasicBlock o) {
409 ((BasicBlockTableOperand)q.getOp3()).set(i, o);
410 }
411 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
412 public static RegisterOperand getSrc(Quad q, int i) { return ((ParamListOperand)q.getOp2()).get(i); }
413 public static ParamListOperand getSrcs(Quad q) { return (ParamListOperand)q.getOp2(); }
414 public static BasicBlock getPred(Quad q, int i) { return ((BasicBlockTableOperand)q.getOp3()).get(i); }
415 public static BasicBlockTableOperand getPreds(Quad q) { return (BasicBlockTableOperand)q.getOp3(); }
416 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
417 public static void setSrcs(Quad q, ParamListOperand o) { q.setOp2(o); }
418 public boolean hasSideEffects() { return false; }
419 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
420 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) {
421 ParamListOperand plo = getSrcs(q);
422 RegisterOperand[] a = new RegisterOperand[plo.length()];
423 for (int i=0; i<a.length; ++i) a[i] = plo.get(i);
424 return new UnmodifiableList.RegisterOperand(a);
425 }
426 public void accept(Quad q, QuadVisitor qv) {
427 qv.visitPhi(q);
428 super.accept(q, qv);
429 }
430 public static class PHI extends Phi {
431 public static final PHI INSTANCE = new PHI();
432 private PHI() { }
433 public String toString() { return "PHI"; }
434 public void interpret(Quad q, QuadInterpreter s) {
435 Assert.TODO();
436 }
437 }
438 }
439
440 public abstract static class Binary extends Operator {
441
442 public static Quad create(int id, Binary operator, RegisterOperand dst, Operand src1, Operand src2) {
443 return new Quad(id, operator, dst, src1, src2);
444 }
445 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
446 public static Operand getSrc1(Quad q) { return q.getOp2(); }
447 public static Operand getSrc2(Quad q) { return q.getOp3(); }
448 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
449 public static void setSrc1(Quad q, Operand o) { q.setOp2(o); }
450 public static void setSrc2(Quad q, Operand o) { q.setOp3(o); }
451 public boolean hasSideEffects() { return false; }
452 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
453 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg23(q); }
454
455 public void accept(Quad q, QuadVisitor qv) {
456 qv.visitBinary(q);
457 super.accept(q, qv);
458 }
459
460 public static class ADD_I extends Binary {
461 public static final ADD_I INSTANCE = new ADD_I();
462 private ADD_I() { }
463 public String toString() { return "ADD_I"; }
464 public void interpret(Quad q, QuadInterpreter s) {
465 int v = getIntOpValue(getSrc1(q), s) + getIntOpValue(getSrc2(q), s);
466 s.putReg_I(getDest(q).getRegister(), v);
467 }
468 }
469 public static class SUB_I extends Binary {
470 public static final SUB_I INSTANCE = new SUB_I();
471 private SUB_I() { }
472 public String toString() { return "SUB_I"; }
473 public void interpret(Quad q, QuadInterpreter s) {
474 int v = getIntOpValue(getSrc1(q), s) - getIntOpValue(getSrc2(q), s);
475 s.putReg_I(getDest(q).getRegister(), v);
476 }
477 }
478 public static class MUL_I extends Binary {
479 public static final MUL_I INSTANCE = new MUL_I();
480 private MUL_I() { }
481 public String toString() { return "MUL_I"; }
482 public void interpret(Quad q, QuadInterpreter s) {
483 int v = getIntOpValue(getSrc1(q), s) * getIntOpValue(getSrc2(q), s);
484 s.putReg_I(getDest(q).getRegister(), v);
485 }
486 }
487 public static class DIV_I extends Binary {
488 public static final DIV_I INSTANCE = new DIV_I();
489 private DIV_I() { }
490 public String toString() { return "DIV_I"; }
491 public void interpret(Quad q, QuadInterpreter s) {
492 int v = getIntOpValue(getSrc1(q), s) / getIntOpValue(getSrc2(q), s);
493 s.putReg_I(getDest(q).getRegister(), v);
494 }
495 }
496 public static class REM_I extends Binary {
497 public static final REM_I INSTANCE = new REM_I();
498 private REM_I() { }
499 public String toString() { return "REM_I"; }
500 public void interpret(Quad q, QuadInterpreter s) {
501 int v = getIntOpValue(getSrc1(q), s) % getIntOpValue(getSrc2(q), s);
502 s.putReg_I(getDest(q).getRegister(), v);
503 }
504 }
505 public static class AND_I extends Binary {
506 public static final AND_I INSTANCE = new AND_I();
507 private AND_I() { }
508 public String toString() { return "AND_I"; }
509 public void interpret(Quad q, QuadInterpreter s) {
510 int v = getIntOpValue(getSrc1(q), s) & getIntOpValue(getSrc2(q), s);
511 s.putReg_I(getDest(q).getRegister(), v);
512 }
513 }
514 public static class OR_I extends Binary {
515 public static final OR_I INSTANCE = new OR_I();
516 private OR_I() { }
517 public String toString() { return "OR_I"; }
518 public void interpret(Quad q, QuadInterpreter s) {
519 int v = getIntOpValue(getSrc1(q), s) | getIntOpValue(getSrc2(q), s);
520 s.putReg_I(getDest(q).getRegister(), v);
521 }
522 }
523 public static class XOR_I extends Binary {
524 public static final XOR_I INSTANCE = new XOR_I();
525 private XOR_I() { }
526 public String toString() { return "XOR_I"; }
527 public void interpret(Quad q, QuadInterpreter s) {
528 int v = getIntOpValue(getSrc1(q), s) ^ getIntOpValue(getSrc2(q), s);
529 s.putReg_I(getDest(q).getRegister(), v);
530 }
531 }
532 public static class SHL_I extends Binary {
533 public static final SHL_I INSTANCE = new SHL_I();
534 private SHL_I() { }
535 public String toString() { return "SHL_I"; }
536 public void interpret(Quad q, QuadInterpreter s) {
537 int v = getIntOpValue(getSrc1(q), s) << getIntOpValue(getSrc2(q), s);
538 s.putReg_I(getDest(q).getRegister(), v);
539 }
540 }
541 public static class SHR_I extends Binary {
542 public static final SHR_I INSTANCE = new SHR_I();
543 private SHR_I() { }
544 public String toString() { return "SHR_I"; }
545 public void interpret(Quad q, QuadInterpreter s) {
546 int v = getIntOpValue(getSrc1(q), s) >> getIntOpValue(getSrc2(q), s);
547 s.putReg_I(getDest(q).getRegister(), v);
548 }
549 }
550 public static class USHR_I extends Binary {
551 public static final USHR_I INSTANCE = new USHR_I();
552 private USHR_I() { }
553 public String toString() { return "USHR_I"; }
554 public void interpret(Quad q, QuadInterpreter s) {
555 int v = getIntOpValue(getSrc1(q), s) >>> getIntOpValue(getSrc2(q), s);
556 s.putReg_I(getDest(q).getRegister(), v);
557 }
558 }
559 public static class SHL_L extends Binary {
560 public static final SHL_L INSTANCE = new SHL_L();
561 private SHL_L() { }
562 public String toString() { return "SHL_L"; }
563 public void interpret(Quad q, QuadInterpreter s) {
564 long v = getLongOpValue(getSrc1(q), s) << getIntOpValue(getSrc2(q), s);
565 s.putReg_L(getDest(q).getRegister(), v);
566 }
567 }
568 public static class SHR_L extends Binary {
569 public static final SHR_L INSTANCE = new SHR_L();
570 private SHR_L() { }
571 public String toString() { return "SHR_L"; }
572 public void interpret(Quad q, QuadInterpreter s) {
573 long v = getLongOpValue(getSrc1(q), s) >> getIntOpValue(getSrc2(q), s);
574 s.putReg_L(getDest(q).getRegister(), v);
575 }
576 }
577 public static class USHR_L extends Binary {
578 public static final USHR_L INSTANCE = new USHR_L();
579 private USHR_L() { }
580 public String toString() { return "USHR_L"; }
581 public void interpret(Quad q, QuadInterpreter s) {
582 long v = getLongOpValue(getSrc1(q), s) >>> getIntOpValue(getSrc2(q), s);
583 s.putReg_L(getDest(q).getRegister(), v);
584 }
585 }
586 public static class ADD_L extends Binary {
587 public static final ADD_L INSTANCE = new ADD_L();
588 private ADD_L() { }
589 public String toString() { return "ADD_L"; }
590 public void interpret(Quad q, QuadInterpreter s) {
591 long v = getLongOpValue(getSrc1(q), s) + getLongOpValue(getSrc2(q), s);
592 s.putReg_L(getDest(q).getRegister(), v);
593 }
594 }
595 public static class SUB_L extends Binary {
596 public static final SUB_L INSTANCE = new SUB_L();
597 private SUB_L() { }
598 public String toString() { return "SUB_L"; }
599 public void interpret(Quad q, QuadInterpreter s) {
600 long v = getLongOpValue(getSrc1(q), s) - getLongOpValue(getSrc2(q), s);
601 s.putReg_L(getDest(q).getRegister(), v);
602 }
603 }
604 public static class MUL_L extends Binary {
605 public static final MUL_L INSTANCE = new MUL_L();
606 private MUL_L() { }
607 public String toString() { return "MUL_L"; }
608 public void interpret(Quad q, QuadInterpreter s) {
609 long v = getLongOpValue(getSrc1(q), s) * getLongOpValue(getSrc2(q), s);
610 s.putReg_L(getDest(q).getRegister(), v);
611 }
612 }
613 public static class DIV_L extends Binary {
614 public static final DIV_L INSTANCE = new DIV_L();
615 private DIV_L() { }
616 public String toString() { return "DIV_L"; }
617 public void interpret(Quad q, QuadInterpreter s) {
618 long v = getLongOpValue(getSrc1(q), s) / getLongOpValue(getSrc2(q), s);
619 s.putReg_L(getDest(q).getRegister(), v);
620 }
621 }
622 public static class REM_L extends Binary {
623 public static final REM_L INSTANCE = new REM_L();
624 private REM_L() { }
625 public String toString() { return "REM_L"; }
626 public void interpret(Quad q, QuadInterpreter s) {
627 long v = getLongOpValue(getSrc1(q), s) % getLongOpValue(getSrc2(q), s);
628 s.putReg_L(getDest(q).getRegister(), v);
629 }
630 }
631 public static class AND_L extends Binary {
632 public static final AND_L INSTANCE = new AND_L();
633 private AND_L() { }
634 public String toString() { return "AND_L"; }
635 public void interpret(Quad q, QuadInterpreter s) {
636 long v = getLongOpValue(getSrc1(q), s) & getLongOpValue(getSrc2(q), s);
637 s.putReg_L(getDest(q).getRegister(), v);
638 }
639 }
640 public static class OR_L extends Binary {
641 public static final OR_L INSTANCE = new OR_L();
642 private OR_L() { }
643 public String toString() { return "OR_L"; }
644 public void interpret(Quad q, QuadInterpreter s) {
645 long v = getLongOpValue(getSrc1(q), s) | getLongOpValue(getSrc2(q), s);
646 s.putReg_L(getDest(q).getRegister(), v);
647 }
648 }
649 public static class XOR_L extends Binary {
650 public static final XOR_L INSTANCE = new XOR_L();
651 private XOR_L() { }
652 public String toString() { return "XOR_L"; }
653 public void interpret(Quad q, QuadInterpreter s) {
654 long v = getLongOpValue(getSrc1(q), s) ^ getLongOpValue(getSrc2(q), s);
655 s.putReg_L(getDest(q).getRegister(), v);
656 }
657 }
658 public static class ADD_F extends Binary {
659 public static final ADD_F INSTANCE = new ADD_F();
660 private ADD_F() { }
661 public String toString() { return "ADD_F"; }
662 public void interpret(Quad q, QuadInterpreter s) {
663 float v = getFloatOpValue(getSrc1(q), s) + getFloatOpValue(getSrc2(q), s);
664 s.putReg_F(getDest(q).getRegister(), v);
665 }
666 }
667 public static class SUB_F extends Binary {
668 public static final SUB_F INSTANCE = new SUB_F();
669 private SUB_F() { }
670 public String toString() { return "SUB_F"; }
671 public void interpret(Quad q, QuadInterpreter s) {
672 float v = getFloatOpValue(getSrc1(q), s) - getFloatOpValue(getSrc2(q), s);
673 s.putReg_F(getDest(q).getRegister(), v);
674 }
675 }
676 public static class MUL_F extends Binary {
677 public static final MUL_F INSTANCE = new MUL_F();
678 private MUL_F() { }
679 public String toString() { return "MUL_F"; }
680 public void interpret(Quad q, QuadInterpreter s) {
681 float v = getFloatOpValue(getSrc1(q), s) * getFloatOpValue(getSrc2(q), s);
682 s.putReg_F(getDest(q).getRegister(), v);
683 }
684 }
685 public static class DIV_F extends Binary {
686 public static final DIV_F INSTANCE = new DIV_F();
687 private DIV_F() { }
688 public String toString() { return "DIV_F"; }
689 public void interpret(Quad q, QuadInterpreter s) {
690 float v = getFloatOpValue(getSrc1(q), s) / getFloatOpValue(getSrc2(q), s);
691 s.putReg_F(getDest(q).getRegister(), v);
692 }
693 }
694 public static class REM_F extends Binary {
695 public static final REM_F INSTANCE = new REM_F();
696 private REM_F() { }
697 public String toString() { return "REM_F"; }
698 public void interpret(Quad q, QuadInterpreter s) {
699 float v = getFloatOpValue(getSrc1(q), s) % getFloatOpValue(getSrc2(q), s);
700 s.putReg_F(getDest(q).getRegister(), v);
701 }
702 }
703 public static class ADD_D extends Binary {
704 public static final ADD_D INSTANCE = new ADD_D();
705 private ADD_D() { }
706 public String toString() { return "ADD_D"; }
707 public void interpret(Quad q, QuadInterpreter s) {
708 double v = getDoubleOpValue(getSrc1(q), s) + getDoubleOpValue(getSrc2(q), s);
709 s.putReg_D(getDest(q).getRegister(), v);
710 }
711 }
712 public static class SUB_D extends Binary {
713 public static final SUB_D INSTANCE = new SUB_D();
714 private SUB_D() { }
715 public String toString() { return "SUB_D"; }
716 public void interpret(Quad q, QuadInterpreter s) {
717 double v = getDoubleOpValue(getSrc1(q), s) - getDoubleOpValue(getSrc2(q), s);
718 s.putReg_D(getDest(q).getRegister(), v);
719 }
720 }
721 public static class MUL_D extends Binary {
722 public static final MUL_D INSTANCE = new MUL_D();
723 private MUL_D() { }
724 public String toString() { return "MUL_D"; }
725 public void interpret(Quad q, QuadInterpreter s) {
726 double v = getDoubleOpValue(getSrc1(q), s) * getDoubleOpValue(getSrc2(q), s);
727 s.putReg_D(getDest(q).getRegister(), v);
728 }
729 }
730 public static class DIV_D extends Binary {
731 public static final DIV_D INSTANCE = new DIV_D();
732 private DIV_D() { }
733 public String toString() { return "DIV_D"; }
734 public void interpret(Quad q, QuadInterpreter s) {
735 double v = getDoubleOpValue(getSrc1(q), s) / getDoubleOpValue(getSrc2(q), s);
736 s.putReg_D(getDest(q).getRegister(), v);
737 }
738 }
739 public static class REM_D extends Binary {
740 public static final REM_D INSTANCE = new REM_D();
741 private REM_D() { }
742 public String toString() { return "REM_D"; }
743 public void interpret(Quad q, QuadInterpreter s) {
744 double v = getDoubleOpValue(getSrc1(q), s) % getDoubleOpValue(getSrc2(q), s);
745 s.putReg_D(getDest(q).getRegister(), v);
746 }
747 }
748 public static class CMP_L extends Binary {
749 public static final CMP_L INSTANCE = new CMP_L();
750 private CMP_L() { }
751 public String toString() { return "CMP_L"; }
752 public void interpret(Quad q, QuadInterpreter s) {
753 long v1 = getLongOpValue(getSrc1(q), s);
754 long v2 = getLongOpValue(getSrc2(q), s);
755 s.putReg_I(getDest(q).getRegister(), (v1<v2)?-1:((v1==v2)?0:1));
756 }
757 }
758 public static class CMP_FL extends Binary {
759 public static final CMP_FL INSTANCE = new CMP_FL();
760 private CMP_FL() { }
761 public String toString() { return "CMP_FL"; }
762 public void interpret(Quad q, QuadInterpreter s) {
763 float v1 = getFloatOpValue(getSrc1(q), s);
764 float v2 = getFloatOpValue(getSrc2(q), s);
765 s.putReg_I(getDest(q).getRegister(), (v1<v2)?-1:((v1==v2)?0:1));
766 }
767 }
768 public static class CMP_FG extends Binary {
769 public static final CMP_FG INSTANCE = new CMP_FG();
770 private CMP_FG() { }
771 public String toString() { return "CMP_FG"; }
772 public void interpret(Quad q, QuadInterpreter s) {
773 float v1 = getFloatOpValue(getSrc1(q), s);
774 float v2 = getFloatOpValue(getSrc2(q), s);
775 s.putReg_I(getDest(q).getRegister(), (v1>v2)?1:((v1==v2)?0:-1));
776 }
777 }
778 public static class CMP_DL extends Binary {
779 public static final CMP_DL INSTANCE = new CMP_DL();
780 private CMP_DL() { }
781 public String toString() { return "CMP_DL"; }
782 public void interpret(Quad q, QuadInterpreter s) {
783 double v1 = getDoubleOpValue(getSrc1(q), s);
784 double v2 = getDoubleOpValue(getSrc2(q), s);
785 s.putReg_I(getDest(q).getRegister(), (v1<v2)?-1:((v1==v2)?0:1));
786 }
787 }
788 public static class CMP_DG extends Binary {
789 public static final CMP_DG INSTANCE = new CMP_DG();
790 private CMP_DG() { }
791 public String toString() { return "CMP_DG"; }
792 public void interpret(Quad q, QuadInterpreter s) {
793 double v1 = getDoubleOpValue(getSrc1(q), s);
794 double v2 = getDoubleOpValue(getSrc2(q), s);
795 s.putReg_I(getDest(q).getRegister(), (v1>v2)?1:((v1==v2)?0:-1));
796 }
797 }
798 public static class ADD_P extends Binary {
799 public static final ADD_P INSTANCE = new ADD_P();
800 private ADD_P() { }
801 public String toString() { return "ADD_P"; }
802 public void interpret(Quad q, QuadInterpreter s) {
803 Address v = getAddressOpValue(getSrc1(q), s).offset(getIntOpValue(getSrc2(q), s));
804 s.putReg_P(getDest(q).getRegister(), v);
805 }
806 }
807 public static class SUB_P extends Binary {
808 public static final SUB_P INSTANCE = new SUB_P();
809 private SUB_P() { }
810 public String toString() { return "SUB_P"; }
811 public void interpret(Quad q, QuadInterpreter s) {
812 Address v1 = getAddressOpValue(getSrc1(q), s);
813 Address v2 = getAddressOpValue(getSrc2(q), s);
814 s.putReg_I(getDest(q).getRegister(), v1.difference(v2));
815 }
816 }
817 public static class ALIGN_P extends Binary {
818 public static final ALIGN_P INSTANCE = new ALIGN_P();
819 private ALIGN_P() { }
820 public String toString() { return "ALIGN_P"; }
821 public void interpret(Quad q, QuadInterpreter s) {
822 Address v = getAddressOpValue(getSrc1(q), s).align(getIntOpValue(getSrc2(q), s));
823 s.putReg_P(getDest(q).getRegister(), v);
824 }
825 }
826 public static class CMP_P extends Binary {
827 public static final CMP_P INSTANCE = new CMP_P();
828 private CMP_P() { }
829 public String toString() { return "CMP_P"; }
830 public void interpret(Quad q, QuadInterpreter s) {
831 Address v1 = getAddressOpValue(getSrc1(q), s);
832 Address v2 = getAddressOpValue(getSrc2(q), s);
833 int d = v1.difference(v2);
834 s.putReg_I(getDest(q).getRegister(), (d<0)?-1:((d==0)?0:1));
835 }
836 }
837 }
838
839 public abstract static class Unary extends Operator {
840
841 public static Quad create(int id, Unary operator, RegisterOperand dst, Operand src1) {
842 return new Quad(id, operator, dst, src1);
843 }
844 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
845 public static Operand getSrc(Quad q) { return q.getOp2(); }
846 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
847 public static void setSrc(Quad q, Operand o) { q.setOp2(o); }
848 public boolean hasSideEffects() { return false; }
849 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
850 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
851
852 public void accept(Quad q, QuadVisitor qv) {
853 qv.visitUnary(q);
854 super.accept(q, qv);
855 }
856
857 public static class NEG_I extends Unary {
858 public static final NEG_I INSTANCE = new NEG_I();
859 private NEG_I() { }
860 public String toString() { return "NEG_I"; }
861 public void interpret(Quad q, QuadInterpreter s) {
862 s.putReg_I(getDest(q).getRegister(), -getIntOpValue(getSrc(q), s));
863 }
864 }
865 public static class NEG_F extends Unary {
866 public static final NEG_F INSTANCE = new NEG_F();
867 private NEG_F() { }
868 public String toString() { return "NEG_F"; }
869 public void interpret(Quad q, QuadInterpreter s) {
870 s.putReg_F(getDest(q).getRegister(), -getFloatOpValue(getSrc(q), s));
871 }
872 }
873 public static class NEG_L extends Unary {
874 public static final NEG_L INSTANCE = new NEG_L();
875 private NEG_L() { }
876 public String toString() { return "NEG_L"; }
877 public void interpret(Quad q, QuadInterpreter s) {
878 s.putReg_L(getDest(q).getRegister(), -getLongOpValue(getSrc(q), s));
879 }
880 }
881 public static class NEG_D extends Unary {
882 public static final NEG_D INSTANCE = new NEG_D();
883 private NEG_D() { }
884 public String toString() { return "NEG_D"; }
885 public void interpret(Quad q, QuadInterpreter s) {
886 s.putReg_D(getDest(q).getRegister(), -getDoubleOpValue(getSrc(q), s));
887 }
888 }
889 public static class INT_2LONG extends Unary {
890 public static final INT_2LONG INSTANCE = new INT_2LONG();
891 private INT_2LONG() { }
892 public String toString() { return "INT_2LONG"; }
893 public void interpret(Quad q, QuadInterpreter s) {
894 s.putReg_L(getDest(q).getRegister(), (long)getIntOpValue(getSrc(q), s));
895 }
896 }
897 public static class INT_2FLOAT extends Unary {
898 public static final INT_2FLOAT INSTANCE = new INT_2FLOAT();
899 private INT_2FLOAT() { }
900 public String toString() { return "INT_2FLOAT"; }
901 public void interpret(Quad q, QuadInterpreter s) {
902 s.putReg_F(getDest(q).getRegister(), (float)getIntOpValue(getSrc(q), s));
903 }
904 }
905 public static class INT_2DOUBLE extends Unary {
906 public static final INT_2DOUBLE INSTANCE = new INT_2DOUBLE();
907 private INT_2DOUBLE() { }
908 public String toString() { return "INT_2DOUBLE"; }
909 public void interpret(Quad q, QuadInterpreter s) {
910 s.putReg_D(getDest(q).getRegister(), (double)getIntOpValue(getSrc(q), s));
911 }
912 }
913 public static class LONG_2INT extends Unary {
914 public static final LONG_2INT INSTANCE = new LONG_2INT();
915 private LONG_2INT() { }
916 public String toString() { return "LONG_2INT"; }
917 public void interpret(Quad q, QuadInterpreter s) {
918 s.putReg_I(getDest(q).getRegister(), (int)getLongOpValue(getSrc(q), s));
919 }
920 }
921 public static class LONG_2FLOAT extends Unary {
922 public static final LONG_2FLOAT INSTANCE = new LONG_2FLOAT();
923 private LONG_2FLOAT() { }
924 public String toString() { return "LONG_2FLOAT"; }
925 public void interpret(Quad q, QuadInterpreter s) {
926 s.putReg_F(getDest(q).getRegister(), (float)getLongOpValue(getSrc(q), s));
927 }
928 }
929 public static class LONG_2DOUBLE extends Unary {
930 public static final LONG_2DOUBLE INSTANCE = new LONG_2DOUBLE();
931 private LONG_2DOUBLE() { }
932 public String toString() { return "LONG_2DOUBLE"; }
933 public void interpret(Quad q, QuadInterpreter s) {
934 s.putReg_D(getDest(q).getRegister(), (double)getLongOpValue(getSrc(q), s));
935 }
936 }
937 public static class FLOAT_2INT extends Unary {
938 public static final FLOAT_2INT INSTANCE = new FLOAT_2INT();
939 private FLOAT_2INT() { }
940 public String toString() { return "FLOAT_2INT"; }
941 public void interpret(Quad q, QuadInterpreter s) {
942 s.putReg_I(getDest(q).getRegister(), (int)getFloatOpValue(getSrc(q), s));
943 }
944 }
945 public static class FLOAT_2LONG extends Unary {
946 public static final FLOAT_2LONG INSTANCE = new FLOAT_2LONG();
947 private FLOAT_2LONG() { }
948 public String toString() { return "FLOAT_2LONG"; }
949 public void interpret(Quad q, QuadInterpreter s) {
950 s.putReg_L(getDest(q).getRegister(), (long)getFloatOpValue(getSrc(q), s));
951 }
952 }
953 public static class FLOAT_2DOUBLE extends Unary {
954 public static final FLOAT_2DOUBLE INSTANCE = new FLOAT_2DOUBLE();
955 private FLOAT_2DOUBLE() { }
956 public String toString() { return "FLOAT_2DOUBLE"; }
957 public void interpret(Quad q, QuadInterpreter s) {
958 s.putReg_D(getDest(q).getRegister(), (double)getFloatOpValue(getSrc(q), s));
959 }
960 }
961 public static class DOUBLE_2INT extends Unary {
962 public static final DOUBLE_2INT INSTANCE = new DOUBLE_2INT();
963 private DOUBLE_2INT() { }
964 public String toString() { return "DOUBLE_2INT"; }
965 public void interpret(Quad q, QuadInterpreter s) {
966 s.putReg_I(getDest(q).getRegister(), (int)getDoubleOpValue(getSrc(q), s));
967 }
968 }
969 public static class DOUBLE_2LONG extends Unary {
970 public static final DOUBLE_2LONG INSTANCE = new DOUBLE_2LONG();
971 private DOUBLE_2LONG() { }
972 public String toString() { return "DOUBLE_2LONG"; }
973 public void interpret(Quad q, QuadInterpreter s) {
974 s.putReg_L(getDest(q).getRegister(), (long)getDoubleOpValue(getSrc(q), s));
975 }
976 }
977 public static class DOUBLE_2FLOAT extends Unary {
978 public static final DOUBLE_2FLOAT INSTANCE = new DOUBLE_2FLOAT();
979 private DOUBLE_2FLOAT() { }
980 public String toString() { return "DOUBLE_2FLOAT"; }
981 public void interpret(Quad q, QuadInterpreter s) {
982 s.putReg_F(getDest(q).getRegister(), (float)getDoubleOpValue(getSrc(q), s));
983 }
984 }
985 public static class INT_2BYTE extends Unary {
986 public static final INT_2BYTE INSTANCE = new INT_2BYTE();
987 private INT_2BYTE() { }
988 public String toString() { return "INT_2BYTE"; }
989 public void interpret(Quad q, QuadInterpreter s) {
990 s.putReg_I(getDest(q).getRegister(), (byte)getIntOpValue(getSrc(q), s));
991 }
992 }
993 public static class INT_2CHAR extends Unary {
994 public static final INT_2CHAR INSTANCE = new INT_2CHAR();
995 private INT_2CHAR() { }
996 public String toString() { return "INT_2CHAR"; }
997 public void interpret(Quad q, QuadInterpreter s) {
998 s.putReg_I(getDest(q).getRegister(), (char)getIntOpValue(getSrc(q), s));
999 }
1000 }
1001 public static class INT_2SHORT extends Unary {
1002 public static final INT_2SHORT INSTANCE = new INT_2SHORT();
1003 private INT_2SHORT() { }
1004 public String toString() { return "INT_2SHORT"; }
1005 public void interpret(Quad q, QuadInterpreter s) {
1006 s.putReg_I(getDest(q).getRegister(), (short)getIntOpValue(getSrc(q), s));
1007 }
1008 }
1009 public static class OBJECT_2ADDRESS extends Unary {
1010 public static final OBJECT_2ADDRESS INSTANCE = new OBJECT_2ADDRESS();
1011 private OBJECT_2ADDRESS() { }
1012 public String toString() { return "OBJECT_2ADDRESS"; }
1013 public void interpret(Quad q, QuadInterpreter s) {
1014 Object o = getObjectOpValue(getSrc(q), s);
1015 Address a = HeapAddress.addressOf(o);
1016 s.putReg_P(getDest(q).getRegister(), a);
1017 }
1018 }
1019 public static class ADDRESS_2OBJECT extends Unary {
1020 public static final ADDRESS_2OBJECT INSTANCE = new ADDRESS_2OBJECT();
1021 private ADDRESS_2OBJECT() { }
1022 public String toString() { return "ADDRESS_2OBJECT"; }
1023 public void interpret(Quad q, QuadInterpreter s) {
1024 HeapAddress a = (HeapAddress) getAddressOpValue(getSrc(q), s);
1025 s.putReg_A(getDest(q).getRegister(), a.asObject());
1026 }
1027 }
1028 public static class INT_2ADDRESS extends Unary {
1029 public static final INT_2ADDRESS INSTANCE = new INT_2ADDRESS();
1030 private INT_2ADDRESS() { }
1031 public String toString() { return "INT_2ADDRESS"; }
1032 public void interpret(Quad q, QuadInterpreter s) {
1033 int v = getIntOpValue(getSrc(q), s);
1034 Address a = HeapAddress.address32(v);
1035 s.putReg_P(getDest(q).getRegister(), a);
1036 }
1037 }
1038 public static class ADDRESS_2INT extends Unary {
1039 public static final ADDRESS_2INT INSTANCE = new ADDRESS_2INT();
1040 private ADDRESS_2INT() { }
1041 public String toString() { return "ADDRESS_2INT"; }
1042 public void interpret(Quad q, QuadInterpreter s) {
1043 Address a = getAddressOpValue(getSrc(q), s);
1044 s.putReg_I(getDest(q).getRegister(), a.to32BitValue());
1045 }
1046 }
1047 public static class ISNULL_P extends Unary {
1048 public static final ISNULL_P INSTANCE = new ISNULL_P();
1049 private ISNULL_P() { }
1050 public String toString() { return "ISNULL_P"; }
1051 public void interpret(Quad q, QuadInterpreter s) {
1052 Address a = getAddressOpValue(getSrc(q), s);
1053 s.putReg_I(getDest(q).getRegister(), a.isNull()?1:0);
1054 }
1055 }
1056 public static class FLOAT_2INTBITS extends Unary {
1057 public static final FLOAT_2INTBITS INSTANCE = new FLOAT_2INTBITS();
1058 private FLOAT_2INTBITS() { }
1059 public String toString() { return "FLOAT_2INTBITS"; }
1060 public void interpret(Quad q, QuadInterpreter s) {
1061 s.putReg_I(getDest(q).getRegister(), Float.floatToRawIntBits(getFloatOpValue(getSrc(q), s)));
1062 }
1063 }
1064 public static class INTBITS_2FLOAT extends Unary {
1065 public static final INTBITS_2FLOAT INSTANCE = new INTBITS_2FLOAT();
1066 private INTBITS_2FLOAT() { }
1067 public String toString() { return "INTBITS_2FLOAT"; }
1068 public void interpret(Quad q, QuadInterpreter s) {
1069 s.putReg_F(getDest(q).getRegister(), Float.intBitsToFloat(getIntOpValue(getSrc(q), s)));
1070 }
1071 }
1072 public static class DOUBLE_2LONGBITS extends Unary {
1073 public static final DOUBLE_2LONGBITS INSTANCE = new DOUBLE_2LONGBITS();
1074 private DOUBLE_2LONGBITS() { }
1075 public String toString() { return "DOUBLE_2LONGBITS"; }
1076 public void interpret(Quad q, QuadInterpreter s) {
1077 s.putReg_L(getDest(q).getRegister(), Double.doubleToRawLongBits(getDoubleOpValue(getSrc(q), s)));
1078 }
1079 }
1080 public static class LONGBITS_2DOUBLE extends Unary {
1081 public static final LONGBITS_2DOUBLE INSTANCE = new LONGBITS_2DOUBLE();
1082 private LONGBITS_2DOUBLE() { }
1083 public String toString() { return "LONGBITS_2DOUBLE"; }
1084 public void interpret(Quad q, QuadInterpreter s) {
1085 s.putReg_D(getDest(q).getRegister(), Double.longBitsToDouble(getLongOpValue(getSrc(q), s)));
1086 }
1087 }
1088 }
1089
1090 public abstract static class ALoad extends Operator {
1091
1092 public static Quad create(int id, ALoad operator, RegisterOperand dst, Operand base, Operand ind, Operand guard) {
1093 return new Quad(id, operator, dst, base, ind, guard);
1094 }
1095 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
1096 public static Operand getBase(Quad q) { return q.getOp2(); }
1097 public static Operand getIndex(Quad q) { return q.getOp3(); }
1098 public static Operand getGuard(Quad q) { return q.getOp4(); }
1099 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
1100 public static void setBase(Quad q, Operand o) { q.setOp2(o); }
1101 public static void setIndex(Quad q, Operand o) { q.setOp3(o); }
1102 public static void setGuard(Quad q, Operand o) { q.setOp4(o); }
1103 public boolean hasSideEffects() { return false; }
1104 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
1105 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg234(q); }
1106
1107 public abstract jq_Type getType();
1108
1109 public void accept(Quad q, QuadVisitor qv) {
1110 qv.visitALoad(q);
1111 qv.visitArray(q);
1112 qv.visitLoad(q);
1113 super.accept(q, qv);
1114 }
1115
1116 public static class ALOAD_I extends ALoad {
1117 public static final ALOAD_I INSTANCE = new ALOAD_I();
1118 private ALOAD_I() { }
1119 public String toString() { return "ALOAD_I"; }
1120 public void interpret(Quad q, QuadInterpreter s) {
1121 int[] a = (int[])getObjectOpValue(getBase(q), s);
1122 int i = getIntOpValue(getIndex(q), s);
1123 s.putReg_I(getDest(q).getRegister(), a[i]);
1124 }
1125 public jq_Type getType() { return jq_Primitive.INT; }
1126 }
1127 public static class ALOAD_L extends ALoad {
1128 public static final ALOAD_L INSTANCE = new ALOAD_L();
1129 private ALOAD_L() { }
1130 public String toString() { return "ALOAD_L"; }
1131 public void interpret(Quad q, QuadInterpreter s) {
1132 long[] a = (long[])getObjectOpValue(getBase(q), s);
1133 int i = getIntOpValue(getIndex(q), s);
1134 s.putReg_L(getDest(q).getRegister(), a[i]);
1135 }
1136 public jq_Type getType() { return jq_Primitive.LONG; }
1137 }
1138 public static class ALOAD_F extends ALoad {
1139 public static final ALOAD_F INSTANCE = new ALOAD_F();
1140 private ALOAD_F() { }
1141 public String toString() { return "ALOAD_F"; }
1142 public void interpret(Quad q, QuadInterpreter s) {
1143 float[] a = (float[])getObjectOpValue(getBase(q), s);
1144 int i = getIntOpValue(getIndex(q), s);
1145 s.putReg_F(getDest(q).getRegister(), a[i]);
1146 }
1147 public jq_Type getType() { return jq_Primitive.FLOAT; }
1148 }
1149 public static class ALOAD_D extends ALoad {
1150 public static final ALOAD_D INSTANCE = new ALOAD_D();
1151 private ALOAD_D() { }
1152 public String toString() { return "ALOAD_D"; }
1153 public void interpret(Quad q, QuadInterpreter s) {
1154 double[] a = (double[])getObjectOpValue(getBase(q), s);
1155 int i = getIntOpValue(getIndex(q), s);
1156 s.putReg_D(getDest(q).getRegister(), a[i]);
1157 }
1158 public jq_Type getType() { return jq_Primitive.DOUBLE; }
1159 }
1160 public static class ALOAD_A extends ALoad {
1161 public static final ALOAD_A INSTANCE = new ALOAD_A();
1162 private ALOAD_A() { }
1163 public String toString() { return "ALOAD_A"; }
1164 public void interpret(Quad q, QuadInterpreter s) {
1165 Object[] a = (Object[])getObjectOpValue(getBase(q), s);
1166 int i = getIntOpValue(getIndex(q), s);
1167 s.putReg_A(getDest(q).getRegister(), a[i]);
1168 }
1169 public jq_Type getType() { return PrimordialClassLoader.getJavaLangObject(); }
1170 }
1171 public static class ALOAD_P extends ALoad {
1172 public static final ALOAD_P INSTANCE = new ALOAD_P();
1173 private ALOAD_P() { }
1174 public String toString() { return "ALOAD_P"; }
1175 public void interpret(Quad q, QuadInterpreter s) {
1176 Address[] a = (Address[])getObjectOpValue(getBase(q), s);
1177 int i = getIntOpValue(getIndex(q), s);
1178 s.putReg_P(getDest(q).getRegister(), a[i]);
1179 }
1180 public jq_Type getType() { return Address._class; }
1181 }
1182 public static class ALOAD_B extends ALoad {
1183 public static final ALOAD_B INSTANCE = new ALOAD_B();
1184 private ALOAD_B() { }
1185 public String toString() { return "ALOAD_B"; }
1186 public void interpret(Quad q, QuadInterpreter s) {
1187 Object a = getObjectOpValue(getBase(q), s);
1188 int i = getIntOpValue(getIndex(q), s);
1189 int v;
1190 if (a instanceof byte[]) v = ((byte[])a)[i];
1191 else v = ((boolean[])a)[i]?1:0;
1192 s.putReg_D(getDest(q).getRegister(), v);
1193 }
1194 public jq_Type getType() { return jq_Primitive.BYTE; }
1195 }
1196 public static class ALOAD_C extends ALoad {
1197 public static final ALOAD_C INSTANCE = new ALOAD_C();
1198 private ALOAD_C() { }
1199 public String toString() { return "ALOAD_C"; }
1200 public void interpret(Quad q, QuadInterpreter s) {
1201 char[] a = (char[])getObjectOpValue(getBase(q), s);
1202 int i = getIntOpValue(getIndex(q), s);
1203 s.putReg_I(getDest(q).getRegister(), a[i]);
1204 }
1205 public jq_Type getType() { return jq_Primitive.CHAR; }
1206 }
1207 public static class ALOAD_S extends ALoad {
1208 public static final ALOAD_S INSTANCE = new ALOAD_S();
1209 private ALOAD_S() { }
1210 public String toString() { return "ALOAD_S"; }
1211 public void interpret(Quad q, QuadInterpreter s) {
1212 short[] a = (short[])getObjectOpValue(getBase(q), s);
1213 int i = getIntOpValue(getIndex(q), s);
1214 s.putReg_I(getDest(q).getRegister(), a[i]);
1215 }
1216 public jq_Type getType() { return jq_Primitive.SHORT; }
1217 }
1218 }
1219
1220 public abstract static class AStore extends Operator {
1221
1222 public static Quad create(int id, AStore operator, Operand val, Operand base, Operand ind, Operand guard) {
1223 return new Quad(id, operator, val, base, ind, guard);
1224 }
1225 public static Operand getValue(Quad q) { return q.getOp1(); }
1226 public static Operand getBase(Quad q) { return q.getOp2(); }
1227 public static Operand getIndex(Quad q) { return q.getOp3(); }
1228 public static Operand getGuard(Quad q) { return q.getOp4(); }
1229 public static void setValue(Quad q, Operand o) { q.setOp1(o); }
1230 public static void setBase(Quad q, Operand o) { q.setOp2(o); }
1231 public static void setIndex(Quad q, Operand o) { q.setOp3(o); }
1232 public static void setGuard(Quad q, Operand o) { q.setOp4(o); }
1233 public boolean hasSideEffects() { return true; }
1234 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1234(q); }
1235
1236 public abstract jq_Type getType();
1237
1238 public void accept(Quad q, QuadVisitor qv) {
1239 qv.visitAStore(q);
1240 qv.visitArray(q);
1241 qv.visitStore(q);
1242 super.accept(q, qv);
1243 }
1244
1245 public static class ASTORE_I extends AStore {
1246 public static final ASTORE_I INSTANCE = new ASTORE_I();
1247 private ASTORE_I() { }
1248 public String toString() { return "ASTORE_I"; }
1249 public void interpret(Quad q, QuadInterpreter s) {
1250 int[] a = (int[])getObjectOpValue(getBase(q), s);
1251 int i = getIntOpValue(getIndex(q), s);
1252 int v = getIntOpValue(getValue(q), s);
1253 a[i] = v;
1254 }
1255 public jq_Type getType() { return jq_Primitive.INT; }
1256 }
1257 public static class ASTORE_L extends AStore {
1258 public static final ASTORE_L INSTANCE = new ASTORE_L();
1259 private ASTORE_L() { }
1260 public String toString() { return "ASTORE_L"; }
1261 public void interpret(Quad q, QuadInterpreter s) {
1262 long[] a = (long[])getObjectOpValue(getBase(q), s);
1263 int i = getIntOpValue(getIndex(q), s);
1264 long v = getLongOpValue(getValue(q), s);
1265 a[i] = v;
1266 }
1267 public jq_Type getType() { return jq_Primitive.LONG; }
1268 }
1269 public static class ASTORE_F extends AStore {
1270 public static final ASTORE_F INSTANCE = new ASTORE_F();
1271 private ASTORE_F() { }
1272 public String toString() { return "ASTORE_F"; }
1273 public void interpret(Quad q, QuadInterpreter s) {
1274 float[] a = (float[])getObjectOpValue(getBase(q), s);
1275 int i = getIntOpValue(getIndex(q), s);
1276 float v = getFloatOpValue(getValue(q), s);
1277 a[i] = v;
1278 }
1279 public jq_Type getType() { return jq_Primitive.FLOAT; }
1280 }
1281 public static class ASTORE_D extends AStore {
1282 public static final ASTORE_D INSTANCE = new ASTORE_D();
1283 private ASTORE_D() { }
1284 public String toString() { return "ASTORE_D"; }
1285 public void interpret(Quad q, QuadInterpreter s) {
1286 double[] a = (double[])getObjectOpValue(getBase(q), s);
1287 int i = getIntOpValue(getIndex(q), s);
1288 double v = getDoubleOpValue(getValue(q), s);
1289 a[i] = v;
1290 }
1291 public jq_Type getType() { return jq_Primitive.DOUBLE; }
1292 }
1293 public static class ASTORE_A extends AStore {
1294 public static final ASTORE_A INSTANCE = new ASTORE_A();
1295 private ASTORE_A() { }
1296 public String toString() { return "ASTORE_A"; }
1297 public void interpret(Quad q, QuadInterpreter s) {
1298 Object[] a = (Object[])getObjectOpValue(getBase(q), s);
1299 int i = getIntOpValue(getIndex(q), s);
1300 Object v = getObjectOpValue(getValue(q), s);
1301 a[i] = v;
1302 }
1303 public jq_Type getType() { return PrimordialClassLoader.getJavaLangObject(); }
1304 }
1305 public static class ASTORE_P extends AStore {
1306 public static final ASTORE_P INSTANCE = new ASTORE_P();
1307 private ASTORE_P() { }
1308 public String toString() { return "ASTORE_P"; }
1309 public void interpret(Quad q, QuadInterpreter s) {
1310 Address[] a = (Address[])getObjectOpValue(getBase(q), s);
1311 int i = getIntOpValue(getIndex(q), s);
1312 Address v = getAddressOpValue(getValue(q), s);
1313 a[i] = v;
1314 }
1315 public jq_Type getType() { return Address._class; }
1316 }
1317 public static class ASTORE_B extends AStore {
1318 public static final ASTORE_B INSTANCE = new ASTORE_B();
1319 private ASTORE_B() { }
1320 public String toString() { return "ASTORE_B"; }
1321 public void interpret(Quad q, QuadInterpreter s) {
1322 Object a = getObjectOpValue(getBase(q), s);
1323 int i = getIntOpValue(getIndex(q), s);
1324 if (a instanceof byte[]) ((byte[])a)[i] = (byte)getIntOpValue(getValue(q), s);
1325 else ((boolean[])a)[i] = getIntOpValue(getValue(q), s)!=0?true:false;
1326 }
1327 public jq_Type getType() { return jq_Primitive.BYTE; }
1328 }
1329 public static class ASTORE_C extends AStore {
1330 public static final ASTORE_C INSTANCE = new ASTORE_C();
1331 private ASTORE_C() { }
1332 public String toString() { return "ASTORE_C"; }
1333 public void interpret(Quad q, QuadInterpreter s) {
1334 char[] a = (char[])getObjectOpValue(getBase(q), s);
1335 int i = getIntOpValue(getIndex(q), s);
1336 char v = (char)getIntOpValue(getValue(q), s);
1337 a[i] = v;
1338 }
1339 public jq_Type getType() { return jq_Primitive.CHAR; }
1340 }
1341 public static class ASTORE_S extends AStore {
1342 public static final ASTORE_S INSTANCE = new ASTORE_S();
1343 private ASTORE_S() { }
1344 public String toString() { return "ASTORE_S"; }
1345 public void interpret(Quad q, QuadInterpreter s) {
1346 short[] a = (short[])getObjectOpValue(getBase(q), s);
1347 int i = getIntOpValue(getIndex(q), s);
1348 short v = (short)getIntOpValue(getValue(q), s);
1349 a[i] = v;
1350 }
1351 public jq_Type getType() { return jq_Primitive.SHORT; }
1352 }
1353 }
1354
1355 public static abstract class Branch extends Operator {
1356 public boolean hasSideEffects() { return true; }
1357 }
1358
1359 public abstract static class IntIfCmp extends Branch {
1360 public static Quad create(int id, IntIfCmp operator, Operand op0, Operand op1, ConditionOperand cond, TargetOperand target) {
1361 return new Quad(id, operator, op0, op1, cond, target);
1362 }
1363 public static Operand getSrc1(Quad q) { return q.getOp1(); }
1364 public static Operand getSrc2(Quad q) { return q.getOp2(); }
1365 public static ConditionOperand getCond(Quad q) { return (ConditionOperand)q.getOp3(); }
1366 public static TargetOperand getTarget(Quad q) { return (TargetOperand)q.getOp4(); }
1367 public static void setSrc1(Quad q, Operand o) { q.setOp1(o); }
1368 public static void setSrc2(Quad q, Operand o) { q.setOp2(o); }
1369 public static void setCond(Quad q, ConditionOperand o) { q.setOp3(o); }
1370 public static void setTarget(Quad q, TargetOperand o) { q.setOp4(o); }
1371 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg12(q); }
1372
1373 public void accept(Quad q, QuadVisitor qv) {
1374 qv.visitIntIfCmp(q);
1375 qv.visitCondBranch(q);
1376 qv.visitBranch(q);
1377 super.accept(q, qv);
1378 }
1379
1380 public static class IFCMP_I extends IntIfCmp {
1381 public static final IFCMP_I INSTANCE = new IFCMP_I();
1382 private IFCMP_I() { }
1383 public String toString() { return "IFCMP_I"; }
1384 public void interpret(Quad q, QuadInterpreter s) {
1385 int s1 = getIntOpValue(getSrc1(q), s);
1386 int s2 = getIntOpValue(getSrc2(q), s);
1387 byte c = getCond(q).getCondition();
1388 boolean r;
1389 switch (c) {
1390 case BytecodeVisitor.CMP_EQ: r = s1 == s2; break;
1391 case BytecodeVisitor.CMP_NE: r = s1 != s2; break;
1392 case BytecodeVisitor.CMP_LT: r = s1 < s2; break;
1393 case BytecodeVisitor.CMP_GE: r = s1 >= s2; break;
1394 case BytecodeVisitor.CMP_LE: r = s1 <= s2; break;
1395 case BytecodeVisitor.CMP_GT: r = s1 > s2; break;
1396 case BytecodeVisitor.CMP_AE: r = joeq.Runtime.MathSupport.ucmp(s1, s2); break;
1397 case BytecodeVisitor.CMP_UNCOND: r = true; break;
1398 default: Assert.UNREACHABLE(); r = false; break;
1399 }
1400 if (r) s.branchTo(getTarget(q).getTarget());
1401 }
1402 }
1403 public static class IFCMP_A extends IntIfCmp {
1404 public static final IFCMP_A INSTANCE = new IFCMP_A();
1405 private IFCMP_A() { }
1406 public String toString() { return "IFCMP_A"; }
1407 public void interpret(Quad q, QuadInterpreter s) {
1408 Object s1 = getObjectOpValue(getSrc1(q), s);
1409 Object s2 = getObjectOpValue(getSrc2(q), s);
1410 byte c = getCond(q).getCondition();
1411 boolean r;
1412 switch (c) {
1413 case BytecodeVisitor.CMP_EQ: r = s1 == s2; break;
1414 case BytecodeVisitor.CMP_NE: r = s1 != s2; break;
1415 case BytecodeVisitor.CMP_UNCOND: r = true; break;
1416 default: Assert.UNREACHABLE(); r = false; break;
1417 }
1418 if (r) s.branchTo(getTarget(q).getTarget());
1419 }
1420 }
1421 public static class IFCMP_P extends IntIfCmp {
1422 public static final IFCMP_P INSTANCE = new IFCMP_P();
1423 private IFCMP_P() { }
1424 public String toString() { return "IFCMP_P"; }
1425 public void interpret(Quad q, QuadInterpreter s) {
1426 Address s1 = getAddressOpValue(getSrc1(q), s);
1427 Address s2 = getAddressOpValue(getSrc2(q), s);
1428 byte c = getCond(q).getCondition();
1429 boolean r;
1430 switch (c) {
1431 case BytecodeVisitor.CMP_EQ: r = s1.difference(s2) == 0; break;
1432 case BytecodeVisitor.CMP_NE: r = s1.difference(s2) != 0; break;
1433 case BytecodeVisitor.CMP_UNCOND: r = true; break;
1434 default: Assert.UNREACHABLE(); r = false; break;
1435 }
1436 if (r) s.branchTo(getTarget(q).getTarget());
1437 }
1438 }
1439 }
1440
1441 public abstract static class Goto extends Branch {
1442 public static Quad create(int id, Goto operator, TargetOperand target) {
1443 return new Quad(id, operator, target);
1444 }
1445 public static TargetOperand getTarget(Quad q) { return (TargetOperand)q.getOp1(); }
1446 public static void setTarget(Quad q, TargetOperand o) { q.setOp1(o); }
1447
1448 public void accept(Quad q, QuadVisitor qv) {
1449 qv.visitGoto(q);
1450 qv.visitBranch(q);
1451 super.accept(q, qv);
1452 }
1453
1454 public static class GOTO extends Goto {
1455 public static final GOTO INSTANCE = new GOTO();
1456 private GOTO() { }
1457 public String toString() { return "GOTO"; }
1458 public void interpret(Quad q, QuadInterpreter s) {
1459 s.branchTo(getTarget(q).getTarget());
1460 }
1461 }
1462 }
1463
1464 public abstract static class Jsr extends Branch {
1465 public static Quad create(int id, Jsr operator, RegisterOperand loc, TargetOperand target, TargetOperand successor) {
1466 return new Quad(id, operator, loc, target, successor);
1467 }
1468 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
1469 public static TargetOperand getTarget(Quad q) { return (TargetOperand)q.getOp2(); }
1470 public static TargetOperand getSuccessor(Quad q) { return (TargetOperand)q.getOp3(); }
1471 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
1472 public static void setTarget(Quad q, TargetOperand o) { q.setOp2(o); }
1473 public static void setSuccessor(Quad q, TargetOperand o) { q.setOp3(o); }
1474 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
1475
1476 public void accept(Quad q, QuadVisitor qv) {
1477 qv.visitJsr(q);
1478 qv.visitBranch(q);
1479 super.accept(q, qv);
1480 }
1481
1482 public static class JSR extends Jsr {
1483 public static final JSR INSTANCE = new JSR();
1484 private JSR() { }
1485 public String toString() { return "JSR"; }
1486 public void interpret(Quad q, QuadInterpreter s) {
1487 BasicBlock bb = getSuccessor(q).getTarget();
1488 s.putReg(getDest(q).getRegister(), bb);
1489 s.branchTo(getTarget(q).getTarget());
1490 }
1491 }
1492 }
1493
1494 public abstract static class Ret extends Branch {
1495 public static Quad create(int id, Ret operator, RegisterOperand loc) {
1496 return new Quad(id, operator, loc);
1497 }
1498 public static RegisterOperand getTarget(Quad q) { return (RegisterOperand)q.getOp1(); }
1499 public static void setTarget(Quad q, RegisterOperand o) { q.setOp1(o); }
1500 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1(q); }
1501
1502 public void accept(Quad q, QuadVisitor qv) {
1503 qv.visitRet(q);
1504 qv.visitBranch(q);
1505 super.accept(q, qv);
1506 }
1507
1508 public static class RET extends Ret {
1509 public static final RET INSTANCE = new RET();
1510 private RET() { }
1511 public String toString() { return "RET"; }
1512 public void interpret(Quad q, QuadInterpreter s) {
1513 BasicBlock bb = (BasicBlock)s.getReg(getTarget(q).getRegister());
1514 s.branchTo(bb);
1515 }
1516 }
1517 }
1518
1519 public abstract static class TableSwitch extends Branch {
1520 public static Quad create(int id, TableSwitch operator, Operand val, IConstOperand low, TargetOperand def, int length) {
1521 return new Quad(id, operator, val, low, def, new BasicBlockTableOperand(new BasicBlock[length]));
1522 }
1523 public static void setTarget(Quad q, int i, BasicBlock t) {
1524 ((BasicBlockTableOperand)q.getOp4()).set(i, t);
1525 }
1526 public static Operand getSrc(Quad q) { return q.getOp1(); }
1527 public static IConstOperand getLow(Quad q) { return (IConstOperand)q.getOp2(); }
1528 public static TargetOperand getDefault(Quad q) { return (TargetOperand)q.getOp3(); }
1529 public static BasicBlock getTarget(Quad q, int i) { return ((BasicBlockTableOperand)q.getOp4()).get(i); }
1530 public static BasicBlockTableOperand getTargetTable(Quad q) { return (BasicBlockTableOperand)q.getOp4(); }
1531 public static void setSrc(Quad q, Operand o) { q.setOp1(o); }
1532 public static void setLow(Quad q, IConstOperand o) { q.setOp2(o); }
1533 public static void setDefault(Quad q, TargetOperand o) { q.setOp3(o); }
1534 public static void setTargetTable(Quad q, BasicBlockTableOperand o) { q.setOp4(o); }
1535 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1_check(q); }
1536
1537 public void accept(Quad q, QuadVisitor qv) {
1538 qv.visitTableSwitch(q);
1539 qv.visitCondBranch(q);
1540 qv.visitBranch(q);
1541 super.accept(q, qv);
1542 }
1543
1544 public static class TABLESWITCH extends TableSwitch {
1545 public static final TABLESWITCH INSTANCE = new TABLESWITCH();
1546 private TABLESWITCH() { }
1547 public String toString() { return "TABLESWITCH"; }
1548 public void interpret(Quad q, QuadInterpreter s) {
1549 int v = getIntOpValue(getSrc(q), s);
1550 int lo = getLow(q).getValue();
1551 int hi = getTargetTable(q).size() + lo - 1;
1552 BasicBlock bb;
1553 if ((v < lo) || (v > hi))
1554 bb = getDefault(q).getTarget();
1555 else
1556 bb = getTarget(q, v-lo);
1557 s.branchTo(bb);
1558 }
1559 }
1560 }
1561
1562 public abstract static class LookupSwitch extends Branch {
1563 public static Quad create(int id, LookupSwitch operator, Operand val, TargetOperand def, int length) {
1564 return new Quad(id, operator, val, def, new IntValueTableOperand(new int[length]), new BasicBlockTableOperand(new BasicBlock[length]));
1565 }
1566 public static void setMatch(Quad q, int i, int t) {
1567 ((IntValueTableOperand)q.getOp3()).set(i, t);
1568 }
1569 public static void setTarget(Quad q, int i, BasicBlock t) {
1570 ((BasicBlockTableOperand)q.getOp4()).set(i, t);
1571 }
1572 public static Operand getSrc(Quad q) { return q.getOp1(); }
1573 public static TargetOperand getDefault(Quad q) { return (TargetOperand)q.getOp2(); }
1574 public static int getMatch(Quad q, int i) { return ((IntValueTableOperand)q.getOp3()).get(i); }
1575 public static BasicBlock getTarget(Quad q, int i) { return ((BasicBlockTableOperand)q.getOp4()).get(i); }
1576 public static IntValueTableOperand getValueTable(Quad q) { return (IntValueTableOperand)q.getOp3(); }
1577 public static BasicBlockTableOperand getTargetTable(Quad q) { return (BasicBlockTableOperand)q.getOp4(); }
1578 public static void setSrc(Quad q, Operand o) { q.setOp1(o); }
1579 public static void setDefault(Quad q, TargetOperand o) { q.setOp2(o); }
1580 public static void setValueTable(Quad q, IntValueTableOperand o) { q.setOp3(o); }
1581 public static void setTargetTable(Quad q, BasicBlockTableOperand o) { q.setOp4(o); }
1582 public static int getSize(Quad q) { return ((IntValueTableOperand)q.getOp3()).size(); }
1583 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1_check(q); }
1584
1585 public void accept(Quad q, QuadVisitor qv) {
1586 qv.visitLookupSwitch(q);
1587 qv.visitCondBranch(q);
1588 qv.visitBranch(q);
1589 super.accept(q, qv);
1590 }
1591
1592 public static class LOOKUPSWITCH extends LookupSwitch {
1593 public static final LOOKUPSWITCH INSTANCE = new LOOKUPSWITCH();
1594 private LOOKUPSWITCH() { }
1595 public String toString() { return "LOOKUPSWITCH"; }
1596 public void interpret(Quad q, QuadInterpreter s) {
1597 int v = getIntOpValue(getSrc(q), s);
1598 IntValueTableOperand t = getValueTable(q);
1599 BasicBlock bb = getDefault(q).getTarget();
1600 for (int i=0; i<t.size(); ++i) {
1601 if (v == t.get(i)) {
1602 bb = getTargetTable(q).get(i);
1603 break;
1604 }
1605 }
1606 s.branchTo(bb);
1607 }
1608 }
1609 }
1610
1611 public abstract static class Return extends Operator {
1612 public static Quad create(int id, Return operator, Operand val) {
1613 return new Quad(id, operator, val);
1614 }
1615 public static Quad create(int id, Return operator) {
1616 return new Quad(id, operator);
1617 }
1618 public static Operand getSrc(Quad q) { return q.getOp1(); }
1619 public static void setSrc(Quad q, Operand o) { q.setOp1(o); }
1620 public boolean hasSideEffects() { return true; }
1621
1622 public void accept(Quad q, QuadVisitor qv) {
1623 qv.visitReturn(q);
1624 super.accept(q, qv);
1625 }
1626
1627 public void interpret(Quad q, QuadInterpreter s) {
1628 s.setReturnValue(getWrappedOpValue(getSrc(q), s));
1629 }
1630
1631 public static class RETURN_V extends Return {
1632 public static final RETURN_V INSTANCE = new RETURN_V();
1633 private RETURN_V() { }
1634 public String toString() { return "RETURN_V"; }
1635 public void interpret(Quad q, QuadInterpreter s) {
1636 s.setReturnValue(null);
1637 }
1638 }
1639 public static class RETURN_I extends Return {
1640 public static final RETURN_I INSTANCE = new RETURN_I();
1641 private RETURN_I() { }
1642 public String toString() { return "RETURN_I"; }
1643 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1_check(q); }
1644 }
1645 public static class RETURN_F extends Return {
1646 public static final RETURN_F INSTANCE = new RETURN_F();
1647 private RETURN_F() { }
1648 public String toString() { return "RETURN_F"; }
1649 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1_check(q); }
1650 }
1651 public static class RETURN_L extends Return {
1652 public static final RETURN_L INSTANCE = new RETURN_L();
1653 private RETURN_L() { }
1654 public String toString() { return "RETURN_L"; }
1655 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1_check(q); }
1656 }
1657 public static class RETURN_D extends Return {
1658 public static final RETURN_D INSTANCE = new RETURN_D();
1659 private RETURN_D() { }
1660 public String toString() { return "RETURN_D"; }
1661 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1_check(q); }
1662 }
1663 public static class RETURN_A extends Return {
1664 public static final RETURN_A INSTANCE = new RETURN_A();
1665 private RETURN_A() { }
1666 public String toString() { return "RETURN_A"; }
1667 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1_check(q); }
1668 }
1669 public static class RETURN_P extends Return {
1670 public static final RETURN_P INSTANCE = new RETURN_P();
1671 private RETURN_P() { }
1672 public String toString() { return "RETURN_P"; }
1673 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1_check(q); }
1674 }
1675 public static class THROW_A extends Return {
1676 public static final THROW_A INSTANCE = new THROW_A();
1677 private THROW_A() { }
1678 public String toString() { return "THROW_A"; }
1679 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1_check(q); }
1680 public UnmodifiableList.jq_Class getThrownExceptions() {
1681 return anyexception;
1682 }
1683 public void interpret(Quad q, QuadInterpreter s) {
1684 s.handleException((Throwable)getObjectOpValue(getSrc(q), s));
1685 }
1686 }
1687 }
1688
1689 public abstract static class Getstatic extends Operator {
1690 public static Quad create(int id, Getstatic operator, RegisterOperand dst, FieldOperand field) {
1691 return new Quad(id, operator, dst, field);
1692 }
1693 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
1694 public static FieldOperand getField(Quad q) { return (FieldOperand)q.getOp2(); }
1695 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
1696 public static void setField(Quad q, FieldOperand o) { q.setOp2(o); }
1697 public boolean hasSideEffects() { return false; }
1698 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
1699
1700 public void accept(Quad q, QuadVisitor qv) {
1701 qv.visitGetstatic(q);
1702 qv.visitStaticField(q);
1703 qv.visitLoad(q);
1704 super.accept(q, qv);
1705 }
1706
1707 public static class GETSTATIC_I extends Getstatic {
1708 public static final GETSTATIC_I INSTANCE = new GETSTATIC_I();
1709 private GETSTATIC_I() { }
1710 public String toString() { return "GETSTATIC_I"; }
1711 public void interpret(Quad q, QuadInterpreter s) {
1712 jq_StaticField f = (jq_StaticField)getField(q).getField();
1713 s.putReg_I(getDest(q).getRegister(), Reflection.getstatic_I(f));
1714 }
1715 }
1716 public static class GETSTATIC_F extends Getstatic {
1717 public static final GETSTATIC_F INSTANCE = new GETSTATIC_F();
1718 private GETSTATIC_F() { }
1719 public String toString() { return "GETSTATIC_F"; }
1720 public void interpret(Quad q, QuadInterpreter s) {
1721 jq_StaticField f = (jq_StaticField)getField(q).getField();
1722 s.putReg_F(getDest(q).getRegister(), Reflection.getstatic_F(f));
1723 }
1724 }
1725 public static class GETSTATIC_L extends Getstatic {
1726 public static final GETSTATIC_L INSTANCE = new GETSTATIC_L();
1727 private GETSTATIC_L() { }
1728 public String toString() { return "GETSTATIC_L"; }
1729 public void interpret(Quad q, QuadInterpreter s) {
1730 jq_StaticField f = (jq_StaticField)getField(q).getField();
1731 s.putReg_L(getDest(q).getRegister(), Reflection.getstatic_L(f));
1732 }
1733 }
1734 public static class GETSTATIC_D extends Getstatic {
1735 public static final GETSTATIC_D INSTANCE = new GETSTATIC_D();
1736 private GETSTATIC_D() { }
1737 public String toString() { return "GETSTATIC_D"; }
1738 public void interpret(Quad q, QuadInterpreter s) {
1739 jq_StaticField f = (jq_StaticField)getField(q).getField();
1740 s.putReg_D(getDest(q).getRegister(), Reflection.getstatic_D(f));
1741 }
1742 }
1743 public static class GETSTATIC_A extends Getstatic {
1744 public static final GETSTATIC_A INSTANCE = new GETSTATIC_A();
1745 private GETSTATIC_A() { }
1746 public String toString() { return "GETSTATIC_A"; }
1747 public void interpret(Quad q, QuadInterpreter s) {
1748 jq_StaticField f = (jq_StaticField)getField(q).getField();
1749 s.putReg_A(getDest(q).getRegister(), Reflection.getstatic_A(f));
1750 }
1751 }
1752 public static class GETSTATIC_P extends Getstatic {
1753 public static final GETSTATIC_P INSTANCE = new GETSTATIC_P();
1754 private GETSTATIC_P() { }
1755 public String toString() { return "GETSTATIC_P"; }
1756 public void interpret(Quad q, QuadInterpreter s) {
1757 jq_StaticField f = (jq_StaticField)getField(q).getField();
1758 s.putReg_P(getDest(q).getRegister(), Reflection.getstatic_P(f));
1759 }
1760 }
1761 public static class GETSTATIC_Z extends Getstatic {
1762 public static final GETSTATIC_Z INSTANCE = new GETSTATIC_Z();
1763 private GETSTATIC_Z() { }
1764 public String toString() { return "GETSTATIC_Z"; }
1765 public void interpret(Quad q, QuadInterpreter s) {
1766 jq_StaticField f = (jq_StaticField)getField(q).getField();
1767 s.putReg_I(getDest(q).getRegister(), Reflection.getstatic_Z(f)?1:0);
1768 }
1769 }
1770 public static class GETSTATIC_B extends Getstatic {
1771 public static final GETSTATIC_B INSTANCE = new GETSTATIC_B();
1772 private GETSTATIC_B() { }
1773 public String toString() { return "GETSTATIC_B"; }
1774 public void interpret(Quad q, QuadInterpreter s) {
1775 jq_StaticField f = (jq_StaticField)getField(q).getField();
1776 s.putReg_I(getDest(q).getRegister(), (int)Reflection.getstatic_B(f));
1777 }
1778 }
1779 public static class GETSTATIC_C extends Getstatic {
1780 public static final GETSTATIC_C INSTANCE = new GETSTATIC_C();
1781 private GETSTATIC_C() { }
1782 public String toString() { return "GETSTATIC_C"; }
1783 public void interpret(Quad q, QuadInterpreter s) {
1784 jq_StaticField f = (jq_StaticField)getField(q).getField();
1785 s.putReg_I(getDest(q).getRegister(), (int)Reflection.getstatic_C(f));
1786 }
1787 }
1788 public static class GETSTATIC_S extends Getstatic {
1789 public static final GETSTATIC_S INSTANCE = new GETSTATIC_S();
1790 private GETSTATIC_S() { }
1791 public String toString() { return "GETSTATIC_S"; }
1792 public void interpret(Quad q, QuadInterpreter s) {
1793 jq_StaticField f = (jq_StaticField)getField(q).getField();
1794 s.putReg_I(getDest(q).getRegister(), (int)Reflection.getstatic_S(f));
1795 }
1796 }
1797 public static class GETSTATIC_I_DYNLINK extends GETSTATIC_I {
1798 public static final GETSTATIC_I_DYNLINK INSTANCE = new GETSTATIC_I_DYNLINK();
1799 private GETSTATIC_I_DYNLINK() { }
1800 public void accept(Quad q, QuadVisitor qv) {
1801 qv.visitExceptionThrower(q);
1802 super.accept(q, qv);
1803 }
1804 public UnmodifiableList.jq_Class getThrownExceptions() {
1805 return resolutionexceptions;
1806 }
1807 public boolean hasSideEffects() { return true; }
1808 public String toString() { return "GETSTATIC_I%"; }
1809 }
1810 public static class GETSTATIC_F_DYNLINK extends GETSTATIC_F {
1811 public static final GETSTATIC_F_DYNLINK INSTANCE = new GETSTATIC_F_DYNLINK();
1812 private GETSTATIC_F_DYNLINK() { }
1813 public void accept(Quad q, QuadVisitor qv) {
1814 qv.visitExceptionThrower(q);
1815 super.accept(q, qv);
1816 }
1817 public UnmodifiableList.jq_Class getThrownExceptions() {
1818 return resolutionexceptions;
1819 }
1820 public boolean hasSideEffects() { return true; }
1821 public String toString() { return "GETSTATIC_F%"; }
1822 }
1823 public static class GETSTATIC_L_DYNLINK extends GETSTATIC_L {
1824 public static final GETSTATIC_L_DYNLINK INSTANCE = new GETSTATIC_L_DYNLINK();
1825 private GETSTATIC_L_DYNLINK() { }
1826 public void accept(Quad q, QuadVisitor qv) {
1827 qv.visitExceptionThrower(q);
1828 super.accept(q, qv);
1829 }
1830 public UnmodifiableList.jq_Class getThrownExceptions() {
1831 return resolutionexceptions;
1832 }
1833 public boolean hasSideEffects() { return true; }
1834 public String toString() { return "GETSTATIC_L%"; }
1835 }
1836 public static class GETSTATIC_D_DYNLINK extends GETSTATIC_D {
1837 public static final GETSTATIC_D_DYNLINK INSTANCE = new GETSTATIC_D_DYNLINK();
1838 private GETSTATIC_D_DYNLINK() { }
1839 public void accept(Quad q, QuadVisitor qv) {
1840 qv.visitExceptionThrower(q);
1841 super.accept(q, qv);
1842 }
1843 public UnmodifiableList.jq_Class getThrownExceptions() {
1844 return resolutionexceptions;
1845 }
1846 public boolean hasSideEffects() { return true; }
1847 public String toString() { return "GETSTATIC_D%"; }
1848 }
1849 public static class GETSTATIC_A_DYNLINK extends GETSTATIC_A {
1850 public static final GETSTATIC_A_DYNLINK INSTANCE = new GETSTATIC_A_DYNLINK();
1851 private GETSTATIC_A_DYNLINK() { }
1852 public void accept(Quad q, QuadVisitor qv) {
1853 qv.visitExceptionThrower(q);
1854 super.accept(q, qv);
1855 }
1856 public UnmodifiableList.jq_Class getThrownExceptions() {
1857 return resolutionexceptions;
1858 }
1859 public boolean hasSideEffects() { return true; }
1860 public String toString() { return "GETSTATIC_A%"; }
1861 }
1862 public static class GETSTATIC_P_DYNLINK extends GETSTATIC_P {
1863 public static final GETSTATIC_P_DYNLINK INSTANCE = new GETSTATIC_P_DYNLINK();
1864 private GETSTATIC_P_DYNLINK() { }
1865 public void accept(Quad q, QuadVisitor qv) {
1866 qv.visitExceptionThrower(q);
1867 super.accept(q, qv);
1868 }
1869 public UnmodifiableList.jq_Class getThrownExceptions() {
1870 return resolutionexceptions;
1871 }
1872 public boolean hasSideEffects() { return true; }
1873 public String toString() { return "GETSTATIC_P%"; }
1874 }
1875 public static class GETSTATIC_Z_DYNLINK extends GETSTATIC_Z {
1876 public static final GETSTATIC_Z_DYNLINK INSTANCE = new GETSTATIC_Z_DYNLINK();
1877 private GETSTATIC_Z_DYNLINK() { }
1878 public void accept(Quad q, QuadVisitor qv) {
1879 qv.visitExceptionThrower(q);
1880 super.accept(q, qv);
1881 }
1882 public UnmodifiableList.jq_Class getThrownExceptions() {
1883 return resolutionexceptions;
1884 }
1885 public boolean hasSideEffects() { return true; }
1886 public String toString() { return "GETSTATIC_Z%"; }
1887 }
1888 public static class GETSTATIC_B_DYNLINK extends GETSTATIC_B {
1889 public static final GETSTATIC_B_DYNLINK INSTANCE = new GETSTATIC_B_DYNLINK();
1890 private GETSTATIC_B_DYNLINK() { }
1891 public void accept(Quad q, QuadVisitor qv) {
1892 qv.visitExceptionThrower(q);
1893 super.accept(q, qv);
1894 }
1895 public UnmodifiableList.jq_Class getThrownExceptions() {
1896 return resolutionexceptions;
1897 }
1898 public boolean hasSideEffects() { return true; }
1899 public String toString() { return "GETSTATIC_B%"; }
1900 }
1901 public static class GETSTATIC_C_DYNLINK extends GETSTATIC_C {
1902 public static final GETSTATIC_C_DYNLINK INSTANCE = new GETSTATIC_C_DYNLINK();
1903 private GETSTATIC_C_DYNLINK() { }
1904 public void accept(Quad q, QuadVisitor qv) {
1905 qv.visitExceptionThrower(q);
1906 super.accept(q, qv);
1907 }
1908 public UnmodifiableList.jq_Class getThrownExceptions() {
1909 return resolutionexceptions;
1910 }
1911 public boolean hasSideEffects() { return true; }
1912 public String toString() { return "GETSTATIC_C%"; }
1913 }
1914 public static class GETSTATIC_S_DYNLINK extends GETSTATIC_S {
1915 public static final GETSTATIC_S_DYNLINK INSTANCE = new GETSTATIC_S_DYNLINK();
1916 private GETSTATIC_S_DYNLINK() { }
1917 public void accept(Quad q, QuadVisitor qv) {
1918 qv.visitExceptionThrower(q);
1919 super.accept(q, qv);
1920 }
1921 public UnmodifiableList.jq_Class getThrownExceptions() {
1922 return resolutionexceptions;
1923 }
1924 public boolean hasSideEffects() { return true; }
1925 public String toString() { return "GETSTATIC_S%"; }
1926 }
1927 }
1928
1929 public abstract static class Putstatic extends Operator {
1930 public static Quad create(int id, Putstatic operator, Operand src, FieldOperand field) {
1931 return new Quad(id, operator, src, field);
1932 }
1933 public static Operand getSrc(Quad q) { return q.getOp1(); }
1934 public static FieldOperand getField(Quad q) { return (FieldOperand)q.getOp2(); }
1935 public static void setSrc(Quad q, Operand o) { q.setOp1(o); }
1936 public static void setField(Quad q, FieldOperand o) { q.setOp2(o); }
1937 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1_check(q); }
1938 public boolean hasSideEffects() { return true; }
1939
1940 public void accept(Quad q, QuadVisitor qv) {
1941 qv.visitPutstatic(q);
1942 qv.visitStaticField(q);
1943 qv.visitStore(q);
1944 super.accept(q, qv);
1945 }
1946
1947 public static class PUTSTATIC_I extends Putstatic {
1948 public static final PUTSTATIC_I INSTANCE = new PUTSTATIC_I();
1949 private PUTSTATIC_I() { }
1950 public String toString() { return "PUTSTATIC_I"; }
1951 public void interpret(Quad q, QuadInterpreter s) {
1952 jq_StaticField f = (jq_StaticField)getField(q).getField();
1953 int i = getIntOpValue(getSrc(q), s);
1954 Reflection.putstatic_I(f, i);
1955 }
1956 }
1957 public static class PUTSTATIC_F extends Putstatic {
1958 public static final PUTSTATIC_F INSTANCE = new PUTSTATIC_F();
1959 private PUTSTATIC_F() { }
1960 public String toString() { return "PUTSTATIC_F"; }
1961 public void interpret(Quad q, QuadInterpreter s) {
1962 jq_StaticField f = (jq_StaticField)getField(q).getField();
1963 float i = getFloatOpValue(getSrc(q), s);
1964 Reflection.putstatic_F(f, i);
1965 }
1966 }
1967 public static class PUTSTATIC_L extends Putstatic {
1968 public static final PUTSTATIC_L INSTANCE = new PUTSTATIC_L();
1969 private PUTSTATIC_L() { }
1970 public String toString() { return "PUTSTATIC_L"; }
1971 public void interpret(Quad q, QuadInterpreter s) {
1972 jq_StaticField f = (jq_StaticField)getField(q).getField();
1973 long i = getLongOpValue(getSrc(q), s);
1974 Reflection.putstatic_L(f, i);
1975 }
1976 }
1977 public static class PUTSTATIC_D extends Putstatic {
1978 public static final PUTSTATIC_D INSTANCE = new PUTSTATIC_D();
1979 private PUTSTATIC_D() { }
1980 public String toString() { return "PUTSTATIC_D"; }
1981 public void interpret(Quad q, QuadInterpreter s) {
1982 jq_StaticField f = (jq_StaticField)getField(q).getField();
1983 double i = getDoubleOpValue(getSrc(q), s);
1984 Reflection.putstatic_D(f, i);
1985 }
1986 }
1987 public static class PUTSTATIC_A extends Putstatic {
1988 public static final PUTSTATIC_A INSTANCE = new PUTSTATIC_A();
1989 private PUTSTATIC_A() { }
1990 public String toString() { return "PUTSTATIC_A"; }
1991 public void interpret(Quad q, QuadInterpreter s) {
1992 jq_StaticField f = (jq_StaticField)getField(q).getField();
1993 Object i = getObjectOpValue(getSrc(q), s);
1994 Reflection.putstatic_A(f, i);
1995 }
1996 }
1997 public static class PUTSTATIC_P extends Putstatic {
1998 public static final PUTSTATIC_P INSTANCE = new PUTSTATIC_P();
1999 private PUTSTATIC_P() { }
2000 public String toString() { return "PUTSTATIC_P"; }
2001 public void interpret(Quad q, QuadInterpreter s) {
2002 jq_StaticField f = (jq_StaticField)getField(q).getField();
2003 Address i = getAddressOpValue(getSrc(q), s);
2004 Reflection.putstatic_P(f, i);
2005 }
2006 }
2007 public static class PUTSTATIC_Z extends Putstatic {
2008 public static final PUTSTATIC_Z INSTANCE = new PUTSTATIC_Z();
2009 private PUTSTATIC_Z() { }
2010 public String toString() { return "PUTSTATIC_Z"; }
2011 public void interpret(Quad q, QuadInterpreter s) {
2012 jq_StaticField f = (jq_StaticField)getField(q).getField();
2013 int i = getIntOpValue(getSrc(q), s);
2014 Reflection.putstatic_Z(f, i!=0);
2015 }
2016 }
2017 public static class PUTSTATIC_B extends Putstatic {
2018 public static final PUTSTATIC_B INSTANCE = new PUTSTATIC_B();
2019 private PUTSTATIC_B() { }
2020 public String toString() { return "PUTSTATIC_B"; }
2021 public void interpret(Quad q, QuadInterpreter s) {
2022 jq_StaticField f = (jq_StaticField)getField(q).getField();
2023 int i = getIntOpValue(getSrc(q), s);
2024 Reflection.putstatic_B(f, (byte)i);
2025 }
2026 }
2027 public static class PUTSTATIC_S extends Putstatic {
2028 public static final PUTSTATIC_S INSTANCE = new PUTSTATIC_S();
2029 private PUTSTATIC_S() { }
2030 public String toString() { return "PUTSTATIC_S"; }
2031 public void interpret(Quad q, QuadInterpreter s) {
2032 jq_StaticField f = (jq_StaticField)getField(q).getField();
2033 int i = getIntOpValue(getSrc(q), s);
2034 Reflection.putstatic_S(f, (short)i);
2035 }
2036 }
2037 public static class PUTSTATIC_C extends Putstatic {
2038 public static final PUTSTATIC_C INSTANCE = new PUTSTATIC_C();
2039 private PUTSTATIC_C() { }
2040 public String toString() { return "PUTSTATIC_C"; }
2041 public void interpret(Quad q, QuadInterpreter s) {
2042 jq_StaticField f = (jq_StaticField)getField(q).getField();
2043 int i = getIntOpValue(getSrc(q), s);
2044 Reflection.putstatic_C(f, (char)i);
2045 }
2046 }
2047 public static class PUTSTATIC_I_DYNLINK extends PUTSTATIC_I {
2048 public static final PUTSTATIC_I_DYNLINK INSTANCE = new PUTSTATIC_I_DYNLINK();
2049 private PUTSTATIC_I_DYNLINK() { }
2050 public void accept(Quad q, QuadVisitor qv) {
2051 qv.visitExceptionThrower(q);
2052 super.accept(q, qv);
2053 }
2054 public UnmodifiableList.jq_Class getThrownExceptions() {
2055 return resolutionexceptions;
2056 }
2057 public String toString() { return "PUTSTATIC_I%"; }
2058 }
2059 public static class PUTSTATIC_F_DYNLINK extends PUTSTATIC_F {
2060 public static final PUTSTATIC_F_DYNLINK INSTANCE = new PUTSTATIC_F_DYNLINK();
2061 private PUTSTATIC_F_DYNLINK() { }
2062 public void accept(Quad q, QuadVisitor qv) {
2063 qv.visitExceptionThrower(q);
2064 super.accept(q, qv);
2065 }
2066 public UnmodifiableList.jq_Class getThrownExceptions() {
2067 return resolutionexceptions;
2068 }
2069 public String toString() { return "PUTSTATIC_F%"; }
2070 }
2071 public static class PUTSTATIC_L_DYNLINK extends PUTSTATIC_L {
2072 public static final PUTSTATIC_L_DYNLINK INSTANCE = new PUTSTATIC_L_DYNLINK();
2073 private PUTSTATIC_L_DYNLINK() { }
2074 public void accept(Quad q, QuadVisitor qv) {
2075 qv.visitExceptionThrower(q);
2076 super.accept(q, qv);
2077 }
2078 public UnmodifiableList.jq_Class getThrownExceptions() {
2079 return resolutionexceptions;
2080 }
2081 public String toString() { return "PUTSTATIC_L%"; }
2082 }
2083 public static class PUTSTATIC_D_DYNLINK extends PUTSTATIC_D {
2084 public static final PUTSTATIC_D_DYNLINK INSTANCE = new PUTSTATIC_D_DYNLINK();
2085 private PUTSTATIC_D_DYNLINK() { }
2086 public void accept(Quad q, QuadVisitor qv) {
2087 qv.visitExceptionThrower(q);
2088 super.accept(q, qv);
2089 }
2090 public UnmodifiableList.jq_Class getThrownExceptions() {
2091 return resolutionexceptions;
2092 }
2093 public String toString() { return "PUTSTATIC_D%"; }
2094 }
2095 public static class PUTSTATIC_A_DYNLINK extends PUTSTATIC_A {
2096 public static final PUTSTATIC_A_DYNLINK INSTANCE = new PUTSTATIC_A_DYNLINK();
2097 private PUTSTATIC_A_DYNLINK() { }
2098 public void accept(Quad q, QuadVisitor qv) {
2099 qv.visitExceptionThrower(q);
2100 super.accept(q, qv);
2101 }
2102 public UnmodifiableList.jq_Class getThrownExceptions() {
2103 return resolutionexceptions;
2104 }
2105 public String toString() { return "PUTSTATIC_A%"; }
2106 }
2107 public static class PUTSTATIC_P_DYNLINK extends PUTSTATIC_P {
2108 public static final PUTSTATIC_P_DYNLINK INSTANCE = new PUTSTATIC_P_DYNLINK();
2109 private PUTSTATIC_P_DYNLINK() { }
2110 public void accept(Quad q, QuadVisitor qv) {
2111 qv.visitExceptionThrower(q);
2112 super.accept(q, qv);
2113 }
2114 public UnmodifiableList.jq_Class getThrownExceptions() {
2115 return resolutionexceptions;
2116 }
2117 public String toString() { return "PUTSTATIC_P%"; }
2118 }
2119 public static class PUTSTATIC_Z_DYNLINK extends PUTSTATIC_Z {
2120 public static final PUTSTATIC_Z_DYNLINK INSTANCE = new PUTSTATIC_Z_DYNLINK();
2121 private PUTSTATIC_Z_DYNLINK() { }
2122 public void accept(Quad q, QuadVisitor qv) {
2123 qv.visitExceptionThrower(q);
2124 super.accept(q, qv);
2125 }
2126 public UnmodifiableList.jq_Class getThrownExceptions() {
2127 return resolutionexceptions;
2128 }
2129 public String toString() { return "PUTSTATIC_Z%"; }
2130 }
2131 public static class PUTSTATIC_B_DYNLINK extends PUTSTATIC_B {
2132 public static final PUTSTATIC_B_DYNLINK INSTANCE = new PUTSTATIC_B_DYNLINK();
2133 private PUTSTATIC_B_DYNLINK() { }
2134 public void accept(Quad q, QuadVisitor qv) {
2135 qv.visitExceptionThrower(q);
2136 super.accept(q, qv);
2137 }
2138 public UnmodifiableList.jq_Class getThrownExceptions() {
2139 return resolutionexceptions;
2140 }
2141 public String toString() { return "PUTSTATIC_B%"; }
2142 }
2143 public static class PUTSTATIC_C_DYNLINK extends PUTSTATIC_C {
2144 public static final PUTSTATIC_C_DYNLINK INSTANCE = new PUTSTATIC_C_DYNLINK();
2145 private PUTSTATIC_C_DYNLINK() { }
2146 public void accept(Quad q, QuadVisitor qv) {
2147 qv.visitExceptionThrower(q);
2148 super.accept(q, qv);
2149 }
2150 public UnmodifiableList.jq_Class getThrownExceptions() {
2151 return resolutionexceptions;
2152 }
2153 public String toString() { return "PUTSTATIC_C%"; }
2154 }
2155 public static class PUTSTATIC_S_DYNLINK extends PUTSTATIC_S {
2156 public static final PUTSTATIC_S_DYNLINK INSTANCE = new PUTSTATIC_S_DYNLINK();
2157 private PUTSTATIC_S_DYNLINK() { }
2158 public void accept(Quad q, QuadVisitor qv) {
2159 qv.visitExceptionThrower(q);
2160 super.accept(q, qv);
2161 }
2162 public UnmodifiableList.jq_Class getThrownExceptions() {
2163 return resolutionexceptions;
2164 }
2165 public String toString() { return "PUTSTATIC_S%"; }
2166 }
2167 }
2168
2169 public abstract static class Getfield extends Operator {
2170 public static Quad create(int id, Getfield operator, RegisterOperand dst, Operand base, FieldOperand field, Operand guard) {
2171 return new Quad(id, operator, dst, base, field, guard);
2172 }
2173 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
2174 public static Operand getBase(Quad q) { return q.getOp2(); }
2175 public static FieldOperand getField(Quad q) { return (FieldOperand)q.getOp3(); }
2176 public static Operand getGuard(Quad q) { return q.getOp4(); }
2177 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
2178 public static void setBase(Quad q, Operand o) { q.setOp2(o); }
2179 public static void setField(Quad q, FieldOperand o) { q.setOp3(o); }
2180 public static void setGuard(Quad q, Operand o) { q.setOp4(o); }
2181 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
2182 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg24(q); }
2183 public boolean hasSideEffects() { return false; }
2184
2185 public void accept(Quad q, QuadVisitor qv) {
2186 qv.visitGetfield(q);
2187 qv.visitInstanceField(q);
2188 qv.visitLoad(q);
2189 super.accept(q, qv);
2190 }
2191
2192 public static class GETFIELD_I extends Getfield {
2193 public static final GETFIELD_I INSTANCE = new GETFIELD_I();
2194 private GETFIELD_I() { }
2195 public String toString() { return "GETFIELD_I"; }
2196 public void interpret(Quad q, QuadInterpreter s) {
2197 Object o = getObjectOpValue(getBase(q), s);
2198 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2199 s.putReg_I(getDest(q).getRegister(), Reflection.getfield_I(o, f));
2200 }
2201 }
2202 public static class GETFIELD_F extends Getfield {
2203 public static final GETFIELD_F INSTANCE = new GETFIELD_F();
2204 private GETFIELD_F() { }
2205 public String toString() { return "GETFIELD_F"; }
2206 public void interpret(Quad q, QuadInterpreter s) {
2207 Object o = getObjectOpValue(getBase(q), s);
2208 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2209 s.putReg_F(getDest(q).getRegister(), Reflection.getfield_F(o, f));
2210 }
2211 }
2212 public static class GETFIELD_L extends Getfield {
2213 public static final GETFIELD_L INSTANCE = new GETFIELD_L();
2214 private GETFIELD_L() { }
2215 public String toString() { return "GETFIELD_L"; }
2216 public void interpret(Quad q, QuadInterpreter s) {
2217 Object o = getObjectOpValue(getBase(q), s);
2218 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2219 s.putReg_L(getDest(q).getRegister(), Reflection.getfield_L(o, f));
2220 }
2221 }
2222 public static class GETFIELD_D extends Getfield {
2223 public static final GETFIELD_D INSTANCE = new GETFIELD_D();
2224 private GETFIELD_D() { }
2225 public String toString() { return "GETFIELD_D"; }
2226 public void interpret(Quad q, QuadInterpreter s) {
2227 Object o = getObjectOpValue(getBase(q), s);
2228 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2229 s.putReg_D(getDest(q).getRegister(), Reflection.getfield_D(o, f));
2230 }
2231 }
2232 public static class GETFIELD_A extends Getfield {
2233 public static final GETFIELD_A INSTANCE = new GETFIELD_A();
2234 private GETFIELD_A() { }
2235 public String toString() { return "GETFIELD_A"; }
2236 public void interpret(Quad q, QuadInterpreter s) {
2237 Object o = getObjectOpValue(getBase(q), s);
2238 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2239 s.putReg_A(getDest(q).getRegister(), Reflection.getfield_A(o, f));
2240 }
2241 }
2242 public static class GETFIELD_P extends Getfield {
2243 public static final GETFIELD_P INSTANCE = new GETFIELD_P();
2244 private GETFIELD_P() { }
2245 public String toString() { return "GETFIELD_P"; }
2246 public void interpret(Quad q, QuadInterpreter s) {
2247 Object o = getObjectOpValue(getBase(q), s);
2248 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2249 s.putReg_P(getDest(q).getRegister(), Reflection.getfield_P(o, f));
2250 }
2251 }
2252 public static class GETFIELD_B extends Getfield {
2253 public static final GETFIELD_B INSTANCE = new GETFIELD_B();
2254 private GETFIELD_B() { }
2255 public String toString() { return "GETFIELD_B"; }
2256 public void interpret(Quad q, QuadInterpreter s) {
2257 Object o = getObjectOpValue(getBase(q), s);
2258 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2259 s.putReg_I(getDest(q).getRegister(), (int)Reflection.getfield_B(o, f));
2260 }
2261 }
2262 public static class GETFIELD_C extends Getfield {
2263 public static final GETFIELD_C INSTANCE = new GETFIELD_C();
2264 private GETFIELD_C() { }
2265 public String toString() { return "GETFIELD_C"; }
2266 public void interpret(Quad q, QuadInterpreter s) {
2267 Object o = getObjectOpValue(getBase(q), s);
2268 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2269 s.putReg_I(getDest(q).getRegister(), (int)Reflection.getfield_C(o, f));
2270 }
2271 }
2272 public static class GETFIELD_S extends Getfield {
2273 public static final GETFIELD_S INSTANCE = new GETFIELD_S();
2274 private GETFIELD_S() { }
2275 public String toString() { return "GETFIELD_S"; }
2276 public void interpret(Quad q, QuadInterpreter s) {
2277 Object o = getObjectOpValue(getBase(q), s);
2278 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2279 s.putReg_I(getDest(q).getRegister(), (int)Reflection.getfield_S(o, f));
2280 }
2281 }
2282 public static class GETFIELD_Z extends Getfield {
2283 public static final GETFIELD_Z INSTANCE = new GETFIELD_Z();
2284 private GETFIELD_Z() { }
2285 public String toString() { return "GETFIELD_Z"; }
2286 public void interpret(Quad q, QuadInterpreter s) {
2287 Object o = getObjectOpValue(getBase(q), s);
2288 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2289 s.putReg_I(getDest(q).getRegister(), Reflection.getfield_Z(o, f)?1:0);
2290 }
2291 }
2292 public static class GETFIELD_I_DYNLINK extends GETFIELD_I {
2293 public static final GETFIELD_I_DYNLINK INSTANCE = new GETFIELD_I_DYNLINK();
2294 private GETFIELD_I_DYNLINK() { }
2295 public void accept(Quad q, QuadVisitor qv) {
2296 qv.visitExceptionThrower(q);
2297 super.accept(q, qv);
2298 }
2299 public UnmodifiableList.jq_Class getThrownExceptions() {
2300 return resolutionexceptions;
2301 }
2302 public boolean hasSideEffects() { return true; }
2303 public String toString() { return "GETFIELD_I%"; }
2304 }
2305 public static class GETFIELD_F_DYNLINK extends GETFIELD_F {
2306 public static final GETFIELD_F_DYNLINK INSTANCE = new GETFIELD_F_DYNLINK();
2307 private GETFIELD_F_DYNLINK() { }
2308 public void accept(Quad q, QuadVisitor qv) {
2309 qv.visitExceptionThrower(q);
2310 super.accept(q, qv);
2311 }
2312 public UnmodifiableList.jq_Class getThrownExceptions() {
2313 return resolutionexceptions;
2314 }
2315 public boolean hasSideEffects() { return true; }
2316 public String toString() { return "GETFIELD_F%"; }
2317 }
2318 public static class GETFIELD_L_DYNLINK extends GETFIELD_L {
2319 public static final GETFIELD_L_DYNLINK INSTANCE = new GETFIELD_L_DYNLINK();
2320 private GETFIELD_L_DYNLINK() { }
2321 public void accept(Quad q, QuadVisitor qv) {
2322 qv.visitExceptionThrower(q);
2323 super.accept(q, qv);
2324 }
2325 public UnmodifiableList.jq_Class getThrownExceptions() {
2326 return resolutionexceptions;
2327 }
2328 public boolean hasSideEffects() { return true; }
2329 public String toString() { return "GETFIELD_L%"; }
2330 }
2331 public static class GETFIELD_D_DYNLINK extends GETFIELD_D {
2332 public static final GETFIELD_D_DYNLINK INSTANCE = new GETFIELD_D_DYNLINK();
2333 private GETFIELD_D_DYNLINK() { }
2334 public void accept(Quad q, QuadVisitor qv) {
2335 qv.visitExceptionThrower(q);
2336 super.accept(q, qv);
2337 }
2338 public UnmodifiableList.jq_Class getThrownExceptions() {
2339 return resolutionexceptions;
2340 }
2341 public boolean hasSideEffects() { return true; }
2342 public String toString() { return "GETFIELD_D%"; }
2343 }
2344 public static class GETFIELD_A_DYNLINK extends GETFIELD_A {
2345 public static final GETFIELD_A_DYNLINK INSTANCE = new GETFIELD_A_DYNLINK();
2346 private GETFIELD_A_DYNLINK() { }
2347 public void accept(Quad q, QuadVisitor qv) {
2348 qv.visitExceptionThrower(q);
2349 super.accept(q, qv);
2350 }
2351 public UnmodifiableList.jq_Class getThrownExceptions() {
2352 return resolutionexceptions;
2353 }
2354 public boolean hasSideEffects() { return true; }
2355 public String toString() { return "GETFIELD_A%"; }
2356 }
2357 public static class GETFIELD_P_DYNLINK extends GETFIELD_P {
2358 public static final GETFIELD_P_DYNLINK INSTANCE = new GETFIELD_P_DYNLINK();
2359 private GETFIELD_P_DYNLINK() { }
2360 public void accept(Quad q, QuadVisitor qv) {
2361 qv.visitExceptionThrower(q);
2362 super.accept(q, qv);
2363 }
2364 public UnmodifiableList.jq_Class getThrownExceptions() {
2365 return resolutionexceptions;
2366 }
2367 public boolean hasSideEffects() { return true; }
2368 public String toString() { return "GETFIELD_P%"; }
2369 }
2370 public static class GETFIELD_B_DYNLINK extends GETFIELD_B {
2371 public static final GETFIELD_B_DYNLINK INSTANCE = new GETFIELD_B_DYNLINK();
2372 private GETFIELD_B_DYNLINK() { }
2373 public void accept(Quad q, QuadVisitor qv) {
2374 qv.visitExceptionThrower(q);
2375 super.accept(q, qv);
2376 }
2377 public UnmodifiableList.jq_Class getThrownExceptions() {
2378 return resolutionexceptions;
2379 }
2380 public boolean hasSideEffects() { return true; }
2381 public String toString() { return "GETFIELD_B%"; }
2382 }
2383 public static class GETFIELD_C_DYNLINK extends GETFIELD_C {
2384 public static final GETFIELD_C_DYNLINK INSTANCE = new GETFIELD_C_DYNLINK();
2385 private GETFIELD_C_DYNLINK() { }
2386 public void accept(Quad q, QuadVisitor qv) {
2387 qv.visitExceptionThrower(q);
2388 super.accept(q, qv);
2389 }
2390 public UnmodifiableList.jq_Class getThrownExceptions() {
2391 return resolutionexceptions;
2392 }
2393 public boolean hasSideEffects() { return true; }
2394 public String toString() { return "GETFIELD_C%"; }
2395 }
2396 public static class GETFIELD_S_DYNLINK extends GETFIELD_S {
2397 public static final GETFIELD_S_DYNLINK INSTANCE = new GETFIELD_S_DYNLINK();
2398 private GETFIELD_S_DYNLINK() { }
2399 public void accept(Quad q, QuadVisitor qv) {
2400 qv.visitExceptionThrower(q);
2401 super.accept(q, qv);
2402 }
2403 public UnmodifiableList.jq_Class getThrownExceptions() {
2404 return resolutionexceptions;
2405 }
2406 public boolean hasSideEffects() { return true; }
2407 public String toString() { return "GETFIELD_S%"; }
2408 }
2409 public static class GETFIELD_Z_DYNLINK extends GETFIELD_Z {
2410 public static final GETFIELD_Z_DYNLINK INSTANCE = new GETFIELD_Z_DYNLINK();
2411 private GETFIELD_Z_DYNLINK() { }
2412 public void accept(Quad q, QuadVisitor qv) {
2413 qv.visitExceptionThrower(q);
2414 super.accept(q, qv);
2415 }
2416 public UnmodifiableList.jq_Class getThrownExceptions() {
2417 return resolutionexceptions;
2418 }
2419 public boolean hasSideEffects() { return true; }
2420 public String toString() { return "GETFIELD_Z%"; }
2421 }
2422 }
2423
2424 public abstract static class Putfield extends Operator {
2425 public static Quad create(int id, Putfield operator, Operand base, FieldOperand field, Operand src, Operand guard) {
2426 return new Quad(id, operator, base, field, src, guard);
2427 }
2428 public static Operand getBase(Quad q) { return q.getOp1(); }
2429 public static FieldOperand getField(Quad q) { return (FieldOperand)q.getOp2(); }
2430 public static Operand getSrc(Quad q) { return q.getOp3(); }
2431 public static Operand getGuard(Quad q) { return q.getOp4(); }
2432 public static void setBase(Quad q, Operand o) { q.setOp1(o); }
2433 public static void setField(Quad q, FieldOperand o) { q.setOp2(o); }
2434 public static void setSrc(Quad q, Operand o) { q.setOp3(o); }
2435 public static void setGuard(Quad q, Operand o) { q.setOp4(o); }
2436 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1234(q); }
2437 public boolean hasSideEffects() { return true; }
2438
2439 public void accept(Quad q, QuadVisitor qv) {
2440 qv.visitPutfield(q);
2441 qv.visitInstanceField(q);
2442 qv.visitStore(q);
2443 super.accept(q, qv);
2444 }
2445
2446 public static class PUTFIELD_I extends Putfield {
2447 public static final PUTFIELD_I INSTANCE = new PUTFIELD_I();
2448 private PUTFIELD_I() { }
2449 public String toString() { return "PUTFIELD_I"; }
2450 public void interpret(Quad q, QuadInterpreter s) {
2451 Object o = getObjectOpValue(getBase(q), s);
2452 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2453 Reflection.putfield_I(o, f, getIntOpValue(getSrc(q), s));
2454 }
2455 }
2456 public static class PUTFIELD_F extends Putfield {
2457 public static final PUTFIELD_F INSTANCE = new PUTFIELD_F();
2458 private PUTFIELD_F() { }
2459 public String toString() { return "PUTFIELD_F"; }
2460 public void interpret(Quad q, QuadInterpreter s) {
2461 Object o = getObjectOpValue(getBase(q), s);
2462 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2463 Reflection.putfield_F(o, f, getFloatOpValue(getSrc(q), s));
2464 }
2465 }
2466 public static class PUTFIELD_L extends Putfield {
2467 public static final PUTFIELD_L INSTANCE = new PUTFIELD_L();
2468 private PUTFIELD_L() { }
2469 public String toString() { return "PUTFIELD_L"; }
2470 public void interpret(Quad q, QuadInterpreter s) {
2471 Object o = getObjectOpValue(getBase(q), s);
2472 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2473 Reflection.putfield_L(o, f, getLongOpValue(getSrc(q), s));
2474 }
2475 }
2476 public static class PUTFIELD_D extends Putfield {
2477 public static final PUTFIELD_D INSTANCE = new PUTFIELD_D();
2478 private PUTFIELD_D() { }
2479 public String toString() { return "PUTFIELD_D"; }
2480 public void interpret(Quad q, QuadInterpreter s) {
2481 Object o = getObjectOpValue(getBase(q), s);
2482 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2483 Reflection.putfield_D(o, f, getDoubleOpValue(getSrc(q), s));
2484 }
2485 }
2486 public static class PUTFIELD_A extends Putfield {
2487 public static final PUTFIELD_A INSTANCE = new PUTFIELD_A();
2488 private PUTFIELD_A() { }
2489 public String toString() { return "PUTFIELD_A"; }
2490 public void interpret(Quad q, QuadInterpreter s) {
2491 Object o = getObjectOpValue(getBase(q), s);
2492 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2493 Reflection.putfield_A(o, f, getObjectOpValue(getSrc(q), s));
2494 }
2495 }
2496 public static class PUTFIELD_P extends Putfield {
2497 public static final PUTFIELD_P INSTANCE = new PUTFIELD_P();
2498 private PUTFIELD_P() { }
2499 public String toString() { return "PUTFIELD_P"; }
2500 public void interpret(Quad q, QuadInterpreter s) {
2501 Object o = getObjectOpValue(getBase(q), s);
2502 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2503 Reflection.putfield_P(o, f, getAddressOpValue(getSrc(q), s));
2504 }
2505 }
2506 public static class PUTFIELD_B extends Putfield {
2507 public static final PUTFIELD_B INSTANCE = new PUTFIELD_B();
2508 private PUTFIELD_B() { }
2509 public String toString() { return "PUTFIELD_B"; }
2510 public void interpret(Quad q, QuadInterpreter s) {
2511 Object o = getObjectOpValue(getBase(q), s);
2512 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2513 Reflection.putfield_B(o, f, (byte)getIntOpValue(getSrc(q), s));
2514 }
2515 }
2516 public static class PUTFIELD_C extends Putfield {
2517 public static final PUTFIELD_C INSTANCE = new PUTFIELD_C();
2518 private PUTFIELD_C() { }
2519 public String toString() { return "PUTFIELD_C"; }
2520 public void interpret(Quad q, QuadInterpreter s) {
2521 Object o = getObjectOpValue(getBase(q), s);
2522 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2523 Reflection.putfield_C(o, f, (char)getIntOpValue(getSrc(q), s));
2524 }
2525 }
2526 public static class PUTFIELD_S extends Putfield {
2527 public static final PUTFIELD_S INSTANCE = new PUTFIELD_S();
2528 private PUTFIELD_S() { }
2529 public String toString() { return "PUTFIELD_S"; }
2530 public void interpret(Quad q, QuadInterpreter s) {
2531 Object o = getObjectOpValue(getBase(q), s);
2532 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2533 Reflection.putfield_S(o, f, (short)getIntOpValue(getSrc(q), s));
2534 }
2535 }
2536 public static class PUTFIELD_Z extends Putfield {
2537 public static final PUTFIELD_Z INSTANCE = new PUTFIELD_Z();
2538 private PUTFIELD_Z() { }
2539 public String toString() { return "PUTFIELD_Z"; }
2540 public void interpret(Quad q, QuadInterpreter s) {
2541 Object o = getObjectOpValue(getBase(q), s);
2542 jq_InstanceField f = (jq_InstanceField)getField(q).getField();
2543 Reflection.putfield_Z(o, f, getIntOpValue(getSrc(q), s)!=0);
2544 }
2545 }
2546 public static class PUTFIELD_I_DYNLINK extends PUTFIELD_I {
2547 public static final PUTFIELD_I_DYNLINK INSTANCE = new PUTFIELD_I_DYNLINK();
2548 private PUTFIELD_I_DYNLINK() { }
2549 public void accept(Quad q, QuadVisitor qv) {
2550 qv.visitExceptionThrower(q);
2551 super.accept(q, qv);
2552 }
2553 public UnmodifiableList.jq_Class getThrownExceptions() {
2554 return resolutionexceptions;
2555 }
2556 public String toString() { return "PUTFIELD_I%"; }
2557 }
2558 public static class PUTFIELD_F_DYNLINK extends PUTFIELD_F {
2559 public static final PUTFIELD_F_DYNLINK INSTANCE = new PUTFIELD_F_DYNLINK();
2560 private PUTFIELD_F_DYNLINK() { }
2561 public void accept(Quad q, QuadVisitor qv) {
2562 qv.visitExceptionThrower(q);
2563 super.accept(q, qv);
2564 }
2565 public UnmodifiableList.jq_Class getThrownExceptions() {
2566 return resolutionexceptions;
2567 }
2568 public String toString() { return "PUTFIELD_F%"; }
2569 }
2570 public static class PUTFIELD_L_DYNLINK extends PUTFIELD_L {
2571 public static final PUTFIELD_L_DYNLINK INSTANCE = new PUTFIELD_L_DYNLINK();
2572 private PUTFIELD_L_DYNLINK() { }
2573 public void accept(Quad q, QuadVisitor qv) {
2574 qv.visitExceptionThrower(q);
2575 super.accept(q, qv);
2576 }
2577 public UnmodifiableList.jq_Class getThrownExceptions() {
2578 return resolutionexceptions;
2579 }
2580 public String toString() { return "PUTFIELD_L%"; }
2581 }
2582 public static class PUTFIELD_D_DYNLINK extends PUTFIELD_D {
2583 public static final PUTFIELD_D_DYNLINK INSTANCE = new PUTFIELD_D_DYNLINK();
2584 private PUTFIELD_D_DYNLINK() { }
2585 public void accept(Quad q, QuadVisitor qv) {
2586 qv.visitExceptionThrower(q);
2587 super.accept(q, qv);
2588 }
2589 public UnmodifiableList.jq_Class getThrownExceptions() {
2590 return resolutionexceptions;
2591 }
2592 public String toString() { return "PUTFIELD_D%"; }
2593 }
2594 public static class PUTFIELD_A_DYNLINK extends PUTFIELD_A {
2595 public static final PUTFIELD_A_DYNLINK INSTANCE = new PUTFIELD_A_DYNLINK();
2596 private PUTFIELD_A_DYNLINK() { }
2597 public void accept(Quad q, QuadVisitor qv) {
2598 qv.visitExceptionThrower(q);
2599 super.accept(q, qv);
2600 }
2601 public UnmodifiableList.jq_Class getThrownExceptions() {
2602 return resolutionexceptions;
2603 }
2604 public String toString() { return "PUTFIELD_A%"; }
2605 }
2606 public static class PUTFIELD_P_DYNLINK extends PUTFIELD_P {
2607 public static final PUTFIELD_P_DYNLINK INSTANCE = new PUTFIELD_P_DYNLINK();
2608 private PUTFIELD_P_DYNLINK() { }
2609 public void accept(Quad q, QuadVisitor qv) {
2610 qv.visitExceptionThrower(q);
2611 super.accept(q, qv);
2612 }
2613 public UnmodifiableList.jq_Class getThrownExceptions() {
2614 return resolutionexceptions;
2615 }
2616 public String toString() { return "PUTFIELD_P%"; }
2617 }
2618 public static class PUTFIELD_B_DYNLINK extends PUTFIELD_B {
2619 public static final PUTFIELD_B_DYNLINK INSTANCE = new PUTFIELD_B_DYNLINK();
2620 private PUTFIELD_B_DYNLINK() { }
2621 public void accept(Quad q, QuadVisitor qv) {
2622 qv.visitExceptionThrower(q);
2623 super.accept(q, qv);
2624 }
2625 public UnmodifiableList.jq_Class getThrownExceptions() {
2626 return resolutionexceptions;
2627 }
2628 public String toString() { return "PUTFIELD_B%"; }
2629 }
2630 public static class PUTFIELD_C_DYNLINK extends PUTFIELD_C {
2631 public static final PUTFIELD_C_DYNLINK INSTANCE = new PUTFIELD_C_DYNLINK();
2632 private PUTFIELD_C_DYNLINK() { }
2633 public void accept(Quad q, QuadVisitor qv) {
2634 qv.visitExceptionThrower(q);
2635 super.accept(q, qv);
2636 }
2637 public UnmodifiableList.jq_Class getThrownExceptions() {
2638 return resolutionexceptions;
2639 }
2640 public String toString() { return "PUTFIELD_C%"; }
2641 }
2642 public static class PUTFIELD_S_DYNLINK extends PUTFIELD_S {
2643 public static final PUTFIELD_S_DYNLINK INSTANCE = new PUTFIELD_S_DYNLINK();
2644 private PUTFIELD_S_DYNLINK() { }
2645 public void accept(Quad q, QuadVisitor qv) {
2646 qv.visitExceptionThrower(q);
2647 super.accept(q, qv);
2648 }
2649 public UnmodifiableList.jq_Class getThrownExceptions() {
2650 return resolutionexceptions;
2651 }
2652 public String toString() { return "PUTFIELD_S%"; }
2653 }
2654 public static class PUTFIELD_Z_DYNLINK extends PUTFIELD_Z {
2655 public static final PUTFIELD_Z_DYNLINK INSTANCE = new PUTFIELD_Z_DYNLINK();
2656 private PUTFIELD_Z_DYNLINK() { }
2657 public void accept(Quad q, QuadVisitor qv) {
2658 qv.visitExceptionThrower(q);
2659 super.accept(q, qv);
2660 }
2661 public UnmodifiableList.jq_Class getThrownExceptions() {
2662 return resolutionexceptions;
2663 }
2664 public String toString() { return "PUTFIELD_Z%"; }
2665 }
2666 }
2667
2668 public abstract static class NullCheck extends Operator {
2669 public static Quad create(int id, NullCheck operator, Operand dst, Operand src) {
2670 return new Quad(id, operator, dst, src);
2671 }
2672 public static Operand getDest(Quad q) { return q.getOp1(); }
2673 public static Operand getSrc(Quad q) { return q.getOp2(); }
2674 public static void setDest(Quad q, Operand o) { q.setOp1(o); }
2675 public static void setSrc(Quad q, Operand o) { q.setOp2(o); }
2676 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1_check(q); }
2677 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
2678 public boolean hasSideEffects() { return true; }
2679
2680 public void accept(Quad q, QuadVisitor qv) {
2681 qv.visitNullCheck(q);
2682 qv.visitCheck(q);
2683 qv.visitExceptionThrower(q);
2684 super.accept(q, qv);
2685 }
2686 public UnmodifiableList.jq_Class getThrownExceptions() {
2687 return nullptrexception;
2688 }
2689
2690 public static class NULL_CHECK extends NullCheck {
2691 public static final NULL_CHECK INSTANCE = new NULL_CHECK();
2692 private NULL_CHECK() { }
2693 public String toString() { return "NULL_CHECK"; }
2694 public void interpret(Quad q, QuadInterpreter s) {
2695 if (getObjectOpValue(getSrc(q), s) == null) {
2696 s.handleException(new NullPointerException(s.currentLocation()));
2697 }
2698 }
2699 }
2700 }
2701
2702 public abstract static class ZeroCheck extends Operator {
2703 public static Quad create(int id, ZeroCheck operator, Operand dst, Operand src) {
2704 return new Quad(id, operator, dst, src);
2705 }
2706 public static Operand getDest(Quad q) { return q.getOp1(); }
2707 public static Operand getSrc(Quad q) { return q.getOp2(); }
2708 public static void setDest(Quad q, Operand o) { q.setOp1(o); }
2709 public static void setSrc(Quad q, Operand o) { q.setOp2(o); }
2710 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1_check(q); }
2711 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
2712 public boolean hasSideEffects() { return true; }
2713
2714 public void accept(Quad q, QuadVisitor qv) {
2715 qv.visitZeroCheck(q);
2716 qv.visitCheck(q);
2717 qv.visitExceptionThrower(q);
2718 super.accept(q, qv);
2719 }
2720 public UnmodifiableList.jq_Class getThrownExceptions() {
2721 return arithexception;
2722 }
2723
2724 public static class ZERO_CHECK_I extends ZeroCheck {
2725 public static final ZERO_CHECK_I INSTANCE = new ZERO_CHECK_I();
2726 private ZERO_CHECK_I() { }
2727 public String toString() { return "ZERO_CHECK_I"; }
2728 public void interpret(Quad q, QuadInterpreter s) {
2729 if (getIntOpValue(getSrc(q), s) == 0) {
2730 s.handleException(new ArithmeticException(s.currentLocation()));
2731 }
2732 }
2733 }
2734
2735 public static class ZERO_CHECK_L extends ZeroCheck {
2736 public static final ZERO_CHECK_L INSTANCE = new ZERO_CHECK_L();
2737 private ZERO_CHECK_L() { }
2738 public String toString() { return "ZERO_CHECK_L"; }
2739 public void interpret(Quad q, QuadInterpreter s) {
2740 if (getLongOpValue(getSrc(q), s) == 0L) {
2741 s.handleException(new ArithmeticException(s.currentLocation()));
2742 }
2743 }
2744 }
2745 }
2746
2747 public abstract static class BoundsCheck extends Operator {
2748 public static Quad create(int id, BoundsCheck operator, Operand ref, Operand idx, Operand guard) {
2749 return new Quad(id, operator, ref, idx, guard);
2750 }
2751 public static Operand getRef(Quad q) { return q.getOp1(); }
2752 public static Operand getIndex(Quad q) { return q.getOp2(); }
2753 public static Operand getGuard(Quad q) { return q.getOp3(); }
2754 public static void setRef(Quad q, Operand o) { q.setOp1(o); }
2755 public static void setIndex(Quad q, Operand o) { q.setOp2(o); }
2756 public static void setGuard(Quad q, Operand o) { q.setOp3(o); }
2757 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg3(q); }
2758 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg123(q); }
2759 public boolean hasSideEffects() { return true; }
2760
2761 public void accept(Quad q, QuadVisitor qv) {
2762 qv.visitBoundsCheck(q);
2763 qv.visitCheck(q);
2764 qv.visitExceptionThrower(q);
2765 super.accept(q, qv);
2766 }
2767 public UnmodifiableList.jq_Class getThrownExceptions() {
2768 return arrayboundsexception;
2769 }
2770
2771 public static class BOUNDS_CHECK extends BoundsCheck {
2772 public static final BOUNDS_CHECK INSTANCE = new BOUNDS_CHECK();
2773 private BOUNDS_CHECK() { }
2774 public String toString() { return "BOUNDS_CHECK"; }
2775 public void interpret(Quad q, QuadInterpreter s) {
2776 int i = getIntOpValue(getIndex(q), s);
2777 Object o = getObjectOpValue(getRef(q), s);
2778 int length = Reflection.arraylength(o);
2779 if (i < 0 || i >= length) {
2780 s.handleException(new ArrayIndexOutOfBoundsException(s.currentLocation()+" index: "+i+", length: "+length));
2781 }
2782 }
2783 }
2784 }
2785
2786 public abstract static class StoreCheck extends Operator {
2787 public static Quad create(int id, StoreCheck operator, Operand ref, Operand elem, Operand guard) {
2788 return new Quad(id, operator, ref, elem, guard);
2789 }
2790 public static Operand getRef(Quad q) { return q.getOp1(); }
2791 public static Operand getElement(Quad q) { return q.getOp2(); }
2792 public static Operand getGuard(Quad q) { return q.getOp3(); }
2793 public static void setRef(Quad q, Operand o) { q.setOp1(o); }
2794 public static void setElement(Quad q, Operand o) { q.setOp2(o); }
2795 public static void setGuard(Quad q, Operand o) { q.setOp3(o); }
2796 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg3(q); }
2797 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg123(q); }
2798 public boolean hasSideEffects() { return true; }
2799
2800 public void accept(Quad q, QuadVisitor qv) {
2801 qv.visitStoreCheck(q);
2802 qv.visitTypeCheck(q);
2803 qv.visitCheck(q);
2804 qv.visitExceptionThrower(q);
2805 super.accept(q, qv);
2806 }
2807 public UnmodifiableList.jq_Class getThrownExceptions() {
2808 return arraystoreexception;
2809 }
2810
2811 public static class ASTORE_CHECK extends StoreCheck {
2812 public static final ASTORE_CHECK INSTANCE = new ASTORE_CHECK();
2813 private ASTORE_CHECK() { }
2814 public String toString() { return "ASTORE_CHECK"; }
2815 public void interpret(Quad q, QuadInterpreter s) {
2816 Object[] o = (Object[])getObjectOpValue(getRef(q), s);
2817 Object e = getObjectOpValue(getElement(q), s);
2818 if (e == null) return;
2819 jq_Reference t = Reflection.getTypeOf(e);
2820 t.cls_initialize();
2821 jq_Array a = (jq_Array)Reflection.getTypeOf(o);
2822 jq_Type t2 = a.getElementType();
2823 if (!TypeCheck.isAssignable(t, t2))
2824 s.handleException(new ArrayStoreException(t+" into array "+a));
2825 }
2826 }
2827 }
2828
2829 public abstract static class Invoke extends Operator {
2830 public static Quad create(int id, Invoke operator, RegisterOperand res, MethodOperand m, int length) {
2831 return new Quad(id, operator, res, m, new ParamListOperand(new RegisterOperand[length]));
2832 }
2833 public static void setParam(Quad q, int i, RegisterOperand t) {
2834 ((ParamListOperand)q.getOp3()).set(i, t);
2835 }
2836 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
2837 public static MethodOperand getMethod(Quad q) { return (MethodOperand)q.getOp2(); }
2838 public static RegisterOperand getParam(Quad q, int i) { return ((ParamListOperand)q.getOp3()).get(i); }
2839 public static ParamListOperand getParamList(Quad q) { return (ParamListOperand)q.getOp3(); }
2840 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
2841 public static void setMethod(Quad q, MethodOperand o) { q.setOp2(o); }
2842 public static void setParamList(Quad q, ParamListOperand o) { q.setOp3(o); }
2843 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) {
2844 ParamListOperand plo = getParamList(q);
2845 RegisterOperand[] a = new RegisterOperand[plo.length()];
2846 for (int i=0; i<a.length; ++i) a[i] = plo.get(i);
2847 return new UnmodifiableList.RegisterOperand(a);
2848 }
2849
2850 public abstract boolean isVirtual();
2851 public abstract byte getType();
2852 public abstract jq_Type getReturnType();
2853
2854 public void accept(Quad q, QuadVisitor qv) {
2855 qv.visitInvoke(q);
2856 qv.visitExceptionThrower(q);
2857 super.accept(q, qv);
2858 }
2859 public UnmodifiableList.jq_Class getThrownExceptions() {
2860 return anyexception;
2861 }
2862 public boolean hasSideEffects() { return true; }
2863
2864 public void interpret_virtual(Quad q, QuadInterpreter s) {
2865 ParamListOperand plo = getParamList(q);
2866 jq_Method f = getMethod(q).getMethod();
2867 jq_Reference t = Reflection.getTypeOf(s.getReg_A(plo.get(0).getRegister()));
2868 t.cls_initialize();
2869 f = t.getVirtualMethod(f.getNameAndDesc());
2870 if ((f == null) || f.isAbstract()) {
2871 s.handleException(new AbstractMethodError(s.currentLocation()));
2872 return;
2873 }
2874 QuadInterpreter result = s.invokeMethod(f, plo);
2875 if (result.getThrown() != null)
2876 s.handleException(result.getThrown());
2877 else if (getDest(q) != null) {
2878 Object r = result.getReturnValue();
2879 if (f.getReturnType() == jq_Primitive.BOOLEAN && r instanceof Boolean) r = new Integer(((Boolean)r).booleanValue()?1:0);
2880 else if (f.getReturnType() == jq_Primitive.CHAR && r instanceof Character) r = new Integer(((Character)r).charValue());
2881 s.putReg(getDest(q).getRegister(), r);
2882 }
2883 }
2884
2885 public void interpret_static(Quad q, QuadInterpreter s) {
2886 ParamListOperand plo = getParamList(q);
2887 jq_Method f = getMethod(q).getMethod();
2888 QuadInterpreter result = s.invokeMethod(f, plo);
2889 if (result.getThrown() != null)
2890 s.handleException(result.getThrown());
2891 else if (getDest(q) != null) {
2892 Object r = result.getReturnValue();
2893 if (f.getReturnType() == jq_Primitive.BOOLEAN && r instanceof Boolean) r = new Integer(((Boolean)r).booleanValue()?1:0);
2894 else if (f.getReturnType() == jq_Primitive.CHAR && r instanceof Character) r = new Integer(((Character)r).charValue());
2895 s.putReg(getDest(q).getRegister(), r);
2896 }
2897 }
2898
2899 public abstract static class InvokeVirtual extends Invoke {
2900 public boolean isVirtual() { return true; }
2901 public void interpret(Quad q, QuadInterpreter s) { interpret_virtual(q, s); }
2902 public byte getType() { return BytecodeVisitor.INVOKE_VIRTUAL; }
2903 }
2904 public abstract static class InvokeStatic extends Invoke {
2905 public boolean isVirtual() { return false; }
2906 public void interpret(Quad q, QuadInterpreter s) { interpret_static(q, s); }
2907 public byte getType() { return BytecodeVisitor.INVOKE_STATIC; }
2908 }
2909 public abstract static class InvokeInterface extends Invoke {
2910 public boolean isVirtual() { return true; }
2911 public void interpret(Quad q, QuadInterpreter s) { interpret_virtual(q, s); }
2912 public byte getType() { return BytecodeVisitor.INVOKE_INTERFACE; }
2913 }
2914 public static class INVOKEVIRTUAL_V extends InvokeVirtual {
2915 public static final INVOKEVIRTUAL_V INSTANCE = new INVOKEVIRTUAL_V();
2916 private INVOKEVIRTUAL_V() { }
2917 public String toString() { return "INVOKEVIRTUAL_V"; }
2918 public jq_Type getReturnType() { return jq_Primitive.VOID; }
2919 }
2920 public static class INVOKEVIRTUAL_I extends InvokeVirtual {
2921 public static final INVOKEVIRTUAL_I INSTANCE = new INVOKEVIRTUAL_I();
2922 private INVOKEVIRTUAL_I() { }
2923 public String toString() { return "INVOKEVIRTUAL_I"; }
2924 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
2925 public jq_Type getReturnType() { return jq_Primitive.INT; }
2926 }
2927 public static class INVOKEVIRTUAL_F extends InvokeVirtual {
2928 public static final INVOKEVIRTUAL_F INSTANCE = new INVOKEVIRTUAL_F();
2929 private INVOKEVIRTUAL_F() { }
2930 public String toString() { return "INVOKEVIRTUAL_F"; }
2931 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
2932 public jq_Type getReturnType() { return jq_Primitive.FLOAT; }
2933 }
2934 public static class INVOKEVIRTUAL_L extends InvokeVirtual {
2935 public static final INVOKEVIRTUAL_L INSTANCE = new INVOKEVIRTUAL_L();
2936 private INVOKEVIRTUAL_L() { }
2937 public String toString() { return "INVOKEVIRTUAL_L"; }
2938 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
2939 public jq_Type getReturnType() { return jq_Primitive.LONG; }
2940 }
2941 public static class INVOKEVIRTUAL_D extends InvokeVirtual {
2942 public static final INVOKEVIRTUAL_D INSTANCE = new INVOKEVIRTUAL_D();
2943 private INVOKEVIRTUAL_D() { }
2944 public String toString() { return "INVOKEVIRTUAL_D"; }
2945 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
2946 public jq_Type getReturnType() { return jq_Primitive.DOUBLE; }
2947 }
2948 public static class INVOKEVIRTUAL_A extends InvokeVirtual {
2949 public static final INVOKEVIRTUAL_A INSTANCE = new INVOKEVIRTUAL_A();
2950 private INVOKEVIRTUAL_A() { }
2951 public String toString() { return "INVOKEVIRTUAL_A"; }
2952 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
2953 public jq_Type getReturnType() { return PrimordialClassLoader.getJavaLangObject(); }
2954 }
2955 public static class INVOKEVIRTUAL_P extends InvokeVirtual {
2956 public static final INVOKEVIRTUAL_P INSTANCE = new INVOKEVIRTUAL_P();
2957 private INVOKEVIRTUAL_P() { }
2958 public String toString() { return "INVOKEVIRTUAL_P"; }
2959 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
2960 public jq_Type getReturnType() { return Address._class; }
2961 }
2962 public static class INVOKESTATIC_V extends InvokeStatic {
2963 public static final INVOKESTATIC_V INSTANCE = new INVOKESTATIC_V();
2964 private INVOKESTATIC_V() { }
2965 public String toString() { return "INVOKESTATIC_V"; }
2966 public jq_Type getReturnType() { return jq_Primitive.VOID; }
2967 }
2968 public static class INVOKESTATIC_I extends InvokeStatic {
2969 public static final INVOKESTATIC_I INSTANCE = new INVOKESTATIC_I();
2970 private INVOKESTATIC_I() { }
2971 public String toString() { return "INVOKESTATIC_I"; }
2972 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
2973 public jq_Type getReturnType() { return jq_Primitive.INT; }
2974 }
2975 public static class INVOKESTATIC_F extends InvokeStatic {
2976 public static final INVOKESTATIC_F INSTANCE = new INVOKESTATIC_F();
2977 private INVOKESTATIC_F() { }
2978 public String toString() { return "INVOKESTATIC_F"; }
2979 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
2980 public jq_Type getReturnType() { return jq_Primitive.FLOAT; }
2981 }
2982 public static class INVOKESTATIC_L extends InvokeStatic {
2983 public static final INVOKESTATIC_L INSTANCE = new INVOKESTATIC_L();
2984 private INVOKESTATIC_L() { }
2985 public String toString() { return "INVOKESTATIC_L"; }
2986 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
2987 public jq_Type getReturnType() { return jq_Primitive.LONG; }
2988 }
2989 public static class INVOKESTATIC_D extends InvokeStatic {
2990 public static final INVOKESTATIC_D INSTANCE = new INVOKESTATIC_D();
2991 private INVOKESTATIC_D() { }
2992 public String toString() { return "INVOKESTATIC_D"; }
2993 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
2994 public jq_Type getReturnType() { return jq_Primitive.DOUBLE; }
2995 }
2996 public static class INVOKESTATIC_A extends InvokeStatic {
2997 public static final INVOKESTATIC_A INSTANCE = new INVOKESTATIC_A();
2998 private INVOKESTATIC_A() { }
2999 public String toString() { return "INVOKESTATIC_A"; }
3000 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3001 public jq_Type getReturnType() { return PrimordialClassLoader.getJavaLangObject(); }
3002 }
3003 public static class INVOKESTATIC_P extends InvokeStatic {
3004 public static final INVOKESTATIC_P INSTANCE = new INVOKESTATIC_P();
3005 private INVOKESTATIC_P() { }
3006 public String toString() { return "INVOKESTATIC_P"; }
3007 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3008 public jq_Type getReturnType() { return Address._class; }
3009 }
3010 public static class INVOKEVIRTUAL_V_DYNLINK extends INVOKEVIRTUAL_V {
3011 public static final INVOKEVIRTUAL_V_DYNLINK INSTANCE = new INVOKEVIRTUAL_V_DYNLINK();
3012 private INVOKEVIRTUAL_V_DYNLINK() { }
3013 public String toString() { return "INVOKEVIRTUAL_V%"; }
3014 }
3015 public static class INVOKEVIRTUAL_I_DYNLINK extends INVOKEVIRTUAL_I {
3016 public static final INVOKEVIRTUAL_I_DYNLINK INSTANCE = new INVOKEVIRTUAL_I_DYNLINK();
3017 private INVOKEVIRTUAL_I_DYNLINK() { }
3018 public String toString() { return "INVOKEVIRTUAL_I%"; }
3019 }
3020 public static class INVOKEVIRTUAL_F_DYNLINK extends INVOKEVIRTUAL_F {
3021 public static final INVOKEVIRTUAL_F_DYNLINK INSTANCE = new INVOKEVIRTUAL_F_DYNLINK();
3022 private INVOKEVIRTUAL_F_DYNLINK() { }
3023 public String toString() { return "INVOKEVIRTUAL_F%"; }
3024 }
3025 public static class INVOKEVIRTUAL_L_DYNLINK extends INVOKEVIRTUAL_L {
3026 public static final INVOKEVIRTUAL_L_DYNLINK INSTANCE = new INVOKEVIRTUAL_L_DYNLINK();
3027 private INVOKEVIRTUAL_L_DYNLINK() { }
3028 public String toString() { return "INVOKEVIRTUAL_L%"; }
3029 }
3030 public static class INVOKEVIRTUAL_D_DYNLINK extends INVOKEVIRTUAL_D {
3031 public static final INVOKEVIRTUAL_D_DYNLINK INSTANCE = new INVOKEVIRTUAL_D_DYNLINK();
3032 private INVOKEVIRTUAL_D_DYNLINK() { }
3033 public String toString() { return "INVOKEVIRTUAL_D%"; }
3034 }
3035 public static class INVOKEVIRTUAL_A_DYNLINK extends INVOKEVIRTUAL_A {
3036 public static final INVOKEVIRTUAL_A_DYNLINK INSTANCE = new INVOKEVIRTUAL_A_DYNLINK();
3037 private INVOKEVIRTUAL_A_DYNLINK() { }
3038 public String toString() { return "INVOKEVIRTUAL_A%"; }
3039 }
3040 public static class INVOKEVIRTUAL_P_DYNLINK extends INVOKEVIRTUAL_P {
3041 public static final INVOKEVIRTUAL_P_DYNLINK INSTANCE = new INVOKEVIRTUAL_P_DYNLINK();
3042 private INVOKEVIRTUAL_P_DYNLINK() { }
3043 public String toString() { return "INVOKEVIRTUAL_P%"; }
3044 }
3045 public static class INVOKESTATIC_V_DYNLINK extends INVOKESTATIC_V {
3046 public static final INVOKESTATIC_V_DYNLINK INSTANCE = new INVOKESTATIC_V_DYNLINK();
3047 private INVOKESTATIC_V_DYNLINK() { }
3048 public String toString() { return "INVOKESTATIC_V%"; }
3049 }
3050 public static class INVOKESTATIC_I_DYNLINK extends INVOKESTATIC_I {
3051 public static final INVOKESTATIC_I_DYNLINK INSTANCE = new INVOKESTATIC_I_DYNLINK();
3052 private INVOKESTATIC_I_DYNLINK() { }
3053 public String toString() { return "INVOKESTATIC_I%"; }
3054 }
3055 public static class INVOKESTATIC_F_DYNLINK extends INVOKESTATIC_F {
3056 public static final INVOKESTATIC_F_DYNLINK INSTANCE = new INVOKESTATIC_F_DYNLINK();
3057 private INVOKESTATIC_F_DYNLINK() { }
3058 public String toString() { return "INVOKESTATIC_F%"; }
3059 }
3060 public static class INVOKESTATIC_L_DYNLINK extends INVOKESTATIC_L {
3061 public static final INVOKESTATIC_L_DYNLINK INSTANCE = new INVOKESTATIC_L_DYNLINK();
3062 private INVOKESTATIC_L_DYNLINK() { }
3063 public String toString() { return "INVOKESTATIC_L%"; }
3064 }
3065 public static class INVOKESTATIC_D_DYNLINK extends INVOKESTATIC_D {
3066 public static final INVOKESTATIC_D_DYNLINK INSTANCE = new INVOKESTATIC_D_DYNLINK();
3067 private INVOKESTATIC_D_DYNLINK() { }
3068 public String toString() { return "INVOKESTATIC_D%"; }
3069 }
3070 public static class INVOKESTATIC_A_DYNLINK extends INVOKESTATIC_A {
3071 public static final INVOKESTATIC_A_DYNLINK INSTANCE = new INVOKESTATIC_A_DYNLINK();
3072 private INVOKESTATIC_A_DYNLINK() { }
3073 public String toString() { return "INVOKESTATIC_A%"; }
3074 }
3075 public static class INVOKESTATIC_P_DYNLINK extends INVOKESTATIC_P {
3076 public static final INVOKESTATIC_P_DYNLINK INSTANCE = new INVOKESTATIC_P_DYNLINK();
3077 private INVOKESTATIC_P_DYNLINK() { }
3078 public String toString() { return "INVOKESTATIC_P%"; }
3079 }
3080 public static class INVOKESPECIAL_V_DYNLINK extends INVOKESTATIC_V {
3081 public static final INVOKESPECIAL_V_DYNLINK INSTANCE = new INVOKESPECIAL_V_DYNLINK();
3082 private INVOKESPECIAL_V_DYNLINK() { }
3083 public String toString() { return "INVOKESPECIAL_V%"; }
3084 }
3085 public static class INVOKESPECIAL_I_DYNLINK extends INVOKESTATIC_I {
3086 public static final INVOKESPECIAL_I_DYNLINK INSTANCE = new INVOKESPECIAL_I_DYNLINK();
3087 private INVOKESPECIAL_I_DYNLINK() { }
3088 public String toString() { return "INVOKESPECIAL_I%"; }
3089 }
3090 public static class INVOKESPECIAL_F_DYNLINK extends INVOKESTATIC_F {
3091 public static final INVOKESPECIAL_F_DYNLINK INSTANCE = new INVOKESPECIAL_F_DYNLINK();
3092 private INVOKESPECIAL_F_DYNLINK() { }
3093 public String toString() { return "INVOKESPECIAL_F%"; }
3094 }
3095 public static class INVOKESPECIAL_L_DYNLINK extends INVOKESTATIC_L {
3096 public static final INVOKESPECIAL_L_DYNLINK INSTANCE = new INVOKESPECIAL_L_DYNLINK();
3097 private INVOKESPECIAL_L_DYNLINK() { }
3098 public String toString() { return "INVOKESPECIAL_L%"; }
3099 }
3100 public static class INVOKESPECIAL_D_DYNLINK extends INVOKESTATIC_D {
3101 public static final INVOKESPECIAL_D_DYNLINK INSTANCE = new INVOKESPECIAL_D_DYNLINK();
3102 private INVOKESPECIAL_D_DYNLINK() { }
3103 public String toString() { return "INVOKESPECIAL_D%"; }
3104 }
3105 public static class INVOKESPECIAL_A_DYNLINK extends INVOKESTATIC_A {
3106 public static final INVOKESPECIAL_A_DYNLINK INSTANCE = new INVOKESPECIAL_A_DYNLINK();
3107 private INVOKESPECIAL_A_DYNLINK() { }
3108 public String toString() { return "INVOKESPECIAL_A%"; }
3109 }
3110 public static class INVOKESPECIAL_P_DYNLINK extends INVOKESTATIC_P {
3111 public static final INVOKESPECIAL_P_DYNLINK INSTANCE = new INVOKESPECIAL_P_DYNLINK();
3112 private INVOKESPECIAL_P_DYNLINK() { }
3113 public String toString() { return "INVOKESPECIAL_P%"; }
3114 }
3115 public static class INVOKEINTERFACE_V extends InvokeInterface {
3116 public static final INVOKEINTERFACE_V INSTANCE = new INVOKEINTERFACE_V();
3117 private INVOKEINTERFACE_V() { }
3118 public String toString() { return "INVOKEINTERFACE_V"; }
3119 public jq_Type getReturnType() { return jq_Primitive.VOID; }
3120 }
3121 public static class INVOKEINTERFACE_I extends InvokeInterface {
3122 public static final INVOKEINTERFACE_I INSTANCE = new INVOKEINTERFACE_I();
3123 private INVOKEINTERFACE_I() { }
3124 public String toString() { return "INVOKEINTERFACE_I"; }
3125 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3126 public jq_Type getReturnType() { return jq_Primitive.INT; }
3127 }
3128 public static class INVOKEINTERFACE_F extends InvokeInterface {
3129 public static final INVOKEINTERFACE_F INSTANCE = new INVOKEINTERFACE_F();
3130 private INVOKEINTERFACE_F() { }
3131 public String toString() { return "INVOKEINTERFACE_F"; }
3132 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3133 public jq_Type getReturnType() { return jq_Primitive.FLOAT; }
3134 }
3135 public static class INVOKEINTERFACE_L extends InvokeInterface {
3136 public static final INVOKEINTERFACE_L INSTANCE = new INVOKEINTERFACE_L();
3137 private INVOKEINTERFACE_L() { }
3138 public String toString() { return "INVOKEINTERFACE_L"; }
3139 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3140 public jq_Type getReturnType() { return jq_Primitive.LONG; }
3141 }
3142 public static class INVOKEINTERFACE_D extends InvokeInterface {
3143 public static final INVOKEINTERFACE_D INSTANCE = new INVOKEINTERFACE_D();
3144 private INVOKEINTERFACE_D() { }
3145 public String toString() { return "INVOKEINTERFACE_D"; }
3146 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3147 public jq_Type getReturnType() { return jq_Primitive.DOUBLE; }
3148 }
3149 public static class INVOKEINTERFACE_A extends InvokeInterface {
3150 public static final INVOKEINTERFACE_A INSTANCE = new INVOKEINTERFACE_A();
3151 private INVOKEINTERFACE_A() { }
3152 public String toString() { return "INVOKEINTERFACE_A"; }
3153 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3154 public jq_Type getReturnType() { return PrimordialClassLoader.getJavaLangObject(); }
3155 }
3156 public static class INVOKEINTERFACE_P extends InvokeInterface {
3157 public static final INVOKEINTERFACE_P INSTANCE = new INVOKEINTERFACE_P();
3158 private INVOKEINTERFACE_P() { }
3159 public String toString() { return "INVOKEINTERFACE_P"; }
3160 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3161 public jq_Type getReturnType() { return Address._class; }
3162 }
3163 }
3164
3165 public abstract static class New extends Operator {
3166 public static Quad create(int id, New operator, RegisterOperand res, TypeOperand type) {
3167 return new Quad(id, operator, res, type);
3168 }
3169 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
3170 public static TypeOperand getType(Quad q) { return (TypeOperand)q.getOp2(); }
3171 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
3172 public static void setType(Quad q, TypeOperand o) { q.setOp2(o); }
3173 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3174 public boolean hasSideEffects() { return true; }
3175
3176 public void accept(Quad q, QuadVisitor qv) {
3177 qv.visitNew(q);
3178 qv.visitAllocation(q);
3179 super.accept(q, qv);
3180 }
3181
3182 public static class NEW extends New {
3183 public static final NEW INSTANCE = new NEW();
3184 private NEW() { }
3185 public String toString() { return "NEW"; }
3186 public void interpret(Quad q, QuadInterpreter s) {
3187 s.putReg_A(getDest(q).getRegister(), new UninitializedReference((jq_Class)getType(q).getType()));
3188 }
3189 }
3190 public static class NEW_DYNLINK extends NEW {
3191 public static final NEW_DYNLINK INSTANCE = new NEW_DYNLINK();
3192 private NEW_DYNLINK() { }
3193 public String toString() { return "NEW%"; }
3194 }
3195 }
3196
3197 public abstract static class NewArray extends Operator {
3198 public static Quad create(int id, NewArray operator, RegisterOperand res, Operand size, TypeOperand type) {
3199 return new Quad(id, operator, res, size, type);
3200 }
3201 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
3202 public static Operand getSize(Quad q) { return q.getOp2(); }
3203 public static TypeOperand getType(Quad q) { return (TypeOperand)q.getOp3(); }
3204 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
3205 public static void setSize(Quad q, Operand o) { q.setOp2(o); }
3206 public static void setType(Quad q, TypeOperand o) { q.setOp3(o); }
3207 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3208 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3209 public boolean hasSideEffects() { return true; }
3210
3211 public void accept(Quad q, QuadVisitor qv) {
3212 qv.visitNewArray(q);
3213 qv.visitAllocation(q);
3214 qv.visitExceptionThrower(q);
3215 super.accept(q, qv);
3216 }
3217 public UnmodifiableList.jq_Class getThrownExceptions() {
3218 return negativesizeexception;
3219 }
3220
3221 public static class NEWARRAY extends NewArray {
3222 public static final NEWARRAY INSTANCE = new NEWARRAY();
3223 private NEWARRAY() { }
3224 public String toString() { return "NEWARRAY"; }
3225 public void interpret(Quad q, QuadInterpreter s) {
3226 jq_Type t = getType(q).getType();
3227 int v = getIntOpValue(getSize(q), s);
3228 Object o = java.lang.reflect.Array.newInstance(Reflection.getJDKType(((jq_Array)t).getElementType()), v);
3229 s.putReg_A(getDest(q).getRegister(), o);
3230 }
3231 }
3232 }
3233
3234 public abstract static class CheckCast extends Operator {
3235 public static Quad create(int id, CheckCast operator, RegisterOperand res, Operand val, TypeOperand type) {
3236 return new Quad(id, operator, res, val, type);
3237 }
3238 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
3239 public static Operand getSrc(Quad q) { return q.getOp2(); }
3240 public static TypeOperand getType(Quad q) { return (TypeOperand)q.getOp3(); }
3241 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
3242 public static void setSrc(Quad q, Operand o) { q.setOp2(o); }
3243 public static void setType(Quad q, TypeOperand o) { q.setOp3(o); }
3244 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3245 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3246 public boolean hasSideEffects() { return true; }
3247
3248 public void accept(Quad q, QuadVisitor qv) {
3249 qv.visitCheckCast(q);
3250 qv.visitTypeCheck(q);
3251 qv.visitCheck(q);
3252 qv.visitExceptionThrower(q);
3253 super.accept(q, qv);
3254 }
3255 public UnmodifiableList.jq_Class getThrownExceptions() {
3256 return classcastexceptions;
3257 }
3258
3259 public static class CHECKCAST extends CheckCast {
3260 public static final CHECKCAST INSTANCE = new CHECKCAST();
3261 private CHECKCAST() { }
3262 public String toString() { return "CHECKCAST"; }
3263 public void interpret(Quad q, QuadInterpreter s) {
3264 jq_Type t = getType(q).getType();
3265 Assert._assert(!t.isAddressType());
3266 Object o = getObjectOpValue(getSrc(q), s);
3267 if (o != null) {
3268 jq_Type t2 = Reflection.getTypeOf(o);
3269 t2.cls_initialize();
3270 if (!TypeCheck.isAssignable(t2, t)) {
3271 s.handleException(new ClassCastException(t2+" cannot be cast into "+t));
3272 return;
3273 }
3274 }
3275 s.putReg_A(getDest(q).getRegister(), o);
3276 }
3277 }
3278 }
3279
3280 public abstract static class InstanceOf extends Operator {
3281 public static Quad create(int id, InstanceOf operator, RegisterOperand res, Operand val, TypeOperand type) {
3282 return new Quad(id, operator, res, val, type);
3283 }
3284 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
3285 public static Operand getSrc(Quad q) { return q.getOp2(); }
3286 public static TypeOperand getType(Quad q) { return (TypeOperand)q.getOp3(); }
3287 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
3288 public static void setSrc(Quad q, Operand o) { q.setOp2(o); }
3289 public static void setType(Quad q, TypeOperand o) { q.setOp3(o); }
3290 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3291 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3292 public boolean hasSideEffects() { return true; }
3293
3294 public void accept(Quad q, QuadVisitor qv) {
3295 qv.visitInstanceOf(q);
3296 qv.visitTypeCheck(q);
3297 qv.visitExceptionThrower(q);
3298 super.accept(q, qv);
3299 }
3300 public UnmodifiableList.jq_Class getThrownExceptions() {
3301 return resolutionexceptions;
3302 }
3303
3304 public static class INSTANCEOF extends InstanceOf {
3305 public static final INSTANCEOF INSTANCE = new INSTANCEOF();
3306 private INSTANCEOF() { }
3307 public String toString() { return "INSTANCEOF"; }
3308 public void interpret(Quad q, QuadInterpreter s) {
3309 jq_Type t = getType(q).getType();
3310 Assert._assert(!t.isAddressType());
3311 Object o = getObjectOpValue(getSrc(q), s);
3312 int v;
3313 if (o == null) v = 0;
3314 else v = Reflection.getJDKType(t).isAssignableFrom(o.getClass())?1:0;
3315 s.putReg_I(getDest(q).getRegister(), v);
3316 }
3317 }
3318 }
3319
3320 public abstract static class ALength extends Operator {
3321 public static Quad create(int id, ALength operator, RegisterOperand res, Operand val) {
3322 return new Quad(id, operator, res, val);
3323 }
3324 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
3325 public static Operand getSrc(Quad q) { return q.getOp2(); }
3326 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
3327 public static void setSrc(Quad q, Operand o) { q.setOp2(o); }
3328 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3329 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3330 public boolean hasSideEffects() { return false; }
3331
3332 public void accept(Quad q, QuadVisitor qv) {
3333 qv.visitALength(q);
3334 qv.visitArray(q);
3335 super.accept(q, qv);
3336 }
3337
3338 public static class ARRAYLENGTH extends ALength {
3339 public static final ARRAYLENGTH INSTANCE = new ARRAYLENGTH();
3340 private ARRAYLENGTH() { }
3341 public String toString() { return "ARRAYLENGTH"; }
3342 public void interpret(Quad q, QuadInterpreter s) {
3343 Object o = getObjectOpValue(getSrc(q), s);
3344 int v = Reflection.arraylength(o);
3345 s.putReg_I(getDest(q).getRegister(), v);
3346 }
3347 }
3348 }
3349
3350 public abstract static class Monitor extends Operator {
3351 public static Quad create(int id, Monitor operator, Operand val) {
3352 return new Quad(id, operator, null, val);
3353 }
3354 public static Operand getSrc(Quad q) { return q.getOp2(); }
3355 public static void setSrc(Quad q, Operand o) { q.setOp2(o); }
3356 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3357 public boolean hasSideEffects() { return true; }
3358
3359 public void accept(Quad q, QuadVisitor qv) {
3360 qv.visitMonitor(q);
3361 qv.visitExceptionThrower(q);
3362 super.accept(q, qv);
3363 }
3364
3365 public static class MONITORENTER extends Monitor {
3366 public static final MONITORENTER INSTANCE = new MONITORENTER();
3367 private MONITORENTER() { }
3368 public String toString() { return "MONITORENTER"; }
3369 public void interpret(Quad q, QuadInterpreter s) {
3370 _delegate.interpretMonitorEnter(this, q, s);
3371 }
3372 public UnmodifiableList.jq_Class getThrownExceptions() {
3373 return nullptrexception;
3374 }
3375 }
3376 public static class MONITOREXIT extends Monitor {
3377 public static final MONITOREXIT INSTANCE = new MONITOREXIT();
3378 private MONITOREXIT() { }
3379 public String toString() { return "MONITOREXIT"; }
3380 public void interpret(Quad q, QuadInterpreter s) {
3381 _delegate.interpretMonitorExit(this, q, s);
3382 }
3383 public UnmodifiableList.jq_Class getThrownExceptions() {
3384 return illegalmonitorstateexception;
3385 }
3386 }
3387 }
3388
3389 public abstract static class MemLoad extends Operator {
3390 public static Quad create(int id, MemLoad operator, RegisterOperand dst, Operand addr) {
3391 return new Quad(id, operator, dst, addr);
3392 }
3393 public static RegisterOperand getDest(Quad q) { return (RegisterOperand)q.getOp1(); }
3394 public static Operand getAddress(Quad q) { return q.getOp2(); }
3395 public static void setDest(Quad q, RegisterOperand o) { q.setOp1(o); }
3396 public static void setAddress(Quad q, Operand o) { q.setOp2(o); }
3397 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3398 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3399 public boolean hasSideEffects() { return false; }
3400
3401 public void accept(Quad q, QuadVisitor qv) {
3402 qv.visitMemLoad(q);
3403 qv.visitLoad(q);
3404 super.accept(q, qv);
3405 }
3406
3407 public static class PEEK_P extends MemLoad {
3408 public static final PEEK_P INSTANCE = new PEEK_P();
3409 private PEEK_P() { }
3410 public String toString() { return "PEEK_P"; }
3411 public void interpret(Quad q, QuadInterpreter s) {
3412 Address o = getAddressOpValue(getAddress(q), s);
3413 if (jq.RunningNative)
3414 s.putReg_P(getDest(q).getRegister(), o.peek());
3415 }
3416 }
3417 public static class PEEK_1 extends MemLoad {
3418 public static final PEEK_1 INSTANCE = new PEEK_1();
3419 private PEEK_1() { }
3420 public String toString() { return "PEEK_1"; }
3421 public void interpret(Quad q, QuadInterpreter s) {
3422 Address o = getAddressOpValue(getAddress(q), s);
3423 if (jq.RunningNative)
3424 s.putReg_I(getDest(q).getRegister(), o.peek1());
3425 }
3426 }
3427 public static class PEEK_2 extends MemLoad {
3428 public static final PEEK_2 INSTANCE = new PEEK_2();
3429 private PEEK_2() { }
3430 public String toString() { return "PEEK_2"; }
3431 public void interpret(Quad q, QuadInterpreter s) {
3432 Address o = getAddressOpValue(getAddress(q), s);
3433 if (jq.RunningNative)
3434 s.putReg_I(getDest(q).getRegister(), o.peek2());
3435 }
3436 }
3437 public static class PEEK_4 extends MemLoad {
3438 public static final PEEK_4 INSTANCE = new PEEK_4();
3439 private PEEK_4() { }
3440 public String toString() { return "PEEK_4"; }
3441 public void interpret(Quad q, QuadInterpreter s) {
3442 Address o = getAddressOpValue(getAddress(q), s);
3443 if (jq.RunningNative)
3444 s.putReg_I(getDest(q).getRegister(), o.peek4());
3445 }
3446 }
3447 public static class PEEK_8 extends MemLoad {
3448 public static final PEEK_8 INSTANCE = new PEEK_8();
3449 private PEEK_8() { }
3450 public String toString() { return "PEEK_8"; }
3451 public void interpret(Quad q, QuadInterpreter s) {
3452 Address o = getAddressOpValue(getAddress(q), s);
3453 if (jq.RunningNative)
3454 s.putReg_L(getDest(q).getRegister(), o.peek8());
3455 }
3456 }
3457 }
3458
3459 public abstract static class MemStore extends Operator {
3460 public static Quad create(int id, MemStore operator, Operand addr, Operand val) {
3461 return new Quad(id, operator, null, addr, val);
3462 }
3463 public static Operand getAddress(Quad q) { return q.getOp2(); }
3464 public static Operand getValue(Quad q) { return q.getOp3(); }
3465 public static void setAddress(Quad q, Operand o) { q.setOp2(o); }
3466 public static void setValue(Quad q, Operand o) { q.setOp3(o); }
3467 public boolean hasSideEffects() { return true; }
3468 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg23(q); }
3469
3470 public void accept(Quad q, QuadVisitor qv) {
3471 qv.visitMemStore(q);
3472 qv.visitStore(q);
3473 super.accept(q, qv);
3474 }
3475
3476 public static class POKE_P extends MemStore {
3477 public static final POKE_P INSTANCE = new POKE_P();
3478 private POKE_P() { }
3479 public String toString() { return "POKE_P"; }
3480 public void interpret(Quad q, QuadInterpreter s) {
3481 Address o = getAddressOpValue(getAddress(q), s);
3482 Address v = getAddressOpValue(getValue(q), s);
3483 if (jq.RunningNative)
3484 o.poke(v);
3485 }
3486 }
3487 public static class POKE_1 extends MemStore {
3488 public static final POKE_1 INSTANCE = new POKE_1();
3489 private POKE_1() { }
3490 public String toString() { return "POKE_1"; }
3491 public void interpret(Quad q, QuadInterpreter s) {
3492 Address o = getAddressOpValue(getAddress(q), s);
3493 byte v = (byte)getIntOpValue(getValue(q), s);
3494 if (jq.RunningNative)
3495 o.poke1(v);
3496 }
3497 }
3498 public static class POKE_2 extends MemStore {
3499 public static final POKE_2 INSTANCE = new POKE_2();
3500 private POKE_2() { }
3501 public String toString() { return "POKE_2"; }
3502 public void interpret(Quad q, QuadInterpreter s) {
3503 Address o = getAddressOpValue(getAddress(q), s);
3504 short v = (short)getIntOpValue(getValue(q), s);
3505 if (jq.RunningNative)
3506 o.poke2(v);
3507 }
3508 }
3509 public static class POKE_4 extends MemStore {
3510 public static final POKE_4 INSTANCE = new POKE_4();
3511 private POKE_4() { }
3512 public String toString() { return "POKE_4"; }
3513 public void interpret(Quad q, QuadInterpreter s) {
3514 Address o = getAddressOpValue(getAddress(q), s);
3515 int v = (int)getIntOpValue(getValue(q), s);
3516 if (jq.RunningNative)
3517 o.poke4(v);
3518 }
3519 }
3520 public static class POKE_8 extends MemStore {
3521 public static final POKE_8 INSTANCE = new POKE_8();
3522 private POKE_8() { }
3523 public String toString() { return "POKE_8"; }
3524 public void interpret(Quad q, QuadInterpreter s) {
3525 Address o = getAddressOpValue(getAddress(q), s);
3526 long v = (long)getLongOpValue(getValue(q), s);
3527 if (jq.RunningNative)
3528 o.poke8(v);
3529 }
3530 }
3531 }
3532
3533 public abstract static class Special extends Operator {
3534
3535 public static Quad create(int id, GET_EXCEPTION operator, RegisterOperand res) {
3536 return new Quad(id, operator, res);
3537 }
3538 public static Quad create(int id, GET_BASE_POINTER operator, RegisterOperand res) {
3539 return new Quad(id, operator, res);
3540 }
3541 public static Quad create(int id, GET_STACK_POINTER operator, RegisterOperand res) {
3542 return new Quad(id, operator, res);
3543 }
3544 public static Quad create(int id, GET_THREAD_BLOCK operator, RegisterOperand res) {
3545 return new Quad(id, operator, res);
3546 }
3547 public static Quad create(int id, SET_THREAD_BLOCK operator, Operand val) {
3548 return new Quad(id, operator, null, val);
3549 }
3550 public static Quad create(int id, ALLOCA operator, RegisterOperand res, Operand val) {
3551 return new Quad(id, operator, res, val);
3552 }
3553 public static Quad create(int id, NOP operator) {
3554 return new Quad(id, operator, null, null);
3555 }
3556 public static Quad create(int id, ATOMICADD_I operator, Operand loc, Operand val) {
3557 return new Quad(id, operator, null, loc, val);
3558 }
3559 public static Quad create(int id, ATOMICSUB_I operator, Operand loc, Operand val) {
3560 return new Quad(id, operator, null, loc, val);
3561 }
3562 public static Quad create(int id, ATOMICAND_I operator, Operand loc, Operand val) {
3563 return new Quad(id, operator, null, loc, val);
3564 }
3565 public static Quad create(int id, ATOMICCAS4 operator, RegisterOperand res, Operand loc, Operand val1, Operand val2) {
3566 return new Quad(id, operator, res, loc, val1, val2);
3567 }
3568 public static Quad create(int id, ATOMICCAS8 operator, RegisterOperand res, Operand loc, Operand val1, Operand val2) {
3569 return new Quad(id, operator, res, loc, val1, val2);
3570 }
3571 public static Quad create(int id, LONG_JUMP operator, Operand ip, Operand fp, Operand sp, Operand eax) {
3572 return new Quad(id, operator, ip, fp, sp, eax);
3573 }
3574 public static Quad create(int id, POP_FP32 operator, RegisterOperand res) {
3575 return new Quad(id, operator, res);
3576 }
3577 public static Quad create(int id, POP_FP64 operator, RegisterOperand res) {
3578 return new Quad(id, operator, res);
3579 }
3580 public static Quad create(int id, PUSH_FP32 operator, Operand val) {
3581 return new Quad(id, operator, null, val);
3582 }
3583 public static Quad create(int id, PUSH_FP64 operator, Operand val) {
3584 return new Quad(id, operator, null, val);
3585 }
3586 public static Quad create(int id, GET_EAX operator, RegisterOperand res) {
3587 return new Quad(id, operator, res);
3588 }
3589 public static Quad create(int id, PUSHARG_I operator, Operand val) {
3590 return new Quad(id, operator, null, val);
3591 }
3592 public static Quad create(int id, PUSHARG_P operator, Operand val) {
3593 return new Quad(id, operator, null, val);
3594 }
3595 public static Quad create(int id, INVOKE_L operator, RegisterOperand res, Operand val) {
3596 return new Quad(id, operator, res, val);
3597 }
3598 public static Quad create(int id, INVOKE_P operator, RegisterOperand res, Operand val) {
3599 return new Quad(id, operator, res, val);
3600 }
3601 public static Quad create(int id, ISEQ operator, RegisterOperand res) {
3602 return new Quad(id, operator, res);
3603 }
3604 public static Quad create(int id, ISGE operator, RegisterOperand res) {
3605 return new Quad(id, operator, res);
3606 }
3607 public static Operand getOp1(Quad q) { return q.getOp1(); }
3608 public static Operand getOp2(Quad q) { return q.getOp2(); }
3609 public static Operand getOp3(Quad q) { return q.getOp3(); }
3610 public static Operand getOp4(Quad q) { return q.getOp4(); }
3611 public static void setOp1(Quad q, Operand o) { q.setOp1(o); }
3612 public static void setOp2(Quad q, Operand o) { q.setOp2(o); }
3613 public static void setOp3(Quad q, Operand o) { q.setOp3(o); }
3614 public static void setOp4(Quad q, Operand o) { q.setOp4(o); }
3615 public boolean hasSideEffects() { return true; }
3616
3617 public void accept(Quad q, QuadVisitor qv) {
3618 qv.visitSpecial(q);
3619 super.accept(q, qv);
3620 }
3621
3622 public static class GET_EXCEPTION extends Special {
3623 public static final GET_EXCEPTION INSTANCE = new GET_EXCEPTION();
3624 private GET_EXCEPTION() { }
3625 public String toString() { return "GET_EXCEPTION"; }
3626 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3627 public void interpret(Quad q, QuadInterpreter s) {
3628 s.putReg_A(((RegisterOperand)getOp1(q)).getRegister(), s.getCaught());
3629 }
3630 }
3631 public static class GET_BASE_POINTER extends Special {
3632 public static final GET_BASE_POINTER INSTANCE = new GET_BASE_POINTER();
3633 private GET_BASE_POINTER() { }
3634 public String toString() { return "GET_BASE_POINTER"; }
3635 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3636 public void interpret(Quad q, QuadInterpreter s) {
3637 Assert.TODO();
3638 }
3639 }
3640 public static class GET_STACK_POINTER extends Special {
3641 public static final GET_STACK_POINTER INSTANCE = new GET_STACK_POINTER();
3642 private GET_STACK_POINTER() { }
3643 public String toString() { return "GET_STACK_POINTER"; }
3644 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3645 public void interpret(Quad q, QuadInterpreter s) {
3646 Assert.TODO();
3647 }
3648 }
3649 public static class GET_THREAD_BLOCK extends Special {
3650 public static final GET_THREAD_BLOCK INSTANCE = new GET_THREAD_BLOCK();
3651 private GET_THREAD_BLOCK() { }
3652 public String toString() { return "GET_THREAD_BLOCK"; }
3653 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3654 public void interpret(Quad q, QuadInterpreter s) {
3655 _delegate.interpretGetThreadBlock(this, q, s);
3656 }
3657 }
3658 public static class SET_THREAD_BLOCK extends Special {
3659 public static final SET_THREAD_BLOCK INSTANCE = new SET_THREAD_BLOCK();
3660 private SET_THREAD_BLOCK() { }
3661 public String toString() { return "SET_THREAD_BLOCK"; }
3662 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3663 public void interpret(Quad q, QuadInterpreter s) {
3664 _delegate.interpretSetThreadBlock(this, q, s);
3665 }
3666 }
3667 public static class ATOMICADD_I extends Special {
3668 public static final ATOMICADD_I INSTANCE = new ATOMICADD_I();
3669 private ATOMICADD_I() { }
3670 public String toString() { return "ATOMICADD_I"; }
3671 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg23(q); }
3672 public void interpret(Quad q, QuadInterpreter s) {
3673 HeapAddress o = (HeapAddress) getAddressOpValue(getOp2(q), s);
3674 int v = getIntOpValue(getOp3(q), s);
3675 o.atomicAdd(v);
3676 }
3677 }
3678 public static class ATOMICSUB_I extends Special {
3679 public static final ATOMICSUB_I INSTANCE = new ATOMICSUB_I();
3680 private ATOMICSUB_I() { }
3681 public String toString() { return "ATOMICSUB_I"; }
3682 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg23(q); }
3683 public void interpret(Quad q, QuadInterpreter s) {
3684 HeapAddress o = (HeapAddress) getAddressOpValue(getOp2(q), s);
3685 int v = getIntOpValue(getOp3(q), s);
3686 o.atomicSub(v);
3687 }
3688 }
3689 public static class ATOMICAND_I extends Special {
3690 public static final ATOMICAND_I INSTANCE = new ATOMICAND_I();
3691 private ATOMICAND_I() { }
3692 public String toString() { return "ATOMICAND_I"; }
3693 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg23(q); }
3694 public void interpret(Quad q, QuadInterpreter s) {
3695 HeapAddress o = (HeapAddress) getAddressOpValue(getOp2(q), s);
3696 int v = getIntOpValue(getOp3(q), s);
3697 o.atomicAnd(v);
3698 }
3699 }
3700 public static class ATOMICCAS4 extends Special {
3701 public static final ATOMICCAS4 INSTANCE = new ATOMICCAS4();
3702 private ATOMICCAS4() { }
3703 public String toString() { return "ATOMICCAS4"; }
3704 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3705 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg234(q); }
3706 public void interpret(Quad q, QuadInterpreter s) {
3707 HeapAddress o = (HeapAddress) getAddressOpValue(getOp2(q), s);
3708 int v1 = getIntOpValue(getOp3(q), s);
3709 int v2 = getIntOpValue(getOp4(q), s);
3710 int r = o.atomicCas4(v1, v2);
3711 s.putReg_I(((RegisterOperand) getOp1(q)).getRegister(), r);
3712 }
3713 }
3714 public static class ATOMICCAS8 extends Special {
3715 public static final ATOMICCAS8 INSTANCE = new ATOMICCAS8();
3716 private ATOMICCAS8() { }
3717 public String toString() { return "ATOMICCAS8"; }
3718 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3719 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg234(q); }
3720 public void interpret(Quad q, QuadInterpreter s) {
3721 HeapAddress o = (HeapAddress) getAddressOpValue(getOp2(q), s);
3722 long v1 = getLongOpValue(getOp3(q), s);
3723 long v2 = getLongOpValue(getOp4(q), s);
3724 long r = o.atomicCas8(v1, v2);
3725 s.putReg_L(((RegisterOperand) getOp1(q)).getRegister(), r);
3726 }
3727 }
3728 public static class ALLOCA extends Special {
3729 public static final ALLOCA INSTANCE = new ALLOCA();
3730 private ALLOCA() { }
3731 public String toString() { return "ALLOCA"; }
3732 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3733 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3734 public void interpret(Quad q, QuadInterpreter s) {
3735 Assert.TODO();
3736 }
3737 }
3738 public static class LONG_JUMP extends Special {
3739 public static final LONG_JUMP INSTANCE = new LONG_JUMP();
3740 private LONG_JUMP() { }
3741 public String toString() { return "LONG_JUMP"; }
3742 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg1234(q); }
3743 public void interpret(Quad q, QuadInterpreter s) {
3744
3745
3746
3747
3748
3749
3750
3751
3752 Assert.TODO();
3753 }
3754 }
3755 public static class POP_FP32 extends Special {
3756 public static final POP_FP32 INSTANCE = new POP_FP32();
3757 private POP_FP32() { }
3758 public String toString() { return "POP_FP32"; }
3759 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3760 public void interpret(Quad q, QuadInterpreter s) {
3761 Assert.TODO();
3762 }
3763 }
3764 public static class POP_FP64 extends Special {
3765 public static final POP_FP64 INSTANCE = new POP_FP64();
3766 private POP_FP64() { }
3767 public String toString() { return "POP_FP64"; }
3768 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3769 public void interpret(Quad q, QuadInterpreter s) {
3770 Assert.TODO();
3771 }
3772 }
3773 public static class PUSH_FP32 extends Special {
3774 public static final PUSH_FP32 INSTANCE = new PUSH_FP32();
3775 private PUSH_FP32() { }
3776 public String toString() { return "PUSH_FP32"; }
3777 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3778 public void interpret(Quad q, QuadInterpreter s) {
3779 Assert.TODO();
3780 }
3781 }
3782 public static class PUSH_FP64 extends Special {
3783 public static final PUSH_FP64 INSTANCE = new PUSH_FP64();
3784 private PUSH_FP64() { }
3785 public String toString() { return "PUSH_FP64"; }
3786 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3787 public void interpret(Quad q, QuadInterpreter s) {
3788 Assert.TODO();
3789 }
3790 }
3791 public static class GET_EAX extends Special {
3792 public static final GET_EAX INSTANCE = new GET_EAX();
3793 private GET_EAX() { }
3794 public String toString() { return "GET_EAX"; }
3795 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3796 public void interpret(Quad q, QuadInterpreter s) {
3797 _delegate.interpretGetThreadBlock(this, q, s);
3798 }
3799 }
3800 public static class PUSHARG_I extends Special {
3801 public static final PUSHARG_I INSTANCE = new PUSHARG_I();
3802 private PUSHARG_I() { }
3803 public String toString() { return "PUSHARG_I"; }
3804 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3805 public void interpret(Quad q, QuadInterpreter s) {
3806 Assert.TODO();
3807 }
3808 }
3809 public static class PUSHARG_P extends Special {
3810 public static final PUSHARG_P INSTANCE = new PUSHARG_P();
3811 private PUSHARG_P() { }
3812 public String toString() { return "PUSHARG_P"; }
3813 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3814 public void interpret(Quad q, QuadInterpreter s) {
3815 Assert.TODO();
3816 }
3817 }
3818 public static class INVOKE_L extends Special {
3819 public static final INVOKE_L INSTANCE = new INVOKE_L();
3820 private INVOKE_L() { }
3821 public String toString() { return "INVOKE_L"; }
3822 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3823 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3824 public void interpret(Quad q, QuadInterpreter s) {
3825 Assert.TODO();
3826 }
3827 }
3828 public static class INVOKE_P extends Special {
3829 public static final INVOKE_P INSTANCE = new INVOKE_P();
3830 private INVOKE_P() { }
3831 public String toString() { return "INVOKE_P"; }
3832 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3833 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return getReg2(q); }
3834 public void interpret(Quad q, QuadInterpreter s) {
3835 Assert.TODO();
3836 }
3837 }
3838 public static class ISEQ extends Special {
3839 public static final ISEQ INSTANCE = new ISEQ();
3840 private ISEQ() { }
3841 public String toString() { return "ISEQ"; }
3842 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3843 public void interpret(Quad q, QuadInterpreter s) {
3844 Assert.TODO();
3845 }
3846 }
3847 public static class ISGE extends Special {
3848 public static final ISGE INSTANCE = new ISGE();
3849 private ISGE() { }
3850 public String toString() { return "ISGE"; }
3851 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return getReg1(q); }
3852 public void interpret(Quad q, QuadInterpreter s) {
3853 Assert.TODO();
3854 }
3855 }
3856
3857 public static class NOP extends Operator.Special {
3858 public static final NOP INSTANCE = new NOP();
3859 private NOP() {}
3860 public String toString() { return "NOP"; }
3861 public UnmodifiableList.RegisterOperand getDefinedRegisters(Quad q) { return null; }
3862 public UnmodifiableList.RegisterOperand getUsedRegisters(Quad q) { return null; }
3863 public void interpret(Quad q, QuadInterpreter s) {
3864 Assert.TODO();
3865 }
3866 }
3867 }
3868
3869 static interface Delegate {
3870 void interpretGetThreadBlock(Special op, Quad q, QuadInterpreter s);
3871 void interpretSetThreadBlock(Special op, Quad q, QuadInterpreter s);
3872 void interpretMonitorEnter(Monitor op, Quad q, QuadInterpreter s);
3873 void interpretMonitorExit(Monitor op, Quad q, QuadInterpreter s);
3874 }
3875
3876 protected static Delegate _delegate;
3877
3878 static {
3879
3880 _delegate = null;
3881 boolean nullVM = jq.nullVM;
3882 if (!nullVM) {
3883 _delegate = attemptDelegate("joeq.Compiler.Quad.Delegates$Op");
3884 }
3885 if (_delegate == null) {
3886 _delegate = new joeq.Compiler.Quad.NullDelegates.Op();
3887 }
3888 }
3889
3890 private static Delegate attemptDelegate(String s) {
3891
3892 try {
3893 Class c = Class.forName(s);
3894 return (Delegate)c.newInstance();
3895 } catch (java.lang.ClassNotFoundException x) {
3896
3897 } catch (java.lang.InstantiationException x) {
3898
3899 } catch (java.lang.IllegalAccessException x) {
3900
3901 }
3902 return null;
3903 }
3904 }