blob: f76fbfb30f540af7c7fdaec9ba786d3258a70777 [file] [log] [blame]
Sebastien Hertz8ece0502013-08-07 11:26:41 +02001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "interpreter_common.h"
18
19namespace art {
20namespace interpreter {
21
22// In the following macros, we expect the following local variables exist:
23// - "self": the current Thread*.
24// - "inst" : the current Instruction*.
25// - "dex_pc": the current pc.
26// - "shadow_frame": the current shadow frame.
27// - "insns": the start of current method's code item.
28// - "mh": the current MethodHelper.
29// - "currentHandlersTable": the current table of pointer to each instruction handler.
30
31// Advance to the next instruction and updates interpreter state.
32// TODO: move check suspend to backward branch, return and exception handling.
33#define ADVANCE(_offset) \
34 do { \
35 int32_t disp = static_cast<int32_t>(_offset); \
36 inst = inst->RelativeAt(disp); \
37 dex_pc = static_cast<uint32_t>(static_cast<int32_t>(dex_pc) + disp); \
38 shadow_frame.SetDexPC(dex_pc); \
39 if (UNLIKELY(self->TestAllFlags())) { \
40 CheckSuspend(self); \
41 } \
42 TraceExecution(shadow_frame, inst, dex_pc, mh); \
43 goto *currentHandlersTable[inst->Opcode()]; \
44 } while (false)
45
46#define HANDLE_PENDING_EXCEPTION() goto exception_pending_label
47
48#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _offset) \
49 do { \
50 if (UNLIKELY(_is_exception_pending)) { \
51 HANDLE_PENDING_EXCEPTION(); \
52 } else { \
53 ADVANCE(_offset); \
54 } \
55 } while (false)
56
57#define UNREACHABLE_CODE_CHECK() \
58 do { \
59 if (kIsDebugBuild) { \
60 LOG(FATAL) << "We should not be here !"; \
61 } \
62 } while (false)
63
64#define HANDLE_INSTRUCTION_START(opcode) op_##opcode: // NOLINT(whitespace/labels)
65#define HANDLE_INSTRUCTION_END() UNREACHABLE_CODE_CHECK()
66
67static inline bool IsBackwardBranch(int32_t branch_offset) {
68 return branch_offset <= 0;
69}
70
71template<bool do_access_check>
72JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
73 ShadowFrame& shadow_frame, JValue result_register) {
74 if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
75 LOG(FATAL) << "Invalid shadow frame for interpreter use";
76 return JValue();
77 }
78 self->VerifyStack();
79 instrumentation::Instrumentation* const instrumentation = Runtime::Current()->GetInstrumentation();
80
81 // As the 'this' object won't change during the execution of current code, we
82 // want to cache it in local variables. Nevertheless, in order to let the
83 // garbage collector access it, we store it into sirt references.
84 SirtRef<Object> this_object_ref(self, shadow_frame.GetThisObject(code_item->ins_size_));
85
86 uint32_t dex_pc = shadow_frame.GetDexPC();
87 if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing..
88 if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
89 instrumentation->MethodEnterEvent(self, this_object_ref.get(),
90 shadow_frame.GetMethod(), 0);
91 }
92 }
93 const uint16_t* const insns = code_item->insns_;
94 const Instruction* inst = Instruction::At(insns + dex_pc);
95
96 // Define handlers table.
97 static const void* handlersTable[kNumPackedOpcodes] = {
98#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&op_##code,
99#include "dex_instruction_list.h"
100 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
101#undef DEX_INSTRUCTION_LIST
102#undef INSTRUCTION_HANDLER
103 };
104
105 static const void* instrumentationHandlersTable[kNumPackedOpcodes] = {
106#define INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) &&instrumentation_op_##code,
107#include "dex_instruction_list.h"
108 DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER)
109#undef DEX_INSTRUCTION_LIST
110#undef INSTRUCTION_HANDLER
111 };
112
113 const void** currentHandlersTable;
114 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
115 currentHandlersTable = instrumentationHandlersTable;
116 } else {
117 currentHandlersTable = handlersTable;
118 }
119
120 // Jump to first instruction.
121 ADVANCE(0);
122 UNREACHABLE_CODE_CHECK();
123
124 HANDLE_INSTRUCTION_START(NOP)
125 ADVANCE(1);
126 HANDLE_INSTRUCTION_END();
127
128 HANDLE_INSTRUCTION_START(MOVE)
129 shadow_frame.SetVReg(inst->VRegA_12x(),
130 shadow_frame.GetVReg(inst->VRegB_12x()));
131 ADVANCE(1);
132 HANDLE_INSTRUCTION_END();
133
134 HANDLE_INSTRUCTION_START(MOVE_FROM16)
135 shadow_frame.SetVReg(inst->VRegA_22x(),
136 shadow_frame.GetVReg(inst->VRegB_22x()));
137 ADVANCE(2);
138 HANDLE_INSTRUCTION_END();
139
140 HANDLE_INSTRUCTION_START(MOVE_16)
141 shadow_frame.SetVReg(inst->VRegA_32x(),
142 shadow_frame.GetVReg(inst->VRegB_32x()));
143 ADVANCE(3);
144 HANDLE_INSTRUCTION_END();
145
146 HANDLE_INSTRUCTION_START(MOVE_WIDE)
147 shadow_frame.SetVRegLong(inst->VRegA_12x(),
148 shadow_frame.GetVRegLong(inst->VRegB_12x()));
149 ADVANCE(1);
150 HANDLE_INSTRUCTION_END();
151
152 HANDLE_INSTRUCTION_START(MOVE_WIDE_FROM16)
153 shadow_frame.SetVRegLong(inst->VRegA_22x(),
154 shadow_frame.GetVRegLong(inst->VRegB_22x()));
155 ADVANCE(2);
156 HANDLE_INSTRUCTION_END();
157
158 HANDLE_INSTRUCTION_START(MOVE_WIDE_16)
159 shadow_frame.SetVRegLong(inst->VRegA_32x(),
160 shadow_frame.GetVRegLong(inst->VRegB_32x()));
161 ADVANCE(3);
162 HANDLE_INSTRUCTION_END();
163
164 HANDLE_INSTRUCTION_START(MOVE_OBJECT)
165 shadow_frame.SetVRegReference(inst->VRegA_12x(),
166 shadow_frame.GetVRegReference(inst->VRegB_12x()));
167 ADVANCE(1);
168 HANDLE_INSTRUCTION_END();
169
170 HANDLE_INSTRUCTION_START(MOVE_OBJECT_FROM16)
171 shadow_frame.SetVRegReference(inst->VRegA_22x(),
172 shadow_frame.GetVRegReference(inst->VRegB_22x()));
173 ADVANCE(2);
174 HANDLE_INSTRUCTION_END();
175
176 HANDLE_INSTRUCTION_START(MOVE_OBJECT_16)
177 shadow_frame.SetVRegReference(inst->VRegA_32x(),
178 shadow_frame.GetVRegReference(inst->VRegB_32x()));
179 ADVANCE(3);
180 HANDLE_INSTRUCTION_END();
181
182 HANDLE_INSTRUCTION_START(MOVE_RESULT)
183 shadow_frame.SetVReg(inst->VRegA_11x(), result_register.GetI());
184 ADVANCE(1);
185 HANDLE_INSTRUCTION_END();
186
187 HANDLE_INSTRUCTION_START(MOVE_RESULT_WIDE)
188 shadow_frame.SetVRegLong(inst->VRegA_11x(), result_register.GetJ());
189 ADVANCE(1);
190 HANDLE_INSTRUCTION_END();
191
192 HANDLE_INSTRUCTION_START(MOVE_RESULT_OBJECT)
193 shadow_frame.SetVRegReference(inst->VRegA_11x(), result_register.GetL());
194 ADVANCE(1);
195 HANDLE_INSTRUCTION_END();
196
197 HANDLE_INSTRUCTION_START(MOVE_EXCEPTION) {
198 Throwable* exception = self->GetException(NULL);
199 self->ClearException();
200 shadow_frame.SetVRegReference(inst->VRegA_11x(), exception);
201 ADVANCE(1);
202 }
203 HANDLE_INSTRUCTION_END();
204
205 HANDLE_INSTRUCTION_START(RETURN_VOID) {
206 JValue result;
207 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
208 instrumentation->MethodExitEvent(self, this_object_ref.get(),
209 shadow_frame.GetMethod(), dex_pc,
210 result);
211 }
212 return result;
213 }
214 HANDLE_INSTRUCTION_END();
215
216 HANDLE_INSTRUCTION_START(RETURN_VOID_BARRIER) {
217 ANDROID_MEMBAR_STORE();
218 JValue result;
219 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
220 instrumentation->MethodExitEvent(self, this_object_ref.get(),
221 shadow_frame.GetMethod(), dex_pc,
222 result);
223 }
224 return result;
225 }
226 HANDLE_INSTRUCTION_END();
227
228 HANDLE_INSTRUCTION_START(RETURN) {
229 JValue result;
230 result.SetJ(0);
231 result.SetI(shadow_frame.GetVReg(inst->VRegA_11x()));
232 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
233 instrumentation->MethodExitEvent(self, this_object_ref.get(),
234 shadow_frame.GetMethod(), dex_pc,
235 result);
236 }
237 return result;
238 }
239 HANDLE_INSTRUCTION_END();
240
241 HANDLE_INSTRUCTION_START(RETURN_WIDE) {
242 JValue result;
243 result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x()));
244 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
245 instrumentation->MethodExitEvent(self, this_object_ref.get(),
246 shadow_frame.GetMethod(), dex_pc,
247 result);
248 }
249 return result;
250 }
251 HANDLE_INSTRUCTION_END();
252
253 HANDLE_INSTRUCTION_START(RETURN_OBJECT) {
254 JValue result;
255 result.SetJ(0);
256 result.SetL(shadow_frame.GetVRegReference(inst->VRegA_11x()));
257 if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
258 instrumentation->MethodExitEvent(self, this_object_ref.get(),
259 shadow_frame.GetMethod(), dex_pc,
260 result);
261 }
262 return result;
263 }
264 HANDLE_INSTRUCTION_END();
265
266 HANDLE_INSTRUCTION_START(CONST_4) {
267 uint32_t dst = inst->VRegA_11n();
268 int32_t val = inst->VRegB_11n();
269 shadow_frame.SetVReg(dst, val);
270 if (val == 0) {
271 shadow_frame.SetVRegReference(dst, NULL);
272 }
273 ADVANCE(1);
274 }
275 HANDLE_INSTRUCTION_END();
276
277 HANDLE_INSTRUCTION_START(CONST_16) {
278 uint32_t dst = inst->VRegA_21s();
279 int32_t val = inst->VRegB_21s();
280 shadow_frame.SetVReg(dst, val);
281 if (val == 0) {
282 shadow_frame.SetVRegReference(dst, NULL);
283 }
284 ADVANCE(2);
285 }
286 HANDLE_INSTRUCTION_END();
287
288 HANDLE_INSTRUCTION_START(CONST) {
289 uint32_t dst = inst->VRegA_31i();
290 int32_t val = inst->VRegB_31i();
291 shadow_frame.SetVReg(dst, val);
292 if (val == 0) {
293 shadow_frame.SetVRegReference(dst, NULL);
294 }
295 ADVANCE(3);
296 }
297 HANDLE_INSTRUCTION_END();
298
299 HANDLE_INSTRUCTION_START(CONST_HIGH16) {
300 uint32_t dst = inst->VRegA_21h();
301 int32_t val = static_cast<int32_t>(inst->VRegB_21h() << 16);
302 shadow_frame.SetVReg(dst, val);
303 if (val == 0) {
304 shadow_frame.SetVRegReference(dst, NULL);
305 }
306 ADVANCE(2);
307 }
308 HANDLE_INSTRUCTION_END();
309
310 HANDLE_INSTRUCTION_START(CONST_WIDE_16)
311 shadow_frame.SetVRegLong(inst->VRegA_21s(), inst->VRegB_21s());
312 ADVANCE(2);
313 HANDLE_INSTRUCTION_END();
314
315 HANDLE_INSTRUCTION_START(CONST_WIDE_32)
316 shadow_frame.SetVRegLong(inst->VRegA_31i(), inst->VRegB_31i());
317 ADVANCE(3);
318 HANDLE_INSTRUCTION_END();
319
320 HANDLE_INSTRUCTION_START(CONST_WIDE)
321 shadow_frame.SetVRegLong(inst->VRegA_51l(), inst->VRegB_51l());
322 ADVANCE(5);
323 HANDLE_INSTRUCTION_END();
324
325 HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16)
326 shadow_frame.SetVRegLong(inst->VRegA_21h(),
327 static_cast<uint64_t>(inst->VRegB_21h()) << 48);
328 ADVANCE(2);
329 HANDLE_INSTRUCTION_END();
330
331 HANDLE_INSTRUCTION_START(CONST_STRING) {
332 String* s = ResolveString(self, mh, inst->VRegB_21c());
333 if (UNLIKELY(s == NULL)) {
334 HANDLE_PENDING_EXCEPTION();
335 } else {
336 shadow_frame.SetVRegReference(inst->VRegA_21c(), s);
337 ADVANCE(2);
338 }
339 }
340 HANDLE_INSTRUCTION_END();
341
342 HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
343 String* s = ResolveString(self, mh, inst->VRegB_31c());
344 if (UNLIKELY(s == NULL)) {
345 HANDLE_PENDING_EXCEPTION();
346 } else {
347 shadow_frame.SetVRegReference(inst->VRegA_31c(), s);
348 ADVANCE(3);
349 }
350 }
351 HANDLE_INSTRUCTION_END();
352
353 HANDLE_INSTRUCTION_START(CONST_CLASS) {
354 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
355 self, false, do_access_check);
356 if (UNLIKELY(c == NULL)) {
357 HANDLE_PENDING_EXCEPTION();
358 } else {
359 shadow_frame.SetVRegReference(inst->VRegA_21c(), c);
360 ADVANCE(2);
361 }
362 }
363 HANDLE_INSTRUCTION_END();
364
365 HANDLE_INSTRUCTION_START(MONITOR_ENTER) {
366 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x());
367 if (UNLIKELY(obj == NULL)) {
368 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
369 HANDLE_PENDING_EXCEPTION();
370 } else {
371 DoMonitorEnter(self, obj);
372 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
373 }
374 }
375 HANDLE_INSTRUCTION_END();
376
377 HANDLE_INSTRUCTION_START(MONITOR_EXIT) {
378 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x());
379 if (UNLIKELY(obj == NULL)) {
380 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
381 HANDLE_PENDING_EXCEPTION();
382 } else {
383 DoMonitorExit(self, obj);
384 POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1);
385 }
386 }
387 HANDLE_INSTRUCTION_END();
388
389 HANDLE_INSTRUCTION_START(CHECK_CAST) {
390 Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(),
391 self, false, do_access_check);
392 if (UNLIKELY(c == NULL)) {
393 HANDLE_PENDING_EXCEPTION();
394 } else {
395 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c());
396 if (UNLIKELY(obj != NULL && !obj->InstanceOf(c))) {
397 ThrowClassCastException(c, obj->GetClass());
398 HANDLE_PENDING_EXCEPTION();
399 } else {
400 ADVANCE(2);
401 }
402 }
403 }
404 HANDLE_INSTRUCTION_END();
405
406 HANDLE_INSTRUCTION_START(INSTANCE_OF) {
407 Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(),
408 self, false, do_access_check);
409 if (UNLIKELY(c == NULL)) {
410 HANDLE_PENDING_EXCEPTION();
411 } else {
412 Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c());
413 shadow_frame.SetVReg(inst->VRegA_22c(), (obj != NULL && obj->InstanceOf(c)) ? 1 : 0);
414 ADVANCE(2);
415 }
416 }
417 HANDLE_INSTRUCTION_END();
418
419 HANDLE_INSTRUCTION_START(ARRAY_LENGTH) {
420 Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x());
421 if (UNLIKELY(array == NULL)) {
422 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
423 HANDLE_PENDING_EXCEPTION();
424 } else {
425 shadow_frame.SetVReg(inst->VRegA_12x(), array->AsArray()->GetLength());
426 ADVANCE(1);
427 }
428 }
429 HANDLE_INSTRUCTION_END();
430
431 HANDLE_INSTRUCTION_START(NEW_INSTANCE) {
432 Object* obj = AllocObjectFromCode(inst->VRegB_21c(), shadow_frame.GetMethod(),
433 self, do_access_check);
434 if (UNLIKELY(obj == NULL)) {
435 HANDLE_PENDING_EXCEPTION();
436 } else {
437 shadow_frame.SetVRegReference(inst->VRegA_21c(), obj);
438 ADVANCE(2);
439 }
440 }
441 HANDLE_INSTRUCTION_END();
442
443 HANDLE_INSTRUCTION_START(NEW_ARRAY) {
444 int32_t length = shadow_frame.GetVReg(inst->VRegB_22c());
445 Object* obj = AllocArrayFromCode(inst->VRegC_22c(), shadow_frame.GetMethod(),
446 length, self, do_access_check);
447 if (UNLIKELY(obj == NULL)) {
448 HANDLE_PENDING_EXCEPTION();
449 } else {
450 shadow_frame.SetVRegReference(inst->VRegA_22c(), obj);
451 ADVANCE(2);
452 }
453 }
454 HANDLE_INSTRUCTION_END();
455
456 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) {
457 bool success = DoFilledNewArray<false, do_access_check>(inst, shadow_frame,
458 self, &result_register);
459 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
460 }
461 HANDLE_INSTRUCTION_END();
462
463 HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) {
464 bool success = DoFilledNewArray<true, do_access_check>(inst, shadow_frame,
465 self, &result_register);
466 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
467 }
468 HANDLE_INSTRUCTION_END();
469
470 HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) {
471 Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t());
472 if (UNLIKELY(obj == NULL)) {
473 ThrowNullPointerException(NULL, "null array in FILL_ARRAY_DATA");
474 HANDLE_PENDING_EXCEPTION();
475 } else {
476 Array* array = obj->AsArray();
477 DCHECK(array->IsArrayInstance() && !array->IsObjectArray());
478 const uint16_t* payload_addr = reinterpret_cast<const uint16_t*>(inst) + inst->VRegB_31t();
479 const Instruction::ArrayDataPayload* payload =
480 reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr);
481 if (UNLIKELY(static_cast<int32_t>(payload->element_count) > array->GetLength())) {
482 self->ThrowNewExceptionF(shadow_frame.GetCurrentLocationForThrow(),
483 "Ljava/lang/ArrayIndexOutOfBoundsException;",
484 "failed FILL_ARRAY_DATA; length=%d, index=%d",
485 array->GetLength(), payload->element_count);
486 HANDLE_PENDING_EXCEPTION();
487 } else {
488 uint32_t size_in_bytes = payload->element_count * payload->element_width;
489 memcpy(array->GetRawData(payload->element_width), payload->data, size_in_bytes);
490 ADVANCE(3);
491 }
492 }
493 }
494 HANDLE_INSTRUCTION_END();
495
496 HANDLE_INSTRUCTION_START(THROW) {
497 Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x());
498 if (UNLIKELY(exception == NULL)) {
499 ThrowNullPointerException(NULL, "throw with null exception");
500 } else {
501 self->SetException(shadow_frame.GetCurrentLocationForThrow(), exception->AsThrowable());
502 }
503 HANDLE_PENDING_EXCEPTION();
504 }
505 HANDLE_INSTRUCTION_END();
506
507 HANDLE_INSTRUCTION_START(GOTO) {
508 int8_t offset = inst->VRegA_10t();
509 if (IsBackwardBranch(offset)) {
510 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
511 currentHandlersTable = instrumentationHandlersTable;
512 } else {
513 currentHandlersTable = handlersTable;
514 }
515 }
516 ADVANCE(offset);
517 }
518 HANDLE_INSTRUCTION_END();
519
520 HANDLE_INSTRUCTION_START(GOTO_16) {
521 int16_t offset = inst->VRegA_20t();
522 if (IsBackwardBranch(offset)) {
523 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
524 currentHandlersTable = instrumentationHandlersTable;
525 } else {
526 currentHandlersTable = handlersTable;
527 }
528 }
529 ADVANCE(offset);
530 }
531 HANDLE_INSTRUCTION_END();
532
533 HANDLE_INSTRUCTION_START(GOTO_32) {
534 int32_t offset = inst->VRegA_30t();
535 if (IsBackwardBranch(offset)) {
536 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
537 currentHandlersTable = instrumentationHandlersTable;
538 } else {
539 currentHandlersTable = handlersTable;
540 }
541 }
542 ADVANCE(offset);
543 }
544 HANDLE_INSTRUCTION_END();
545
546 HANDLE_INSTRUCTION_START(PACKED_SWITCH) {
547 int32_t offset = DoPackedSwitch(inst, shadow_frame);
548 if (IsBackwardBranch(offset)) {
549 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
550 currentHandlersTable = instrumentationHandlersTable;
551 } else {
552 currentHandlersTable = handlersTable;
553 }
554 }
555 ADVANCE(offset);
556 }
557 HANDLE_INSTRUCTION_END();
558
559 HANDLE_INSTRUCTION_START(SPARSE_SWITCH) {
560 int32_t offset = DoSparseSwitch(inst, shadow_frame);
561 if (IsBackwardBranch(offset)) {
562 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
563 currentHandlersTable = instrumentationHandlersTable;
564 } else {
565 currentHandlersTable = handlersTable;
566 }
567 }
568 ADVANCE(offset);
569 }
570 HANDLE_INSTRUCTION_END();
571
572 HANDLE_INSTRUCTION_START(CMPL_FLOAT) {
573 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
574 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
575 int32_t result;
576 if (val1 > val2) {
577 result = 1;
578 } else if (val1 == val2) {
579 result = 0;
580 } else {
581 result = -1;
582 }
583 shadow_frame.SetVReg(inst->VRegA_23x(), result);
584 ADVANCE(2);
585 }
586 HANDLE_INSTRUCTION_END();
587
588 HANDLE_INSTRUCTION_START(CMPG_FLOAT) {
589 float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x());
590 float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x());
591 int32_t result;
592 if (val1 < val2) {
593 result = -1;
594 } else if (val1 == val2) {
595 result = 0;
596 } else {
597 result = 1;
598 }
599 shadow_frame.SetVReg(inst->VRegA_23x(), result);
600 ADVANCE(2);
601 }
602 HANDLE_INSTRUCTION_END();
603
604 HANDLE_INSTRUCTION_START(CMPL_DOUBLE) {
605 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
606 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
607 int32_t result;
608 if (val1 > val2) {
609 result = 1;
610 } else if (val1 == val2) {
611 result = 0;
612 } else {
613 result = -1;
614 }
615 shadow_frame.SetVReg(inst->VRegA_23x(), result);
616 ADVANCE(2);
617 }
618 HANDLE_INSTRUCTION_END();
619
620 HANDLE_INSTRUCTION_START(CMPG_DOUBLE) {
621 double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x());
622 double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x());
623 int32_t result;
624 if (val1 < val2) {
625 result = -1;
626 } else if (val1 == val2) {
627 result = 0;
628 } else {
629 result = 1;
630 }
631 shadow_frame.SetVReg(inst->VRegA_23x(), result);
632 ADVANCE(2);
633 }
634 HANDLE_INSTRUCTION_END();
635
636 HANDLE_INSTRUCTION_START(CMP_LONG) {
637 int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x());
638 int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x());
639 int32_t result;
640 if (val1 > val2) {
641 result = 1;
642 } else if (val1 == val2) {
643 result = 0;
644 } else {
645 result = -1;
646 }
647 shadow_frame.SetVReg(inst->VRegA_23x(), result);
648 ADVANCE(2);
649 }
650 HANDLE_INSTRUCTION_END();
651
652 HANDLE_INSTRUCTION_START(IF_EQ) {
653 if (shadow_frame.GetVReg(inst->VRegA_22t()) == shadow_frame.GetVReg(inst->VRegB_22t())) {
654 int16_t offset = inst->VRegC_22t();
655 if (IsBackwardBranch(offset)) {
656 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
657 currentHandlersTable = instrumentationHandlersTable;
658 } else {
659 currentHandlersTable = handlersTable;
660 }
661 }
662 ADVANCE(offset);
663 } else {
664 ADVANCE(2);
665 }
666 }
667 HANDLE_INSTRUCTION_END();
668
669 HANDLE_INSTRUCTION_START(IF_NE) {
670 if (shadow_frame.GetVReg(inst->VRegA_22t()) != shadow_frame.GetVReg(inst->VRegB_22t())) {
671 int16_t offset = inst->VRegC_22t();
672 if (IsBackwardBranch(offset)) {
673 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
674 currentHandlersTable = instrumentationHandlersTable;
675 } else {
676 currentHandlersTable = handlersTable;
677 }
678 }
679 ADVANCE(offset);
680 } else {
681 ADVANCE(2);
682 }
683 }
684 HANDLE_INSTRUCTION_END();
685
686 HANDLE_INSTRUCTION_START(IF_LT) {
687 if (shadow_frame.GetVReg(inst->VRegA_22t()) < shadow_frame.GetVReg(inst->VRegB_22t())) {
688 int16_t offset = inst->VRegC_22t();
689 if (IsBackwardBranch(offset)) {
690 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
691 currentHandlersTable = instrumentationHandlersTable;
692 } else {
693 currentHandlersTable = handlersTable;
694 }
695 }
696 ADVANCE(offset);
697 } else {
698 ADVANCE(2);
699 }
700 }
701 HANDLE_INSTRUCTION_END();
702
703 HANDLE_INSTRUCTION_START(IF_GE) {
704 if (shadow_frame.GetVReg(inst->VRegA_22t()) >= shadow_frame.GetVReg(inst->VRegB_22t())) {
705 int16_t offset = inst->VRegC_22t();
706 if (IsBackwardBranch(offset)) {
707 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
708 currentHandlersTable = instrumentationHandlersTable;
709 } else {
710 currentHandlersTable = handlersTable;
711 }
712 }
713 ADVANCE(offset);
714 } else {
715 ADVANCE(2);
716 }
717 }
718 HANDLE_INSTRUCTION_END();
719
720 HANDLE_INSTRUCTION_START(IF_GT) {
721 if (shadow_frame.GetVReg(inst->VRegA_22t()) > shadow_frame.GetVReg(inst->VRegB_22t())) {
722 int16_t offset = inst->VRegC_22t();
723 if (IsBackwardBranch(offset)) {
724 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
725 currentHandlersTable = instrumentationHandlersTable;
726 } else {
727 currentHandlersTable = handlersTable;
728 }
729 }
730 ADVANCE(offset);
731 } else {
732 ADVANCE(2);
733 }
734 }
735 HANDLE_INSTRUCTION_END();
736
737 HANDLE_INSTRUCTION_START(IF_LE) {
738 if (shadow_frame.GetVReg(inst->VRegA_22t()) <= shadow_frame.GetVReg(inst->VRegB_22t())) {
739 int16_t offset = inst->VRegC_22t();
740 if (IsBackwardBranch(offset)) {
741 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
742 currentHandlersTable = instrumentationHandlersTable;
743 } else {
744 currentHandlersTable = handlersTable;
745 }
746 }
747 ADVANCE(offset);
748 } else {
749 ADVANCE(2);
750 }
751 }
752 HANDLE_INSTRUCTION_END();
753
754 HANDLE_INSTRUCTION_START(IF_EQZ) {
755 if (shadow_frame.GetVReg(inst->VRegA_21t()) == 0) {
756 int16_t offset = inst->VRegB_21t();
757 if (IsBackwardBranch(offset)) {
758 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
759 currentHandlersTable = instrumentationHandlersTable;
760 } else {
761 currentHandlersTable = handlersTable;
762 }
763 }
764 ADVANCE(offset);
765 } else {
766 ADVANCE(2);
767 }
768 }
769 HANDLE_INSTRUCTION_END();
770
771 HANDLE_INSTRUCTION_START(IF_NEZ) {
772 if (shadow_frame.GetVReg(inst->VRegA_21t()) != 0) {
773 int16_t offset = inst->VRegB_21t();
774 if (IsBackwardBranch(offset)) {
775 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
776 currentHandlersTable = instrumentationHandlersTable;
777 } else {
778 currentHandlersTable = handlersTable;
779 }
780 }
781 ADVANCE(offset);
782 } else {
783 ADVANCE(2);
784 }
785 }
786 HANDLE_INSTRUCTION_END();
787
788 HANDLE_INSTRUCTION_START(IF_LTZ) {
789 if (shadow_frame.GetVReg(inst->VRegA_21t()) < 0) {
790 int16_t offset = inst->VRegB_21t();
791 if (IsBackwardBranch(offset)) {
792 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
793 currentHandlersTable = instrumentationHandlersTable;
794 } else {
795 currentHandlersTable = handlersTable;
796 }
797 }
798 ADVANCE(offset);
799 } else {
800 ADVANCE(2);
801 }
802 }
803 HANDLE_INSTRUCTION_END();
804
805 HANDLE_INSTRUCTION_START(IF_GEZ) {
806 if (shadow_frame.GetVReg(inst->VRegA_21t()) >= 0) {
807 int16_t offset = inst->VRegB_21t();
808 if (IsBackwardBranch(offset)) {
809 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
810 currentHandlersTable = instrumentationHandlersTable;
811 } else {
812 currentHandlersTable = handlersTable;
813 }
814 }
815 ADVANCE(offset);
816 } else {
817 ADVANCE(2);
818 }
819 }
820 HANDLE_INSTRUCTION_END();
821
822 HANDLE_INSTRUCTION_START(IF_GTZ) {
823 if (shadow_frame.GetVReg(inst->VRegA_21t()) > 0) {
824 int16_t offset = inst->VRegB_21t();
825 if (IsBackwardBranch(offset)) {
826 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
827 currentHandlersTable = instrumentationHandlersTable;
828 } else {
829 currentHandlersTable = handlersTable;
830 }
831 }
832 ADVANCE(offset);
833 } else {
834 ADVANCE(2);
835 }
836 }
837 HANDLE_INSTRUCTION_END();
838
839 HANDLE_INSTRUCTION_START(IF_LEZ) {
840 if (shadow_frame.GetVReg(inst->VRegA_21t()) <= 0) {
841 int16_t offset = inst->VRegB_21t();
842 if (IsBackwardBranch(offset)) {
843 if (UNLIKELY(instrumentation->HasDexPcListeners())) {
844 currentHandlersTable = instrumentationHandlersTable;
845 } else {
846 currentHandlersTable = handlersTable;
847 }
848 }
849 ADVANCE(offset);
850 } else {
851 ADVANCE(2);
852 }
853 }
854 HANDLE_INSTRUCTION_END();
855
856 HANDLE_INSTRUCTION_START(AGET_BOOLEAN) {
857 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
858 if (UNLIKELY(a == NULL)) {
859 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
860 HANDLE_PENDING_EXCEPTION();
861 } else {
862 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
863 BooleanArray* array = a->AsBooleanArray();
864 if (LIKELY(array->IsValidIndex(index))) {
865 shadow_frame.SetVReg(inst->VRegA_23x(), array->GetData()[index]);
866 ADVANCE(2);
867 } else {
868 HANDLE_PENDING_EXCEPTION();
869 }
870 }
871 }
872 HANDLE_INSTRUCTION_END();
873
874 HANDLE_INSTRUCTION_START(AGET_BYTE) {
875 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
876 if (UNLIKELY(a == NULL)) {
877 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
878 HANDLE_PENDING_EXCEPTION();
879 } else {
880 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
881 ByteArray* array = a->AsByteArray();
882 if (LIKELY(array->IsValidIndex(index))) {
883 shadow_frame.SetVReg(inst->VRegA_23x(), array->GetData()[index]);
884 ADVANCE(2);
885 } else {
886 HANDLE_PENDING_EXCEPTION();
887 }
888 }
889 }
890 HANDLE_INSTRUCTION_END();
891
892 HANDLE_INSTRUCTION_START(AGET_CHAR) {
893 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
894 if (UNLIKELY(a == NULL)) {
895 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
896 HANDLE_PENDING_EXCEPTION();
897 } else {
898 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
899 CharArray* array = a->AsCharArray();
900 if (LIKELY(array->IsValidIndex(index))) {
901 shadow_frame.SetVReg(inst->VRegA_23x(), array->GetData()[index]);
902 ADVANCE(2);
903 } else {
904 HANDLE_PENDING_EXCEPTION();
905 }
906 }
907 }
908 HANDLE_INSTRUCTION_END();
909
910 HANDLE_INSTRUCTION_START(AGET_SHORT) {
911 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
912 if (UNLIKELY(a == NULL)) {
913 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
914 HANDLE_PENDING_EXCEPTION();
915 } else {
916 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
917 ShortArray* array = a->AsShortArray();
918 if (LIKELY(array->IsValidIndex(index))) {
919 shadow_frame.SetVReg(inst->VRegA_23x(), array->GetData()[index]);
920 ADVANCE(2);
921 } else {
922 HANDLE_PENDING_EXCEPTION();
923 }
924 }
925 }
926 HANDLE_INSTRUCTION_END();
927
928 HANDLE_INSTRUCTION_START(AGET) {
929 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
930 if (UNLIKELY(a == NULL)) {
931 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
932 HANDLE_PENDING_EXCEPTION();
933 } else {
934 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
935 IntArray* array = a->AsIntArray();
936 if (LIKELY(array->IsValidIndex(index))) {
937 shadow_frame.SetVReg(inst->VRegA_23x(), array->GetData()[index]);
938 ADVANCE(2);
939 } else {
940 HANDLE_PENDING_EXCEPTION();
941 }
942 }
943 }
944 HANDLE_INSTRUCTION_END();
945
946 HANDLE_INSTRUCTION_START(AGET_WIDE) {
947 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
948 if (UNLIKELY(a == NULL)) {
949 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
950 HANDLE_PENDING_EXCEPTION();
951 } else {
952 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
953 LongArray* array = a->AsLongArray();
954 if (LIKELY(array->IsValidIndex(index))) {
955 shadow_frame.SetVRegLong(inst->VRegA_23x(), array->GetData()[index]);
956 ADVANCE(2);
957 } else {
958 HANDLE_PENDING_EXCEPTION();
959 }
960 }
961 }
962 HANDLE_INSTRUCTION_END();
963
964 HANDLE_INSTRUCTION_START(AGET_OBJECT) {
965 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
966 if (UNLIKELY(a == NULL)) {
967 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
968 HANDLE_PENDING_EXCEPTION();
969 } else {
970 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
971 ObjectArray<Object>* array = a->AsObjectArray<Object>();
972 if (LIKELY(array->IsValidIndex(index))) {
973 shadow_frame.SetVRegReference(inst->VRegA_23x(), array->GetWithoutChecks(index));
974 ADVANCE(2);
975 } else {
976 HANDLE_PENDING_EXCEPTION();
977 }
978 }
979 }
980 HANDLE_INSTRUCTION_END();
981
982 HANDLE_INSTRUCTION_START(APUT_BOOLEAN) {
983 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
984 if (UNLIKELY(a == NULL)) {
985 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
986 HANDLE_PENDING_EXCEPTION();
987 } else {
988 uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x());
989 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
990 BooleanArray* array = a->AsBooleanArray();
991 if (LIKELY(array->IsValidIndex(index))) {
992 array->GetData()[index] = val;
993 ADVANCE(2);
994 } else {
995 HANDLE_PENDING_EXCEPTION();
996 }
997 }
998 }
999 HANDLE_INSTRUCTION_END();
1000
1001 HANDLE_INSTRUCTION_START(APUT_BYTE) {
1002 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1003 if (UNLIKELY(a == NULL)) {
1004 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1005 HANDLE_PENDING_EXCEPTION();
1006 } else {
1007 int8_t val = shadow_frame.GetVReg(inst->VRegA_23x());
1008 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1009 ByteArray* array = a->AsByteArray();
1010 if (LIKELY(array->IsValidIndex(index))) {
1011 array->GetData()[index] = val;
1012 ADVANCE(2);
1013 } else {
1014 HANDLE_PENDING_EXCEPTION();
1015 }
1016 }
1017 }
1018 HANDLE_INSTRUCTION_END();
1019
1020 HANDLE_INSTRUCTION_START(APUT_CHAR) {
1021 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1022 if (UNLIKELY(a == NULL)) {
1023 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1024 HANDLE_PENDING_EXCEPTION();
1025 } else {
1026 uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x());
1027 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1028 CharArray* array = a->AsCharArray();
1029 if (LIKELY(array->IsValidIndex(index))) {
1030 array->GetData()[index] = val;
1031 ADVANCE(2);
1032 } else {
1033 HANDLE_PENDING_EXCEPTION();
1034 }
1035 }
1036 }
1037 HANDLE_INSTRUCTION_END();
1038
1039 HANDLE_INSTRUCTION_START(APUT_SHORT) {
1040 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1041 if (UNLIKELY(a == NULL)) {
1042 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1043 HANDLE_PENDING_EXCEPTION();
1044 } else {
1045 int16_t val = shadow_frame.GetVReg(inst->VRegA_23x());
1046 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1047 ShortArray* array = a->AsShortArray();
1048 if (LIKELY(array->IsValidIndex(index))) {
1049 array->GetData()[index] = val;
1050 ADVANCE(2);
1051 } else {
1052 HANDLE_PENDING_EXCEPTION();
1053 }
1054 }
1055 }
1056 HANDLE_INSTRUCTION_END();
1057
1058 HANDLE_INSTRUCTION_START(APUT) {
1059 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1060 if (UNLIKELY(a == NULL)) {
1061 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1062 HANDLE_PENDING_EXCEPTION();
1063 } else {
1064 int32_t val = shadow_frame.GetVReg(inst->VRegA_23x());
1065 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1066 IntArray* array = a->AsIntArray();
1067 if (LIKELY(array->IsValidIndex(index))) {
1068 array->GetData()[index] = val;
1069 ADVANCE(2);
1070 } else {
1071 HANDLE_PENDING_EXCEPTION();
1072 }
1073 }
1074 }
1075 HANDLE_INSTRUCTION_END();
1076
1077 HANDLE_INSTRUCTION_START(APUT_WIDE) {
1078 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1079 if (UNLIKELY(a == NULL)) {
1080 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1081 HANDLE_PENDING_EXCEPTION();
1082 } else {
1083 int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x());
1084 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1085 LongArray* array = a->AsLongArray();
1086 if (LIKELY(array->IsValidIndex(index))) {
1087 array->GetData()[index] = val;
1088 ADVANCE(2);
1089 } else {
1090 HANDLE_PENDING_EXCEPTION();
1091 }
1092 }
1093 }
1094 HANDLE_INSTRUCTION_END();
1095
1096 HANDLE_INSTRUCTION_START(APUT_OBJECT) {
1097 Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x());
1098 if (UNLIKELY(a == NULL)) {
1099 ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow());
1100 HANDLE_PENDING_EXCEPTION();
1101 } else {
1102 int32_t index = shadow_frame.GetVReg(inst->VRegC_23x());
1103 Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x());
1104 ObjectArray<Object>* array = a->AsObjectArray<Object>();
1105 if (LIKELY(array->IsValidIndex(index) && array->CheckAssignable(val))) {
1106 array->SetWithoutChecks(index, val);
1107 ADVANCE(2);
1108 } else {
1109 HANDLE_PENDING_EXCEPTION();
1110 }
1111 }
1112 }
1113 HANDLE_INSTRUCTION_END();
1114
1115 HANDLE_INSTRUCTION_START(IGET_BOOLEAN) {
1116 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst);
1117 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1118 }
1119 HANDLE_INSTRUCTION_END();
1120
1121 HANDLE_INSTRUCTION_START(IGET_BYTE) {
1122 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst);
1123 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1124 }
1125 HANDLE_INSTRUCTION_END();
1126
1127 HANDLE_INSTRUCTION_START(IGET_CHAR) {
1128 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst);
1129 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1130 }
1131 HANDLE_INSTRUCTION_END();
1132
1133 HANDLE_INSTRUCTION_START(IGET_SHORT) {
1134 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst);
1135 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1136 }
1137 HANDLE_INSTRUCTION_END();
1138
1139 HANDLE_INSTRUCTION_START(IGET) {
1140 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst);
1141 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1142 }
1143 HANDLE_INSTRUCTION_END();
1144
1145 HANDLE_INSTRUCTION_START(IGET_WIDE) {
1146 bool success = DoFieldGet<InstancePrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst);
1147 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1148 }
1149 HANDLE_INSTRUCTION_END();
1150
1151 HANDLE_INSTRUCTION_START(IGET_OBJECT) {
1152 bool success = DoFieldGet<InstanceObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst);
1153 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1154 }
1155 HANDLE_INSTRUCTION_END();
1156
1157 HANDLE_INSTRUCTION_START(IGET_QUICK) {
1158 bool success = DoIGetQuick<Primitive::kPrimInt>(self, shadow_frame, inst);
1159 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1160 }
1161 HANDLE_INSTRUCTION_END();
1162
1163 HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) {
1164 bool success = DoIGetQuick<Primitive::kPrimLong>(self, shadow_frame, inst);
1165 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1166 }
1167 HANDLE_INSTRUCTION_END();
1168
1169 HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) {
1170 bool success = DoIGetQuick<Primitive::kPrimNot>(self, shadow_frame, inst);
1171 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1172 }
1173 HANDLE_INSTRUCTION_END();
1174
1175 HANDLE_INSTRUCTION_START(SGET_BOOLEAN) {
1176 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst);
1177 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1178 }
1179 HANDLE_INSTRUCTION_END();
1180
1181 HANDLE_INSTRUCTION_START(SGET_BYTE) {
1182 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst);
1183 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1184 }
1185 HANDLE_INSTRUCTION_END();
1186
1187 HANDLE_INSTRUCTION_START(SGET_CHAR) {
1188 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst);
1189 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1190 }
1191 HANDLE_INSTRUCTION_END();
1192
1193 HANDLE_INSTRUCTION_START(SGET_SHORT) {
1194 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst);
1195 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1196 }
1197 HANDLE_INSTRUCTION_END();
1198
1199 HANDLE_INSTRUCTION_START(SGET) {
1200 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst);
1201 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1202 }
1203 HANDLE_INSTRUCTION_END();
1204
1205 HANDLE_INSTRUCTION_START(SGET_WIDE) {
1206 bool success = DoFieldGet<StaticPrimitiveRead, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst);
1207 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1208 }
1209 HANDLE_INSTRUCTION_END();
1210
1211 HANDLE_INSTRUCTION_START(SGET_OBJECT) {
1212 bool success = DoFieldGet<StaticObjectRead, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst);
1213 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1214 }
1215 HANDLE_INSTRUCTION_END();
1216
1217 HANDLE_INSTRUCTION_START(IPUT_BOOLEAN) {
1218 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst);
1219 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1220 }
1221 HANDLE_INSTRUCTION_END();
1222
1223 HANDLE_INSTRUCTION_START(IPUT_BYTE) {
1224 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst);
1225 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1226 }
1227 HANDLE_INSTRUCTION_END();
1228
1229 HANDLE_INSTRUCTION_START(IPUT_CHAR) {
1230 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst);
1231 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1232 }
1233 HANDLE_INSTRUCTION_END();
1234
1235 HANDLE_INSTRUCTION_START(IPUT_SHORT) {
1236 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst);
1237 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1238 }
1239 HANDLE_INSTRUCTION_END();
1240
1241 HANDLE_INSTRUCTION_START(IPUT) {
1242 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst);
1243 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1244 }
1245 HANDLE_INSTRUCTION_END();
1246
1247 HANDLE_INSTRUCTION_START(IPUT_WIDE) {
1248 bool success = DoFieldPut<InstancePrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst);
1249 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1250 }
1251 HANDLE_INSTRUCTION_END();
1252
1253 HANDLE_INSTRUCTION_START(IPUT_OBJECT) {
1254 bool success = DoFieldPut<InstanceObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst);
1255 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1256 }
1257 HANDLE_INSTRUCTION_END();
1258
1259 HANDLE_INSTRUCTION_START(IPUT_QUICK) {
1260 bool success = DoIPutQuick<Primitive::kPrimInt>(self, shadow_frame, inst);
1261 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1262 }
1263 HANDLE_INSTRUCTION_END();
1264
1265 HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) {
1266 bool success = DoIPutQuick<Primitive::kPrimLong>(self, shadow_frame, inst);
1267 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1268 }
1269 HANDLE_INSTRUCTION_END();
1270
1271 HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) {
1272 bool success = DoIPutQuick<Primitive::kPrimNot>(self, shadow_frame, inst);
1273 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1274 }
1275 HANDLE_INSTRUCTION_END();
1276
1277 HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) {
1278 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimBoolean, do_access_check>(self, shadow_frame, inst);
1279 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1280 }
1281 HANDLE_INSTRUCTION_END();
1282
1283 HANDLE_INSTRUCTION_START(SPUT_BYTE) {
1284 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimByte, do_access_check>(self, shadow_frame, inst);
1285 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1286 }
1287 HANDLE_INSTRUCTION_END();
1288
1289 HANDLE_INSTRUCTION_START(SPUT_CHAR) {
1290 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimChar, do_access_check>(self, shadow_frame, inst);
1291 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1292 }
1293 HANDLE_INSTRUCTION_END();
1294
1295 HANDLE_INSTRUCTION_START(SPUT_SHORT) {
1296 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimShort, do_access_check>(self, shadow_frame, inst);
1297 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1298 }
1299 HANDLE_INSTRUCTION_END();
1300
1301 HANDLE_INSTRUCTION_START(SPUT) {
1302 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimInt, do_access_check>(self, shadow_frame, inst);
1303 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1304 }
1305 HANDLE_INSTRUCTION_END();
1306
1307 HANDLE_INSTRUCTION_START(SPUT_WIDE) {
1308 bool success = DoFieldPut<StaticPrimitiveWrite, Primitive::kPrimLong, do_access_check>(self, shadow_frame, inst);
1309 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1310 }
1311 HANDLE_INSTRUCTION_END();
1312
1313 HANDLE_INSTRUCTION_START(SPUT_OBJECT) {
1314 bool success = DoFieldPut<StaticObjectWrite, Primitive::kPrimNot, do_access_check>(self, shadow_frame, inst);
1315 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1316 }
1317 HANDLE_INSTRUCTION_END();
1318
1319 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
1320 bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, &result_register);
1321 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1322 }
1323 HANDLE_INSTRUCTION_END();
1324
1325 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
1326 bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, &result_register);
1327 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1328 }
1329 HANDLE_INSTRUCTION_END();
1330
1331 HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
1332 bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, &result_register);
1333 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1334 }
1335 HANDLE_INSTRUCTION_END();
1336
1337 HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
1338 bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, &result_register);
1339 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1340 }
1341 HANDLE_INSTRUCTION_END();
1342
1343 HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
1344 bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, &result_register);
1345 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1346 }
1347 HANDLE_INSTRUCTION_END();
1348
1349 HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
1350 bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, &result_register);
1351 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1352 }
1353 HANDLE_INSTRUCTION_END();
1354
1355 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
1356 bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, &result_register);
1357 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1358 }
1359 HANDLE_INSTRUCTION_END();
1360
1361 HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
1362 bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, &result_register);
1363 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1364 }
1365 HANDLE_INSTRUCTION_END();
1366
1367 HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
1368 bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, &result_register);
1369 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1370 }
1371 HANDLE_INSTRUCTION_END();
1372
1373 HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
1374 bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, &result_register);
1375 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1376 }
1377 HANDLE_INSTRUCTION_END();
1378
1379 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
1380 bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, &result_register);
1381 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1382 }
1383 HANDLE_INSTRUCTION_END();
1384
1385 HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
1386 bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, &result_register);
1387 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
1388 }
1389 HANDLE_INSTRUCTION_END();
1390
1391 HANDLE_INSTRUCTION_START(NEG_INT)
1392 shadow_frame.SetVReg(inst->VRegA_12x(), -shadow_frame.GetVReg(inst->VRegB_12x()));
1393 ADVANCE(1);
1394 HANDLE_INSTRUCTION_END();
1395
1396 HANDLE_INSTRUCTION_START(NOT_INT)
1397 shadow_frame.SetVReg(inst->VRegA_12x(), ~shadow_frame.GetVReg(inst->VRegB_12x()));
1398 ADVANCE(1);
1399 HANDLE_INSTRUCTION_END();
1400
1401 HANDLE_INSTRUCTION_START(NEG_LONG)
1402 shadow_frame.SetVRegLong(inst->VRegA_12x(), -shadow_frame.GetVRegLong(inst->VRegB_12x()));
1403 ADVANCE(1);
1404 HANDLE_INSTRUCTION_END();
1405
1406 HANDLE_INSTRUCTION_START(NOT_LONG)
1407 shadow_frame.SetVRegLong(inst->VRegA_12x(), ~shadow_frame.GetVRegLong(inst->VRegB_12x()));
1408 ADVANCE(1);
1409 HANDLE_INSTRUCTION_END();
1410
1411 HANDLE_INSTRUCTION_START(NEG_FLOAT)
1412 shadow_frame.SetVRegFloat(inst->VRegA_12x(), -shadow_frame.GetVRegFloat(inst->VRegB_12x()));
1413 ADVANCE(1);
1414 HANDLE_INSTRUCTION_END();
1415
1416 HANDLE_INSTRUCTION_START(NEG_DOUBLE)
1417 shadow_frame.SetVRegDouble(inst->VRegA_12x(), -shadow_frame.GetVRegDouble(inst->VRegB_12x()));
1418 ADVANCE(1);
1419 HANDLE_INSTRUCTION_END();
1420
1421 HANDLE_INSTRUCTION_START(INT_TO_LONG)
1422 shadow_frame.SetVRegLong(inst->VRegA_12x(), shadow_frame.GetVReg(inst->VRegB_12x()));
1423 ADVANCE(1);
1424 HANDLE_INSTRUCTION_END();
1425
1426 HANDLE_INSTRUCTION_START(INT_TO_FLOAT)
1427 shadow_frame.SetVRegFloat(inst->VRegA_12x(), shadow_frame.GetVReg(inst->VRegB_12x()));
1428 ADVANCE(1);
1429 HANDLE_INSTRUCTION_END();
1430
1431 HANDLE_INSTRUCTION_START(INT_TO_DOUBLE)
1432 shadow_frame.SetVRegDouble(inst->VRegA_12x(), shadow_frame.GetVReg(inst->VRegB_12x()));
1433 ADVANCE(1);
1434 HANDLE_INSTRUCTION_END();
1435
1436 HANDLE_INSTRUCTION_START(LONG_TO_INT)
1437 shadow_frame.SetVReg(inst->VRegA_12x(), shadow_frame.GetVRegLong(inst->VRegB_12x()));
1438 ADVANCE(1);
1439 HANDLE_INSTRUCTION_END();
1440
1441 HANDLE_INSTRUCTION_START(LONG_TO_FLOAT)
1442 shadow_frame.SetVRegFloat(inst->VRegA_12x(), shadow_frame.GetVRegLong(inst->VRegB_12x()));
1443 ADVANCE(1);
1444 HANDLE_INSTRUCTION_END();
1445
1446 HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE)
1447 shadow_frame.SetVRegDouble(inst->VRegA_12x(), shadow_frame.GetVRegLong(inst->VRegB_12x()));
1448 ADVANCE(1);
1449 HANDLE_INSTRUCTION_END();
1450
1451 HANDLE_INSTRUCTION_START(FLOAT_TO_INT) {
1452 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x());
1453 int32_t result;
1454 if (val != val) {
1455 result = 0;
1456 } else if (val > static_cast<float>(kMaxInt)) {
1457 result = kMaxInt;
1458 } else if (val < static_cast<float>(kMinInt)) {
1459 result = kMinInt;
1460 } else {
1461 result = val;
1462 }
1463 shadow_frame.SetVReg(inst->VRegA_12x(), result);
1464 ADVANCE(1);
1465 }
1466 HANDLE_INSTRUCTION_END();
1467
1468 HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) {
1469 float val = shadow_frame.GetVRegFloat(inst->VRegB_12x());
1470 int64_t result;
1471 if (val != val) {
1472 result = 0;
1473 } else if (val > static_cast<float>(kMaxLong)) {
1474 result = kMaxLong;
1475 } else if (val < static_cast<float>(kMinLong)) {
1476 result = kMinLong;
1477 } else {
1478 result = val;
1479 }
1480 shadow_frame.SetVRegLong(inst->VRegA_12x(), result);
1481 ADVANCE(1);
1482 }
1483 HANDLE_INSTRUCTION_END();
1484
1485 HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE)
1486 shadow_frame.SetVRegDouble(inst->VRegA_12x(), shadow_frame.GetVRegFloat(inst->VRegB_12x()));
1487 ADVANCE(1);
1488 HANDLE_INSTRUCTION_END();
1489
1490 HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) {
1491 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x());
1492 int32_t result;
1493 if (val != val) {
1494 result = 0;
1495 } else if (val > static_cast<double>(kMaxInt)) {
1496 result = kMaxInt;
1497 } else if (val < static_cast<double>(kMinInt)) {
1498 result = kMinInt;
1499 } else {
1500 result = val;
1501 }
1502 shadow_frame.SetVReg(inst->VRegA_12x(), result);
1503 ADVANCE(1);
1504 }
1505 HANDLE_INSTRUCTION_END();
1506
1507 HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) {
1508 double val = shadow_frame.GetVRegDouble(inst->VRegB_12x());
1509 int64_t result;
1510 if (val != val) {
1511 result = 0;
1512 } else if (val > static_cast<double>(kMaxLong)) {
1513 result = kMaxLong;
1514 } else if (val < static_cast<double>(kMinLong)) {
1515 result = kMinLong;
1516 } else {
1517 result = val;
1518 }
1519 shadow_frame.SetVRegLong(inst->VRegA_12x(), result);
1520 ADVANCE(1);
1521 }
1522 HANDLE_INSTRUCTION_END();
1523
1524 HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT)
1525 shadow_frame.SetVRegFloat(inst->VRegA_12x(), shadow_frame.GetVRegDouble(inst->VRegB_12x()));
1526 ADVANCE(1);
1527 HANDLE_INSTRUCTION_END();
1528
1529 HANDLE_INSTRUCTION_START(INT_TO_BYTE)
1530 shadow_frame.SetVReg(inst->VRegA_12x(),
1531 static_cast<int8_t>(shadow_frame.GetVReg(inst->VRegB_12x())));
1532 ADVANCE(1);
1533 HANDLE_INSTRUCTION_END();
1534
1535 HANDLE_INSTRUCTION_START(INT_TO_CHAR)
1536 shadow_frame.SetVReg(inst->VRegA_12x(),
1537 static_cast<uint16_t>(shadow_frame.GetVReg(inst->VRegB_12x())));
1538 ADVANCE(1);
1539 HANDLE_INSTRUCTION_END();
1540
1541 HANDLE_INSTRUCTION_START(INT_TO_SHORT)
1542 shadow_frame.SetVReg(inst->VRegA_12x(),
1543 static_cast<int16_t>(shadow_frame.GetVReg(inst->VRegB_12x())));
1544 ADVANCE(1);
1545 HANDLE_INSTRUCTION_END();
1546
1547 HANDLE_INSTRUCTION_START(ADD_INT)
1548 shadow_frame.SetVReg(inst->VRegA_23x(),
1549 shadow_frame.GetVReg(inst->VRegB_23x()) +
1550 shadow_frame.GetVReg(inst->VRegC_23x()));
1551 ADVANCE(2);
1552 HANDLE_INSTRUCTION_END();
1553
1554 HANDLE_INSTRUCTION_START(SUB_INT)
1555 shadow_frame.SetVReg(inst->VRegA_23x(),
1556 shadow_frame.GetVReg(inst->VRegB_23x()) -
1557 shadow_frame.GetVReg(inst->VRegC_23x()));
1558 ADVANCE(2);
1559 HANDLE_INSTRUCTION_END();
1560
1561 HANDLE_INSTRUCTION_START(MUL_INT)
1562 shadow_frame.SetVReg(inst->VRegA_23x(),
1563 shadow_frame.GetVReg(inst->VRegB_23x()) *
1564 shadow_frame.GetVReg(inst->VRegC_23x()));
1565 ADVANCE(2);
1566 HANDLE_INSTRUCTION_END();
1567
1568 HANDLE_INSTRUCTION_START(DIV_INT) {
1569 bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(),
1570 shadow_frame.GetVReg(inst->VRegB_23x()),
1571 shadow_frame.GetVReg(inst->VRegC_23x()));
1572 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1573 }
1574 HANDLE_INSTRUCTION_END();
1575
1576 HANDLE_INSTRUCTION_START(REM_INT) {
1577 bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(),
1578 shadow_frame.GetVReg(inst->VRegB_23x()),
1579 shadow_frame.GetVReg(inst->VRegC_23x()));
1580 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1581 }
1582 HANDLE_INSTRUCTION_END();
1583
1584 HANDLE_INSTRUCTION_START(SHL_INT)
1585 shadow_frame.SetVReg(inst->VRegA_23x(),
1586 shadow_frame.GetVReg(inst->VRegB_23x()) <<
1587 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1588 ADVANCE(2);
1589 HANDLE_INSTRUCTION_END();
1590
1591 HANDLE_INSTRUCTION_START(SHR_INT)
1592 shadow_frame.SetVReg(inst->VRegA_23x(),
1593 shadow_frame.GetVReg(inst->VRegB_23x()) >>
1594 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1595 ADVANCE(2);
1596 HANDLE_INSTRUCTION_END();
1597
1598 HANDLE_INSTRUCTION_START(USHR_INT)
1599 shadow_frame.SetVReg(inst->VRegA_23x(),
1600 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_23x())) >>
1601 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f));
1602 ADVANCE(2);
1603 HANDLE_INSTRUCTION_END();
1604
1605 HANDLE_INSTRUCTION_START(AND_INT)
1606 shadow_frame.SetVReg(inst->VRegA_23x(),
1607 shadow_frame.GetVReg(inst->VRegB_23x()) &
1608 shadow_frame.GetVReg(inst->VRegC_23x()));
1609 ADVANCE(2);
1610 HANDLE_INSTRUCTION_END();
1611
1612 HANDLE_INSTRUCTION_START(OR_INT)
1613 shadow_frame.SetVReg(inst->VRegA_23x(),
1614 shadow_frame.GetVReg(inst->VRegB_23x()) |
1615 shadow_frame.GetVReg(inst->VRegC_23x()));
1616 ADVANCE(2);
1617 HANDLE_INSTRUCTION_END();
1618
1619 HANDLE_INSTRUCTION_START(XOR_INT)
1620 shadow_frame.SetVReg(inst->VRegA_23x(),
1621 shadow_frame.GetVReg(inst->VRegB_23x()) ^
1622 shadow_frame.GetVReg(inst->VRegC_23x()));
1623 ADVANCE(2);
1624 HANDLE_INSTRUCTION_END();
1625
1626 HANDLE_INSTRUCTION_START(ADD_LONG)
1627 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1628 shadow_frame.GetVRegLong(inst->VRegB_23x()) +
1629 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1630 ADVANCE(2);
1631 HANDLE_INSTRUCTION_END();
1632
1633 HANDLE_INSTRUCTION_START(SUB_LONG)
1634 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1635 shadow_frame.GetVRegLong(inst->VRegB_23x()) -
1636 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1637 ADVANCE(2);
1638 HANDLE_INSTRUCTION_END();
1639
1640 HANDLE_INSTRUCTION_START(MUL_LONG)
1641 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1642 shadow_frame.GetVRegLong(inst->VRegB_23x()) *
1643 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1644 ADVANCE(2);
1645 HANDLE_INSTRUCTION_END();
1646
1647 HANDLE_INSTRUCTION_START(DIV_LONG) {
1648 bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(),
1649 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1650 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1651 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1652 }
1653 HANDLE_INSTRUCTION_END();
1654
1655 HANDLE_INSTRUCTION_START(REM_LONG) {
1656 bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(),
1657 shadow_frame.GetVRegLong(inst->VRegB_23x()),
1658 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1659 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
1660 }
1661 HANDLE_INSTRUCTION_END();
1662
1663 HANDLE_INSTRUCTION_START(AND_LONG)
1664 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1665 shadow_frame.GetVRegLong(inst->VRegB_23x()) &
1666 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1667 ADVANCE(2);
1668 HANDLE_INSTRUCTION_END();
1669
1670 HANDLE_INSTRUCTION_START(OR_LONG)
1671 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1672 shadow_frame.GetVRegLong(inst->VRegB_23x()) |
1673 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1674 ADVANCE(2);
1675 HANDLE_INSTRUCTION_END();
1676
1677 HANDLE_INSTRUCTION_START(XOR_LONG)
1678 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1679 shadow_frame.GetVRegLong(inst->VRegB_23x()) ^
1680 shadow_frame.GetVRegLong(inst->VRegC_23x()));
1681 ADVANCE(2);
1682 HANDLE_INSTRUCTION_END();
1683
1684 HANDLE_INSTRUCTION_START(SHL_LONG)
1685 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1686 shadow_frame.GetVRegLong(inst->VRegB_23x()) <<
1687 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1688 ADVANCE(2);
1689 HANDLE_INSTRUCTION_END();
1690
1691 HANDLE_INSTRUCTION_START(SHR_LONG)
1692 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1693 shadow_frame.GetVRegLong(inst->VRegB_23x()) >>
1694 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1695 ADVANCE(2);
1696 HANDLE_INSTRUCTION_END();
1697
1698 HANDLE_INSTRUCTION_START(USHR_LONG)
1699 shadow_frame.SetVRegLong(inst->VRegA_23x(),
1700 static_cast<uint64_t>(shadow_frame.GetVRegLong(inst->VRegB_23x())) >>
1701 (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f));
1702 ADVANCE(2);
1703 HANDLE_INSTRUCTION_END();
1704
1705 HANDLE_INSTRUCTION_START(ADD_FLOAT)
1706 shadow_frame.SetVRegFloat(inst->VRegA_23x(),
1707 shadow_frame.GetVRegFloat(inst->VRegB_23x()) +
1708 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1709 ADVANCE(2);
1710 HANDLE_INSTRUCTION_END();
1711
1712 HANDLE_INSTRUCTION_START(SUB_FLOAT)
1713 shadow_frame.SetVRegFloat(inst->VRegA_23x(),
1714 shadow_frame.GetVRegFloat(inst->VRegB_23x()) -
1715 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1716 ADVANCE(2);
1717 HANDLE_INSTRUCTION_END();
1718
1719 HANDLE_INSTRUCTION_START(MUL_FLOAT)
1720 shadow_frame.SetVRegFloat(inst->VRegA_23x(),
1721 shadow_frame.GetVRegFloat(inst->VRegB_23x()) *
1722 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1723 ADVANCE(2);
1724 HANDLE_INSTRUCTION_END();
1725
1726 HANDLE_INSTRUCTION_START(DIV_FLOAT)
1727 shadow_frame.SetVRegFloat(inst->VRegA_23x(),
1728 shadow_frame.GetVRegFloat(inst->VRegB_23x()) /
1729 shadow_frame.GetVRegFloat(inst->VRegC_23x()));
1730 ADVANCE(2);
1731 HANDLE_INSTRUCTION_END();
1732
1733 HANDLE_INSTRUCTION_START(REM_FLOAT)
1734 shadow_frame.SetVRegFloat(inst->VRegA_23x(),
1735 fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()),
1736 shadow_frame.GetVRegFloat(inst->VRegC_23x())));
1737 ADVANCE(2);
1738 HANDLE_INSTRUCTION_END();
1739
1740 HANDLE_INSTRUCTION_START(ADD_DOUBLE)
1741 shadow_frame.SetVRegDouble(inst->VRegA_23x(),
1742 shadow_frame.GetVRegDouble(inst->VRegB_23x()) +
1743 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1744 ADVANCE(2);
1745 HANDLE_INSTRUCTION_END();
1746
1747 HANDLE_INSTRUCTION_START(SUB_DOUBLE)
1748 shadow_frame.SetVRegDouble(inst->VRegA_23x(),
1749 shadow_frame.GetVRegDouble(inst->VRegB_23x()) -
1750 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1751 ADVANCE(2);
1752 HANDLE_INSTRUCTION_END();
1753
1754 HANDLE_INSTRUCTION_START(MUL_DOUBLE)
1755 shadow_frame.SetVRegDouble(inst->VRegA_23x(),
1756 shadow_frame.GetVRegDouble(inst->VRegB_23x()) *
1757 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1758 ADVANCE(2);
1759 HANDLE_INSTRUCTION_END();
1760
1761 HANDLE_INSTRUCTION_START(DIV_DOUBLE)
1762 shadow_frame.SetVRegDouble(inst->VRegA_23x(),
1763 shadow_frame.GetVRegDouble(inst->VRegB_23x()) /
1764 shadow_frame.GetVRegDouble(inst->VRegC_23x()));
1765 ADVANCE(2);
1766 HANDLE_INSTRUCTION_END();
1767
1768 HANDLE_INSTRUCTION_START(REM_DOUBLE)
1769 shadow_frame.SetVRegDouble(inst->VRegA_23x(),
1770 fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()),
1771 shadow_frame.GetVRegDouble(inst->VRegC_23x())));
1772 ADVANCE(2);
1773 HANDLE_INSTRUCTION_END();
1774
1775 HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) {
1776 uint32_t vregA = inst->VRegA_12x();
1777 shadow_frame.SetVReg(vregA,
1778 shadow_frame.GetVReg(vregA) +
1779 shadow_frame.GetVReg(inst->VRegB_12x()));
1780 ADVANCE(1);
1781 }
1782 HANDLE_INSTRUCTION_END();
1783
1784 HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) {
1785 uint32_t vregA = inst->VRegA_12x();
1786 shadow_frame.SetVReg(vregA,
1787 shadow_frame.GetVReg(vregA) -
1788 shadow_frame.GetVReg(inst->VRegB_12x()));
1789 ADVANCE(1);
1790 }
1791 HANDLE_INSTRUCTION_END();
1792
1793 HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) {
1794 uint32_t vregA = inst->VRegA_12x();
1795 shadow_frame.SetVReg(vregA,
1796 shadow_frame.GetVReg(vregA) *
1797 shadow_frame.GetVReg(inst->VRegB_12x()));
1798 ADVANCE(1);
1799 }
1800 HANDLE_INSTRUCTION_END();
1801
1802 HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) {
1803 uint32_t vregA = inst->VRegA_12x();
1804 bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
1805 shadow_frame.GetVReg(inst->VRegB_12x()));
1806 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1807 }
1808 HANDLE_INSTRUCTION_END();
1809
1810 HANDLE_INSTRUCTION_START(REM_INT_2ADDR) {
1811 uint32_t vregA = inst->VRegA_12x();
1812 bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA),
1813 shadow_frame.GetVReg(inst->VRegB_12x()));
1814 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1815 }
1816 HANDLE_INSTRUCTION_END();
1817
1818 HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) {
1819 uint32_t vregA = inst->VRegA_12x();
1820 shadow_frame.SetVReg(vregA,
1821 shadow_frame.GetVReg(vregA) <<
1822 (shadow_frame.GetVReg(inst->VRegB_12x()) & 0x1f));
1823 ADVANCE(1);
1824 }
1825 HANDLE_INSTRUCTION_END();
1826
1827 HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) {
1828 uint32_t vregA = inst->VRegA_12x();
1829 shadow_frame.SetVReg(vregA,
1830 shadow_frame.GetVReg(vregA) >>
1831 (shadow_frame.GetVReg(inst->VRegB_12x()) & 0x1f));
1832 ADVANCE(1);
1833 }
1834 HANDLE_INSTRUCTION_END();
1835
1836 HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) {
1837 uint32_t vregA = inst->VRegA_12x();
1838 shadow_frame.SetVReg(vregA,
1839 static_cast<uint32_t>(shadow_frame.GetVReg(vregA)) >>
1840 (shadow_frame.GetVReg(inst->VRegB_12x()) & 0x1f));
1841 ADVANCE(1);
1842 }
1843 HANDLE_INSTRUCTION_END();
1844
1845 HANDLE_INSTRUCTION_START(AND_INT_2ADDR) {
1846 uint32_t vregA = inst->VRegA_12x();
1847 shadow_frame.SetVReg(vregA,
1848 shadow_frame.GetVReg(vregA) &
1849 shadow_frame.GetVReg(inst->VRegB_12x()));
1850 ADVANCE(1);
1851 }
1852 HANDLE_INSTRUCTION_END();
1853
1854 HANDLE_INSTRUCTION_START(OR_INT_2ADDR) {
1855 uint32_t vregA = inst->VRegA_12x();
1856 shadow_frame.SetVReg(vregA,
1857 shadow_frame.GetVReg(vregA) |
1858 shadow_frame.GetVReg(inst->VRegB_12x()));
1859 ADVANCE(1);
1860 }
1861 HANDLE_INSTRUCTION_END();
1862
1863 HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) {
1864 uint32_t vregA = inst->VRegA_12x();
1865 shadow_frame.SetVReg(vregA,
1866 shadow_frame.GetVReg(vregA) ^
1867 shadow_frame.GetVReg(inst->VRegB_12x()));
1868 ADVANCE(1);
1869 }
1870 HANDLE_INSTRUCTION_END();
1871
1872 HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) {
1873 uint32_t vregA = inst->VRegA_12x();
1874 shadow_frame.SetVRegLong(vregA,
1875 shadow_frame.GetVRegLong(vregA) +
1876 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1877 ADVANCE(1);
1878 }
1879 HANDLE_INSTRUCTION_END();
1880
1881 HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) {
1882 uint32_t vregA = inst->VRegA_12x();
1883 shadow_frame.SetVRegLong(vregA,
1884 shadow_frame.GetVRegLong(vregA) -
1885 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1886 ADVANCE(1);
1887 }
1888 HANDLE_INSTRUCTION_END();
1889
1890 HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) {
1891 uint32_t vregA = inst->VRegA_12x();
1892 shadow_frame.SetVRegLong(vregA,
1893 shadow_frame.GetVRegLong(vregA) *
1894 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1895 ADVANCE(1);
1896 }
1897 HANDLE_INSTRUCTION_END();
1898
1899 HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) {
1900 uint32_t vregA = inst->VRegA_12x();
1901 bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
1902 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1903 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1904 }
1905 HANDLE_INSTRUCTION_END();
1906
1907 HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) {
1908 uint32_t vregA = inst->VRegA_12x();
1909 bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA),
1910 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1911 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1);
1912 }
1913 HANDLE_INSTRUCTION_END();
1914
1915 HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) {
1916 uint32_t vregA = inst->VRegA_12x();
1917 shadow_frame.SetVRegLong(vregA,
1918 shadow_frame.GetVRegLong(vregA) &
1919 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1920 ADVANCE(1);
1921 }
1922 HANDLE_INSTRUCTION_END();
1923
1924 HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) {
1925 uint32_t vregA = inst->VRegA_12x();
1926 shadow_frame.SetVRegLong(vregA,
1927 shadow_frame.GetVRegLong(vregA) |
1928 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1929 ADVANCE(1);
1930 }
1931 HANDLE_INSTRUCTION_END();
1932
1933 HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) {
1934 uint32_t vregA = inst->VRegA_12x();
1935 shadow_frame.SetVRegLong(vregA,
1936 shadow_frame.GetVRegLong(vregA) ^
1937 shadow_frame.GetVRegLong(inst->VRegB_12x()));
1938 ADVANCE(1);
1939 }
1940 HANDLE_INSTRUCTION_END();
1941
1942 HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) {
1943 uint32_t vregA = inst->VRegA_12x();
1944 shadow_frame.SetVRegLong(vregA,
1945 shadow_frame.GetVRegLong(vregA) <<
1946 (shadow_frame.GetVReg(inst->VRegB_12x()) & 0x3f));
1947 ADVANCE(1);
1948 }
1949 HANDLE_INSTRUCTION_END();
1950
1951 HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) {
1952 uint32_t vregA = inst->VRegA_12x();
1953 shadow_frame.SetVRegLong(vregA,
1954 shadow_frame.GetVRegLong(vregA) >>
1955 (shadow_frame.GetVReg(inst->VRegB_12x()) & 0x3f));
1956 ADVANCE(1);
1957 }
1958 HANDLE_INSTRUCTION_END();
1959
1960 HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) {
1961 uint32_t vregA = inst->VRegA_12x();
1962 shadow_frame.SetVRegLong(vregA,
1963 static_cast<uint64_t>(shadow_frame.GetVRegLong(vregA)) >>
1964 (shadow_frame.GetVReg(inst->VRegB_12x()) & 0x3f));
1965 ADVANCE(1);
1966 }
1967 HANDLE_INSTRUCTION_END();
1968
1969 HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) {
1970 uint32_t vregA = inst->VRegA_12x();
1971 shadow_frame.SetVRegFloat(vregA,
1972 shadow_frame.GetVRegFloat(vregA) +
1973 shadow_frame.GetVRegFloat(inst->VRegB_12x()));
1974 ADVANCE(1);
1975 }
1976 HANDLE_INSTRUCTION_END();
1977
1978 HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) {
1979 uint32_t vregA = inst->VRegA_12x();
1980 shadow_frame.SetVRegFloat(vregA,
1981 shadow_frame.GetVRegFloat(vregA) -
1982 shadow_frame.GetVRegFloat(inst->VRegB_12x()));
1983 ADVANCE(1);
1984 }
1985 HANDLE_INSTRUCTION_END();
1986
1987 HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) {
1988 uint32_t vregA = inst->VRegA_12x();
1989 shadow_frame.SetVRegFloat(vregA,
1990 shadow_frame.GetVRegFloat(vregA) *
1991 shadow_frame.GetVRegFloat(inst->VRegB_12x()));
1992 ADVANCE(1);
1993 }
1994 HANDLE_INSTRUCTION_END();
1995
1996 HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) {
1997 uint32_t vregA = inst->VRegA_12x();
1998 shadow_frame.SetVRegFloat(vregA,
1999 shadow_frame.GetVRegFloat(vregA) /
2000 shadow_frame.GetVRegFloat(inst->VRegB_12x()));
2001 ADVANCE(1);
2002 }
2003 HANDLE_INSTRUCTION_END();
2004
2005 HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) {
2006 uint32_t vregA = inst->VRegA_12x();
2007 shadow_frame.SetVRegFloat(vregA,
2008 fmodf(shadow_frame.GetVRegFloat(vregA),
2009 shadow_frame.GetVRegFloat(inst->VRegB_12x())));
2010 ADVANCE(1);
2011 }
2012 HANDLE_INSTRUCTION_END();
2013
2014 HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) {
2015 uint32_t vregA = inst->VRegA_12x();
2016 shadow_frame.SetVRegDouble(vregA,
2017 shadow_frame.GetVRegDouble(vregA) +
2018 shadow_frame.GetVRegDouble(inst->VRegB_12x()));
2019 ADVANCE(1);
2020 }
2021 HANDLE_INSTRUCTION_END();
2022
2023 HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) {
2024 uint32_t vregA = inst->VRegA_12x();
2025 shadow_frame.SetVRegDouble(vregA,
2026 shadow_frame.GetVRegDouble(vregA) -
2027 shadow_frame.GetVRegDouble(inst->VRegB_12x()));
2028 ADVANCE(1);
2029 }
2030 HANDLE_INSTRUCTION_END();
2031
2032 HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) {
2033 uint32_t vregA = inst->VRegA_12x();
2034 shadow_frame.SetVRegDouble(vregA,
2035 shadow_frame.GetVRegDouble(vregA) *
2036 shadow_frame.GetVRegDouble(inst->VRegB_12x()));
2037 ADVANCE(1);
2038 }
2039 HANDLE_INSTRUCTION_END();
2040
2041 HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) {
2042 uint32_t vregA = inst->VRegA_12x();
2043 shadow_frame.SetVRegDouble(vregA,
2044 shadow_frame.GetVRegDouble(vregA) /
2045 shadow_frame.GetVRegDouble(inst->VRegB_12x()));
2046 ADVANCE(1);
2047 }
2048 HANDLE_INSTRUCTION_END();
2049
2050 HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) {
2051 uint32_t vregA = inst->VRegA_12x();
2052 shadow_frame.SetVRegDouble(vregA,
2053 fmod(shadow_frame.GetVRegDouble(vregA),
2054 shadow_frame.GetVRegDouble(inst->VRegB_12x())));
2055 ADVANCE(1);
2056 }
2057 HANDLE_INSTRUCTION_END();
2058
2059 HANDLE_INSTRUCTION_START(ADD_INT_LIT16)
2060 shadow_frame.SetVReg(inst->VRegA_22s(),
2061 shadow_frame.GetVReg(inst->VRegB_22s()) +
2062 inst->VRegC_22s());
2063 ADVANCE(2);
2064 HANDLE_INSTRUCTION_END();
2065
2066 HANDLE_INSTRUCTION_START(RSUB_INT)
2067 shadow_frame.SetVReg(inst->VRegA_22s(),
2068 inst->VRegC_22s() -
2069 shadow_frame.GetVReg(inst->VRegB_22s()));
2070 ADVANCE(2);
2071 HANDLE_INSTRUCTION_END();
2072
2073 HANDLE_INSTRUCTION_START(MUL_INT_LIT16)
2074 shadow_frame.SetVReg(inst->VRegA_22s(),
2075 shadow_frame.GetVReg(inst->VRegB_22s()) *
2076 inst->VRegC_22s());
2077 ADVANCE(2);
2078 HANDLE_INSTRUCTION_END();
2079
2080 HANDLE_INSTRUCTION_START(DIV_INT_LIT16) {
2081 bool success = DoIntDivide(shadow_frame, inst->VRegA_22s(),
2082 shadow_frame.GetVReg(inst->VRegB_22s()), inst->VRegC_22s());
2083 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2084 }
2085 HANDLE_INSTRUCTION_END();
2086
2087 HANDLE_INSTRUCTION_START(REM_INT_LIT16) {
2088 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22s(),
2089 shadow_frame.GetVReg(inst->VRegB_22s()), inst->VRegC_22s());
2090 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2091 }
2092 HANDLE_INSTRUCTION_END();
2093
2094 HANDLE_INSTRUCTION_START(AND_INT_LIT16)
2095 shadow_frame.SetVReg(inst->VRegA_22s(),
2096 shadow_frame.GetVReg(inst->VRegB_22s()) &
2097 inst->VRegC_22s());
2098 ADVANCE(2);
2099 HANDLE_INSTRUCTION_END();
2100
2101 HANDLE_INSTRUCTION_START(OR_INT_LIT16)
2102 shadow_frame.SetVReg(inst->VRegA_22s(),
2103 shadow_frame.GetVReg(inst->VRegB_22s()) |
2104 inst->VRegC_22s());
2105 ADVANCE(2);
2106 HANDLE_INSTRUCTION_END();
2107
2108 HANDLE_INSTRUCTION_START(XOR_INT_LIT16)
2109 shadow_frame.SetVReg(inst->VRegA_22s(),
2110 shadow_frame.GetVReg(inst->VRegB_22s()) ^
2111 inst->VRegC_22s());
2112 ADVANCE(2);
2113 HANDLE_INSTRUCTION_END();
2114
2115 HANDLE_INSTRUCTION_START(ADD_INT_LIT8)
2116 shadow_frame.SetVReg(inst->VRegA_22b(),
2117 shadow_frame.GetVReg(inst->VRegB_22b()) +
2118 inst->VRegC_22b());
2119 ADVANCE(2);
2120 HANDLE_INSTRUCTION_END();
2121
2122 HANDLE_INSTRUCTION_START(RSUB_INT_LIT8)
2123 shadow_frame.SetVReg(inst->VRegA_22b(),
2124 inst->VRegC_22b() -
2125 shadow_frame.GetVReg(inst->VRegB_22b()));
2126 ADVANCE(2);
2127 HANDLE_INSTRUCTION_END();
2128
2129 HANDLE_INSTRUCTION_START(MUL_INT_LIT8)
2130 shadow_frame.SetVReg(inst->VRegA_22b(),
2131 shadow_frame.GetVReg(inst->VRegB_22b()) *
2132 inst->VRegC_22b());
2133 ADVANCE(2);
2134 HANDLE_INSTRUCTION_END();
2135
2136 HANDLE_INSTRUCTION_START(DIV_INT_LIT8) {
2137 bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(),
2138 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2139 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2140 }
2141 HANDLE_INSTRUCTION_END();
2142
2143 HANDLE_INSTRUCTION_START(REM_INT_LIT8) {
2144 bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(),
2145 shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b());
2146 POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2);
2147 }
2148 HANDLE_INSTRUCTION_END();
2149
2150 HANDLE_INSTRUCTION_START(AND_INT_LIT8)
2151 shadow_frame.SetVReg(inst->VRegA_22b(),
2152 shadow_frame.GetVReg(inst->VRegB_22b()) &
2153 inst->VRegC_22b());
2154 ADVANCE(2);
2155 HANDLE_INSTRUCTION_END();
2156
2157 HANDLE_INSTRUCTION_START(OR_INT_LIT8)
2158 shadow_frame.SetVReg(inst->VRegA_22b(),
2159 shadow_frame.GetVReg(inst->VRegB_22b()) |
2160 inst->VRegC_22b());
2161 ADVANCE(2);
2162 HANDLE_INSTRUCTION_END();
2163
2164 HANDLE_INSTRUCTION_START(XOR_INT_LIT8)
2165 shadow_frame.SetVReg(inst->VRegA_22b(),
2166 shadow_frame.GetVReg(inst->VRegB_22b()) ^
2167 inst->VRegC_22b());
2168 ADVANCE(2);
2169 HANDLE_INSTRUCTION_END();
2170
2171 HANDLE_INSTRUCTION_START(SHL_INT_LIT8)
2172 shadow_frame.SetVReg(inst->VRegA_22b(),
2173 shadow_frame.GetVReg(inst->VRegB_22b()) <<
2174 (inst->VRegC_22b() & 0x1f));
2175 ADVANCE(2);
2176 HANDLE_INSTRUCTION_END();
2177
2178 HANDLE_INSTRUCTION_START(SHR_INT_LIT8)
2179 shadow_frame.SetVReg(inst->VRegA_22b(),
2180 shadow_frame.GetVReg(inst->VRegB_22b()) >>
2181 (inst->VRegC_22b() & 0x1f));
2182 ADVANCE(2);
2183 HANDLE_INSTRUCTION_END();
2184
2185 HANDLE_INSTRUCTION_START(USHR_INT_LIT8)
2186 shadow_frame.SetVReg(inst->VRegA_22b(),
2187 static_cast<uint32_t>(shadow_frame.GetVReg(inst->VRegB_22b())) >>
2188 (inst->VRegC_22b() & 0x1f));
2189 ADVANCE(2);
2190 HANDLE_INSTRUCTION_END();
2191
2192 HANDLE_INSTRUCTION_START(UNUSED_3E)
2193 UnexpectedOpcode(inst, mh);
2194 HANDLE_INSTRUCTION_END();
2195
2196 HANDLE_INSTRUCTION_START(UNUSED_3F)
2197 UnexpectedOpcode(inst, mh);
2198 HANDLE_INSTRUCTION_END();
2199
2200 HANDLE_INSTRUCTION_START(UNUSED_40)
2201 UnexpectedOpcode(inst, mh);
2202 HANDLE_INSTRUCTION_END();
2203
2204 HANDLE_INSTRUCTION_START(UNUSED_41)
2205 UnexpectedOpcode(inst, mh);
2206 HANDLE_INSTRUCTION_END();
2207
2208 HANDLE_INSTRUCTION_START(UNUSED_42)
2209 UnexpectedOpcode(inst, mh);
2210 HANDLE_INSTRUCTION_END();
2211
2212 HANDLE_INSTRUCTION_START(UNUSED_43)
2213 UnexpectedOpcode(inst, mh);
2214 HANDLE_INSTRUCTION_END();
2215
2216 HANDLE_INSTRUCTION_START(UNUSED_79)
2217 UnexpectedOpcode(inst, mh);
2218 HANDLE_INSTRUCTION_END();
2219
2220 HANDLE_INSTRUCTION_START(UNUSED_7A)
2221 UnexpectedOpcode(inst, mh);
2222 HANDLE_INSTRUCTION_END();
2223
2224 HANDLE_INSTRUCTION_START(UNUSED_EB)
2225 UnexpectedOpcode(inst, mh);
2226 HANDLE_INSTRUCTION_END();
2227
2228 HANDLE_INSTRUCTION_START(UNUSED_EC)
2229 UnexpectedOpcode(inst, mh);
2230 HANDLE_INSTRUCTION_END();
2231
2232 HANDLE_INSTRUCTION_START(UNUSED_ED)
2233 UnexpectedOpcode(inst, mh);
2234 HANDLE_INSTRUCTION_END();
2235
2236 HANDLE_INSTRUCTION_START(UNUSED_EE)
2237 UnexpectedOpcode(inst, mh);
2238 HANDLE_INSTRUCTION_END();
2239
2240 HANDLE_INSTRUCTION_START(UNUSED_EF)
2241 UnexpectedOpcode(inst, mh);
2242 HANDLE_INSTRUCTION_END();
2243
2244 HANDLE_INSTRUCTION_START(UNUSED_F0)
2245 UnexpectedOpcode(inst, mh);
2246 HANDLE_INSTRUCTION_END();
2247
2248 HANDLE_INSTRUCTION_START(UNUSED_F1)
2249 UnexpectedOpcode(inst, mh);
2250 HANDLE_INSTRUCTION_END();
2251
2252 HANDLE_INSTRUCTION_START(UNUSED_F2)
2253 UnexpectedOpcode(inst, mh);
2254 HANDLE_INSTRUCTION_END();
2255
2256 HANDLE_INSTRUCTION_START(UNUSED_F3)
2257 UnexpectedOpcode(inst, mh);
2258 HANDLE_INSTRUCTION_END();
2259
2260 HANDLE_INSTRUCTION_START(UNUSED_F4)
2261 UnexpectedOpcode(inst, mh);
2262 HANDLE_INSTRUCTION_END();
2263
2264 HANDLE_INSTRUCTION_START(UNUSED_F5)
2265 UnexpectedOpcode(inst, mh);
2266 HANDLE_INSTRUCTION_END();
2267
2268 HANDLE_INSTRUCTION_START(UNUSED_F6)
2269 UnexpectedOpcode(inst, mh);
2270 HANDLE_INSTRUCTION_END();
2271
2272 HANDLE_INSTRUCTION_START(UNUSED_F7)
2273 UnexpectedOpcode(inst, mh);
2274 HANDLE_INSTRUCTION_END();
2275
2276 HANDLE_INSTRUCTION_START(UNUSED_F8)
2277 UnexpectedOpcode(inst, mh);
2278 HANDLE_INSTRUCTION_END();
2279
2280 HANDLE_INSTRUCTION_START(UNUSED_F9)
2281 UnexpectedOpcode(inst, mh);
2282 HANDLE_INSTRUCTION_END();
2283
2284 HANDLE_INSTRUCTION_START(UNUSED_FA)
2285 UnexpectedOpcode(inst, mh);
2286 HANDLE_INSTRUCTION_END();
2287
2288 HANDLE_INSTRUCTION_START(UNUSED_FB)
2289 UnexpectedOpcode(inst, mh);
2290 HANDLE_INSTRUCTION_END();
2291
2292 HANDLE_INSTRUCTION_START(UNUSED_FC)
2293 UnexpectedOpcode(inst, mh);
2294 HANDLE_INSTRUCTION_END();
2295
2296 HANDLE_INSTRUCTION_START(UNUSED_FD)
2297 UnexpectedOpcode(inst, mh);
2298 HANDLE_INSTRUCTION_END();
2299
2300 HANDLE_INSTRUCTION_START(UNUSED_FE)
2301 UnexpectedOpcode(inst, mh);
2302 HANDLE_INSTRUCTION_END();
2303
2304 HANDLE_INSTRUCTION_START(UNUSED_FF)
2305 UnexpectedOpcode(inst, mh);
2306 HANDLE_INSTRUCTION_END();
2307
2308 exception_pending_label: {
2309 CHECK(self->IsExceptionPending());
2310 uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
2311 this_object_ref,
2312 instrumentation);
2313 if (found_dex_pc == DexFile::kDexNoIndex) {
2314 return JValue(); /* Handled in caller. */
2315 } else {
2316 int32_t displacement = static_cast<int32_t>(found_dex_pc) - static_cast<int32_t>(dex_pc);
2317 ADVANCE(displacement);
2318 }
2319 }
2320
2321 // Create alternative instruction handlers dedicated to instrumentation.
2322#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
2323 instrumentation_op_##code: { \
2324 instrumentation->DexPcMovedEvent(self, this_object_ref.get(), \
2325 shadow_frame.GetMethod(), dex_pc); \
2326 goto *handlersTable[Instruction::code]; \
2327 }
2328#include "dex_instruction_list.h"
2329 DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)
2330#undef DEX_INSTRUCTION_LIST
2331#undef INSTRUMENTATION_INSTRUCTION_HANDLER
2332} // NOLINT(readability/fn_size)
2333
2334// Explicit definitions of ExecuteGotoImpl.
2335template JValue ExecuteGotoImpl<true>(Thread* self, MethodHelper& mh,
2336 const DexFile::CodeItem* code_item,
2337 ShadowFrame& shadow_frame, JValue result_register);
2338template JValue ExecuteGotoImpl<false>(Thread* self, MethodHelper& mh,
2339 const DexFile::CodeItem* code_item,
2340 ShadowFrame& shadow_frame, JValue result_register);
2341
2342} // namespace interpreter
2343} // namespace art