98 return LT;
99 case GT:
100 return LE;
101 case LE:
102 return GT;
103 default:
104 throw new IllegalStateException("Unknown cond");
105 }
106 }
107 }
108
109 static class WideJumpException extends RuntimeException {
110 static final long serialVersionUID = 42L;
111 }
112
113 public MacroCodeBuilder(MethodBuilder<S, T, E> methodBuilder) {
114 super(methodBuilder);
115 }
116
117 public C load(TypeTag type, int n) {
118 if (type == TypeTag.Q) {
119 return vload(n);
120 } else {
121 switch (n) {
122 case 0:
123 return emitOp(Opcode.ILOAD_0.at(type, 4));
124 case 1:
125 return emitOp(Opcode.ILOAD_1.at(type, 4));
126 case 2:
127 return emitOp(Opcode.ILOAD_2.at(type, 4));
128 case 3:
129 return emitOp(Opcode.ILOAD_3.at(type, 4));
130 default:
131 return emitWideIfNeeded(Opcode.ILOAD.at(type), n);
132 }
133 }
134 }
135
136 public C store(TypeTag type, int n) {
137 if (type == TypeTag.Q) {
138 return vstore(n);
139 } else {
140 switch (n) {
141 case 0:
142 return emitOp(Opcode.ISTORE_0.at(type, 4));
143 case 1:
144 return emitOp(Opcode.ISTORE_1.at(type, 4));
145 case 2:
146 return emitOp(Opcode.ISTORE_2.at(type, 4));
147 case 3:
148 return emitOp(Opcode.ISTORE_3.at(type, 4));
149 default:
150 return emitWideIfNeeded(Opcode.ISTORE.at(type), n);
151 }
152 }
153 }
154
155 public C arrayload(TypeTag type) {
156 return emitOp(Opcode.IALOAD.at(type));
157 }
158
159 public C arraystore(TypeTag type, int n) {
160 return emitOp(Opcode.IASTORE.at(type));
161 }
162
163 public C const_(int i) {
164 switch (i) {
165 case -1:
166 return iconst_m1();
167 case 0:
168 return iconst_0();
169 case 1:
170 return iconst_1();
171 case 2:
291
292 public C ushr(TypeTag type) {
293 return emitOp(Opcode.ISHR.at(type));
294 }
295
296 public C and(TypeTag type) {
297 return emitOp(Opcode.IAND.at(type));
298 }
299
300 public C or(TypeTag type) {
301 return emitOp(Opcode.IOR.at(type));
302 }
303
304 public C xor(TypeTag type) {
305 return emitOp(Opcode.IXOR.at(type));
306 }
307
308 public C return_(TypeTag type) {
309 switch (type) {
310 case V:
311 return return_();
312 case Q:
313 return vreturn();
314 default:
315 return emitOp(Opcode.IRETURN.at(type));
316 }
317 }
318
319 @Override
320 public LabelledTypedBuilder typed(TypeTag typeTag) {
321 return super.typed(typeTag, _unused -> new LabelledTypedBuilder());
322 }
323
324 public class LabelledTypedBuilder extends TypedBuilder {
325 public C if_acmpeq(CharSequence target) {
326 return ifcmp(TypeTag.A, CondKind.EQ, target);
327 }
328
329 public C if_acmpne(CharSequence target) {
330 return ifcmp(TypeTag.A, CondKind.NE, target);
331 }
332 }
333
334 public C conv(TypeTag from, TypeTag to) {
335 switch (from) {
336 case B:
337 case C:
338 case S:
339 switch (to) {
340 case J:
341 return i2l();
342 case F:
343 return i2f();
344 case D:
345 return i2d();
346 }
347 break;
348 case I:
349 switch (to) {
350 case J:
351 return i2l();
352 case F:
353 return i2f();
|
98 return LT;
99 case GT:
100 return LE;
101 case LE:
102 return GT;
103 default:
104 throw new IllegalStateException("Unknown cond");
105 }
106 }
107 }
108
109 static class WideJumpException extends RuntimeException {
110 static final long serialVersionUID = 42L;
111 }
112
113 public MacroCodeBuilder(MethodBuilder<S, T, E> methodBuilder) {
114 super(methodBuilder);
115 }
116
117 public C load(TypeTag type, int n) {
118 switch (n) {
119 case 0:
120 return emitOp(Opcode.ILOAD_0.at(type, 4));
121 case 1:
122 return emitOp(Opcode.ILOAD_1.at(type, 4));
123 case 2:
124 return emitOp(Opcode.ILOAD_2.at(type, 4));
125 case 3:
126 return emitOp(Opcode.ILOAD_3.at(type, 4));
127 default:
128 return emitWideIfNeeded(Opcode.ILOAD.at(type), n);
129 }
130 }
131
132 public C store(TypeTag type, int n) {
133 switch (n) {
134 case 0:
135 return emitOp(Opcode.ISTORE_0.at(type, 4));
136 case 1:
137 return emitOp(Opcode.ISTORE_1.at(type, 4));
138 case 2:
139 return emitOp(Opcode.ISTORE_2.at(type, 4));
140 case 3:
141 return emitOp(Opcode.ISTORE_3.at(type, 4));
142 default:
143 return emitWideIfNeeded(Opcode.ISTORE.at(type), n);
144 }
145 }
146
147 public C arrayload(TypeTag type) {
148 return emitOp(Opcode.IALOAD.at(type));
149 }
150
151 public C arraystore(TypeTag type, int n) {
152 return emitOp(Opcode.IASTORE.at(type));
153 }
154
155 public C const_(int i) {
156 switch (i) {
157 case -1:
158 return iconst_m1();
159 case 0:
160 return iconst_0();
161 case 1:
162 return iconst_1();
163 case 2:
283
284 public C ushr(TypeTag type) {
285 return emitOp(Opcode.ISHR.at(type));
286 }
287
288 public C and(TypeTag type) {
289 return emitOp(Opcode.IAND.at(type));
290 }
291
292 public C or(TypeTag type) {
293 return emitOp(Opcode.IOR.at(type));
294 }
295
296 public C xor(TypeTag type) {
297 return emitOp(Opcode.IXOR.at(type));
298 }
299
300 public C return_(TypeTag type) {
301 switch (type) {
302 case V:
303 case Q:
304 return return_();
305 default:
306 return emitOp(Opcode.IRETURN.at(type));
307 }
308 }
309
310 public C conv(TypeTag from, TypeTag to) {
311 switch (from) {
312 case B:
313 case C:
314 case S:
315 switch (to) {
316 case J:
317 return i2l();
318 case F:
319 return i2f();
320 case D:
321 return i2d();
322 }
323 break;
324 case I:
325 switch (to) {
326 case J:
327 return i2l();
328 case F:
329 return i2f();
|