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