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