From f61df9b450f8734b84584671ad22fa4f29d386e4 Mon Sep 17 00:00:00 2001 From: buzbee Date: Wed, 7 Sep 2016 07:12:29 -0700 Subject: [PATCH] ART: Remove computed-goto interpreter ART currently has 3 interpreters: a baseline switch-statement based interpreter, a C++ computed goto interpreter and a fast assembly interpreter (mterp). The C++ computed goto interpreter was intended to get some of the benefits of the old Dalvik mterp interpreter - which it did. However, we now have the faster assembly interpreter, so it is no longer needed. Test: m test-art-host Test: m ART_TEST_INTERPRETER=true test-art-host Change-Id: I0e8f139ab6bc48d0568951af1f83e2b1c00835f8 --- runtime/Android.bp | 1 - runtime/interpreter/interpreter.cc | 26 +- runtime/interpreter/interpreter_goto_table_impl.cc | 2607 -------------------- runtime/interpreter/interpreter_goto_table_impl.h | 41 - 4 files changed, 5 insertions(+), 2670 deletions(-) delete mode 100644 runtime/interpreter/interpreter_goto_table_impl.cc delete mode 100644 runtime/interpreter/interpreter_goto_table_impl.h diff --git a/runtime/Android.bp b/runtime/Android.bp index 22d79cb73..59e4a1581 100644 --- a/runtime/Android.bp +++ b/runtime/Android.bp @@ -97,7 +97,6 @@ cc_defaults { "intern_table.cc", "interpreter/interpreter.cc", "interpreter/interpreter_common.cc", - "interpreter/interpreter_goto_table_impl.cc", "interpreter/interpreter_switch_impl.cc", "interpreter/unstarted_runtime.cc", "java_vm_ext.cc", diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc index 277bda4dc..0003e7242 100644 --- a/runtime/interpreter/interpreter.cc +++ b/runtime/interpreter/interpreter.cc @@ -20,7 +20,6 @@ #include "common_throws.h" #include "interpreter_common.h" -#include "interpreter_goto_table_impl.h" #include "interpreter_mterp_impl.h" #include "interpreter_switch_impl.h" #include "mirror/string-inl.h" @@ -231,15 +230,12 @@ static void InterpreterJni(Thread* self, ArtMethod* method, const StringPiece& s enum InterpreterImplKind { kSwitchImplKind, // Switch-based interpreter implementation. - kComputedGotoImplKind, // Computed-goto-based interpreter implementation. kMterpImplKind // Assembly interpreter }; static std::ostream& operator<<(std::ostream& os, const InterpreterImplKind& rhs) { os << ((rhs == kSwitchImplKind) ? "Switch-based interpreter" - : (rhs == kComputedGotoImplKind) - ? "Computed-goto-based interpreter" - : "Asm interpreter"); + : "Asm interpreter"); return os; } @@ -323,7 +319,8 @@ static inline JValue Execute( } } } - } else if (kInterpreterImplKind == kSwitchImplKind) { + } else { + DCHECK_EQ(kInterpreterImplKind, kSwitchImplKind); if (transaction_active) { return ExecuteSwitchImpl(self, code_item, shadow_frame, result_register, false); @@ -331,13 +328,6 @@ static inline JValue Execute( return ExecuteSwitchImpl(self, code_item, shadow_frame, result_register, false); } - } else { - DCHECK_EQ(kInterpreterImplKind, kComputedGotoImplKind); - if (transaction_active) { - return ExecuteGotoImpl(self, code_item, shadow_frame, result_register); - } else { - return ExecuteGotoImpl(self, code_item, shadow_frame, result_register); - } } } else { // Enter the "with access check" interpreter. @@ -350,7 +340,8 @@ static inline JValue Execute( return ExecuteSwitchImpl(self, code_item, shadow_frame, result_register, false); } - } else if (kInterpreterImplKind == kSwitchImplKind) { + } else { + DCHECK_EQ(kInterpreterImplKind, kSwitchImplKind); if (transaction_active) { return ExecuteSwitchImpl(self, code_item, shadow_frame, result_register, false); @@ -358,13 +349,6 @@ static inline JValue Execute( return ExecuteSwitchImpl(self, code_item, shadow_frame, result_register, false); } - } else { - DCHECK_EQ(kInterpreterImplKind, kComputedGotoImplKind); - if (transaction_active) { - return ExecuteGotoImpl(self, code_item, shadow_frame, result_register); - } else { - return ExecuteGotoImpl(self, code_item, shadow_frame, result_register); - } } } } diff --git a/runtime/interpreter/interpreter_goto_table_impl.cc b/runtime/interpreter/interpreter_goto_table_impl.cc deleted file mode 100644 index 37dd63b4d..000000000 --- a/runtime/interpreter/interpreter_goto_table_impl.cc +++ /dev/null @@ -1,2607 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "interpreter_goto_table_impl.h" - -// Common includes -#include "base/logging.h" -#include "base/macros.h" -#include "base/mutex.h" -#include "stack.h" -#include "thread.h" - -// Clang compiles the GOTO interpreter very slowly. So we skip it. These are the implementation -// details only necessary when compiling it. -#if !defined(__clang__) -#include "experimental_flags.h" -#include "interpreter_common.h" -#include "jit/jit.h" -#include "safe_math.h" -#endif - -namespace art { -namespace interpreter { - -#if !defined(__clang__) - -// In the following macros, we expect the following local variables exist: -// - "self": the current Thread*. -// - "inst" : the current Instruction*. -// - "inst_data" : the current instruction's first 16 bits. -// - "dex_pc": the current pc. -// - "shadow_frame": the current shadow frame. -// - "currentHandlersTable": the current table of pointer to each instruction handler. - -// Advance to the next instruction and updates interpreter state. -#define ADVANCE(_offset) \ - do { \ - int32_t disp = static_cast(_offset); \ - inst = inst->RelativeAt(disp); \ - dex_pc = static_cast(static_cast(dex_pc) + disp); \ - shadow_frame.SetDexPC(dex_pc); \ - TraceExecution(shadow_frame, inst, dex_pc); \ - inst_data = inst->Fetch16(0); \ - goto *currentHandlersTable[inst->Opcode(inst_data)]; \ - } while (false) - -#define HANDLE_PENDING_EXCEPTION() goto exception_pending_label - -#define POSSIBLY_HANDLE_PENDING_EXCEPTION(_is_exception_pending, _offset) \ - do { \ - if (UNLIKELY(_is_exception_pending)) { \ - HANDLE_PENDING_EXCEPTION(); \ - } else { \ - ADVANCE(_offset); \ - } \ - } while (false) - -#define UPDATE_HANDLER_TABLE() \ - currentHandlersTable = handlersTable[ \ - Runtime::Current()->GetInstrumentation()->GetInterpreterHandlerTable()] - -#define BRANCH_INSTRUMENTATION(offset) \ - do { \ - if (UNLIKELY(instrumentation->HasBranchListeners())) { \ - instrumentation->Branch(self, method, dex_pc, offset); \ - } \ - JValue result; \ - if (jit::Jit::MaybeDoOnStackReplacement(self, method, dex_pc, offset, &result)) { \ - return result; \ - } \ - } while (false) - -#define HOTNESS_UPDATE() \ - do { \ - if (jit != nullptr) { \ - jit->AddSamples(self, method, 1, /*with_backedges*/ true); \ - } \ - } while (false) - -#define UNREACHABLE_CODE_CHECK() \ - do { \ - if (kIsDebugBuild) { \ - LOG(FATAL) << "We should not be here !"; \ - UNREACHABLE(); \ - } \ - } while (false) - -#define HANDLE_INSTRUCTION_START(opcode) op_##opcode: // NOLINT(whitespace/labels) -#define HANDLE_INSTRUCTION_END() UNREACHABLE_CODE_CHECK() - -#define HANDLE_MONITOR_CHECKS() \ - if (!DoMonitorCheckOnExit(self, &shadow_frame)) { \ - HANDLE_PENDING_EXCEPTION(); \ - } - -/** - * Interpreter based on computed goto tables. - * - * Each instruction is associated to a handler. This handler is responsible for executing the - * instruction and jump to the next instruction's handler. - * In order to limit the cost of instrumentation, we have two handler tables: - * - the "main" handler table: it contains handlers for normal execution of each instruction without - * handling of instrumentation. - * - the "alternative" handler table: it contains alternative handlers which first handle - * instrumentation before jumping to the corresponding "normal" instruction's handler. - * - * When instrumentation is active, the interpreter uses the "alternative" handler table. Otherwise - * it uses the "main" handler table. - * - * The current handler table is the handler table being used by the interpreter. It is updated: - * - on backward branch (goto, if and switch instructions) - * - after invoke - * - when an exception is thrown. - * This allows to support an attaching debugger to an already running application for instance. - * - * For a fast handler table update, handler tables are stored in an array of handler tables. Each - * handler table is represented by the InterpreterHandlerTable enum which allows to associate it - * to an index in this array of handler tables ((see Instrumentation::GetInterpreterHandlerTable). - * - * Here's the current layout of this array of handler tables: - * - * ---------------------+---------------+ - * | NOP | (handler for NOP instruction) - * +---------------+ - * "main" | MOVE | (handler for MOVE instruction) - * handler table +---------------+ - * | ... | - * +---------------+ - * | UNUSED_FF | (handler for UNUSED_FF instruction) - * ---------------------+---------------+ - * | NOP | (alternative handler for NOP instruction) - * +---------------+ - * "alternative" | MOVE | (alternative handler for MOVE instruction) - * handler table +---------------+ - * | ... | - * +---------------+ - * | UNUSED_FF | (alternative handler for UNUSED_FF instruction) - * ---------------------+---------------+ - * - */ -template -JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowFrame& shadow_frame, - JValue result_register) { - // Define handler tables: - // - The main handler table contains execution handlers for each instruction. - // - The alternative handler table contains prelude handlers which check for thread suspend and - // manage instrumentation before jumping to the execution handler. - static const void* const handlersTable[instrumentation::kNumHandlerTables][kNumPackedOpcodes] = { - { - // Main handler table. -#define INSTRUCTION_HANDLER(o, code, n, f, i, a, v) &&op_##code, -#include "dex_instruction_list.h" - DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER) -#undef DEX_INSTRUCTION_LIST -#undef INSTRUCTION_HANDLER - }, { - // Alternative handler table. -#define INSTRUCTION_HANDLER(o, code, n, f, i, a, v) &&alt_op_##code, -#include "dex_instruction_list.h" - DEX_INSTRUCTION_LIST(INSTRUCTION_HANDLER) -#undef DEX_INSTRUCTION_LIST -#undef INSTRUCTION_HANDLER - } - }; - - constexpr bool do_assignability_check = do_access_check; - if (UNLIKELY(!shadow_frame.HasReferenceArray())) { - LOG(FATAL) << "Invalid shadow frame for interpreter use"; - return JValue(); - } - self->VerifyStack(); - - uint32_t dex_pc = shadow_frame.GetDexPC(); - const Instruction* inst = Instruction::At(code_item->insns_ + dex_pc); - uint16_t inst_data; - const void* const* currentHandlersTable; - UPDATE_HANDLER_TABLE(); - const auto* const instrumentation = Runtime::Current()->GetInstrumentation(); - ArtMethod* method = shadow_frame.GetMethod(); - jit::Jit* jit = Runtime::Current()->GetJit(); - - // Jump to first instruction. - ADVANCE(0); - UNREACHABLE_CODE_CHECK(); - - HANDLE_INSTRUCTION_START(NOP) - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE) - shadow_frame.SetVReg(inst->VRegA_12x(inst_data), - shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE_FROM16) - shadow_frame.SetVReg(inst->VRegA_22x(inst_data), - shadow_frame.GetVReg(inst->VRegB_22x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE_16) - shadow_frame.SetVReg(inst->VRegA_32x(), - shadow_frame.GetVReg(inst->VRegB_32x())); - ADVANCE(3); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE_WIDE) - shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), - shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE_WIDE_FROM16) - shadow_frame.SetVRegLong(inst->VRegA_22x(inst_data), - shadow_frame.GetVRegLong(inst->VRegB_22x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE_WIDE_16) - shadow_frame.SetVRegLong(inst->VRegA_32x(), - shadow_frame.GetVRegLong(inst->VRegB_32x())); - ADVANCE(3); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE_OBJECT) - shadow_frame.SetVRegReference(inst->VRegA_12x(inst_data), - shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE_OBJECT_FROM16) - shadow_frame.SetVRegReference(inst->VRegA_22x(inst_data), - shadow_frame.GetVRegReference(inst->VRegB_22x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE_OBJECT_16) - shadow_frame.SetVRegReference(inst->VRegA_32x(), - shadow_frame.GetVRegReference(inst->VRegB_32x())); - ADVANCE(3); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE_RESULT) - shadow_frame.SetVReg(inst->VRegA_11x(inst_data), result_register.GetI()); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE_RESULT_WIDE) - shadow_frame.SetVRegLong(inst->VRegA_11x(inst_data), result_register.GetJ()); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE_RESULT_OBJECT) - shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), result_register.GetL()); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MOVE_EXCEPTION) { - Throwable* exception = self->GetException(); - DCHECK(exception != nullptr) << "No pending exception on MOVE_EXCEPTION instruction"; - shadow_frame.SetVRegReference(inst->VRegA_11x(inst_data), exception); - self->ClearException(); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(RETURN_VOID_NO_BARRIER) { - JValue result; - self->AllowThreadSuspension(); - HANDLE_MONITOR_CHECKS(); - if (UNLIKELY(instrumentation->HasMethodExitListeners())) { - instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), - shadow_frame.GetMethod(), dex_pc, - result); - } - return result; - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(RETURN_VOID) { - QuasiAtomic::ThreadFenceForConstructor(); - JValue result; - self->AllowThreadSuspension(); - HANDLE_MONITOR_CHECKS(); - if (UNLIKELY(instrumentation->HasMethodExitListeners())) { - instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), - shadow_frame.GetMethod(), dex_pc, - result); - } - return result; - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(RETURN) { - JValue result; - result.SetJ(0); - result.SetI(shadow_frame.GetVReg(inst->VRegA_11x(inst_data))); - self->AllowThreadSuspension(); - HANDLE_MONITOR_CHECKS(); - if (UNLIKELY(instrumentation->HasMethodExitListeners())) { - instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), - shadow_frame.GetMethod(), dex_pc, - result); - } - return result; - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(RETURN_WIDE) { - JValue result; - result.SetJ(shadow_frame.GetVRegLong(inst->VRegA_11x(inst_data))); - self->AllowThreadSuspension(); - HANDLE_MONITOR_CHECKS(); - if (UNLIKELY(instrumentation->HasMethodExitListeners())) { - instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), - shadow_frame.GetMethod(), dex_pc, - result); - } - return result; - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(RETURN_OBJECT) { - JValue result; - self->AllowThreadSuspension(); - HANDLE_MONITOR_CHECKS(); - const uint8_t vreg_index = inst->VRegA_11x(inst_data); - Object* obj_result = shadow_frame.GetVRegReference(vreg_index); - if (do_assignability_check && obj_result != nullptr) { - size_t pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize(); - Class* return_type = shadow_frame.GetMethod()->GetReturnType(true /* resolve */, - pointer_size); - obj_result = shadow_frame.GetVRegReference(vreg_index); - if (return_type == nullptr) { - // Return the pending exception. - HANDLE_PENDING_EXCEPTION(); - } - if (!obj_result->VerifierInstanceOf(return_type)) { - // This should never happen. - std::string temp1, temp2; - self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;", - "Returning '%s' that is not instance of return type '%s'", - obj_result->GetClass()->GetDescriptor(&temp1), - return_type->GetDescriptor(&temp2)); - HANDLE_PENDING_EXCEPTION(); - } - } - result.SetL(obj_result); - if (UNLIKELY(instrumentation->HasMethodExitListeners())) { - instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), - shadow_frame.GetMethod(), dex_pc, - result); - } - return result; - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CONST_4) { - uint32_t dst = inst->VRegA_11n(inst_data); - int32_t val = inst->VRegB_11n(inst_data); - shadow_frame.SetVReg(dst, val); - if (val == 0) { - shadow_frame.SetVRegReference(dst, nullptr); - } - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CONST_16) { - uint32_t dst = inst->VRegA_21s(inst_data); - int32_t val = inst->VRegB_21s(); - shadow_frame.SetVReg(dst, val); - if (val == 0) { - shadow_frame.SetVRegReference(dst, nullptr); - } - ADVANCE(2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CONST) { - uint32_t dst = inst->VRegA_31i(inst_data); - int32_t val = inst->VRegB_31i(); - shadow_frame.SetVReg(dst, val); - if (val == 0) { - shadow_frame.SetVRegReference(dst, nullptr); - } - ADVANCE(3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CONST_HIGH16) { - uint32_t dst = inst->VRegA_21h(inst_data); - int32_t val = static_cast(inst->VRegB_21h() << 16); - shadow_frame.SetVReg(dst, val); - if (val == 0) { - shadow_frame.SetVRegReference(dst, nullptr); - } - ADVANCE(2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CONST_WIDE_16) - shadow_frame.SetVRegLong(inst->VRegA_21s(inst_data), inst->VRegB_21s()); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CONST_WIDE_32) - shadow_frame.SetVRegLong(inst->VRegA_31i(inst_data), inst->VRegB_31i()); - ADVANCE(3); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CONST_WIDE) - shadow_frame.SetVRegLong(inst->VRegA_51l(inst_data), inst->VRegB_51l()); - ADVANCE(5); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CONST_WIDE_HIGH16) - shadow_frame.SetVRegLong(inst->VRegA_21h(inst_data), - static_cast(inst->VRegB_21h()) << 48); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CONST_STRING) { - String* s = ResolveString(self, shadow_frame, inst->VRegB_21c()); - if (UNLIKELY(s == nullptr)) { - HANDLE_PENDING_EXCEPTION(); - } else { - shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), s); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) { - String* s = ResolveString(self, shadow_frame, inst->VRegB_31c()); - if (UNLIKELY(s == nullptr)) { - HANDLE_PENDING_EXCEPTION(); - } else { - shadow_frame.SetVRegReference(inst->VRegA_31c(inst_data), s); - ADVANCE(3); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CONST_CLASS) { - Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(), - self, false, do_access_check); - if (UNLIKELY(c == nullptr)) { - HANDLE_PENDING_EXCEPTION(); - } else { - shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), c); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MONITOR_ENTER) { - Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data)); - if (UNLIKELY(obj == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - DoMonitorEnter(self, &shadow_frame, obj); - POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MONITOR_EXIT) { - Object* obj = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data)); - if (UNLIKELY(obj == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - DoMonitorExit(self, &shadow_frame, obj); - POSSIBLY_HANDLE_PENDING_EXCEPTION(self->IsExceptionPending(), 1); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CHECK_CAST) { - Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(), - self, false, do_access_check); - if (UNLIKELY(c == nullptr)) { - HANDLE_PENDING_EXCEPTION(); - } else { - Object* obj = shadow_frame.GetVRegReference(inst->VRegA_21c(inst_data)); - if (UNLIKELY(obj != nullptr && !obj->InstanceOf(c))) { - ThrowClassCastException(c, obj->GetClass()); - HANDLE_PENDING_EXCEPTION(); - } else { - ADVANCE(2); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INSTANCE_OF) { - Class* c = ResolveVerifyAndClinit(inst->VRegC_22c(), shadow_frame.GetMethod(), - self, false, do_access_check); - if (UNLIKELY(c == nullptr)) { - HANDLE_PENDING_EXCEPTION(); - } else { - Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data)); - shadow_frame.SetVReg(inst->VRegA_22c(inst_data), (obj != nullptr && obj->InstanceOf(c)) ? 1 : 0); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(ARRAY_LENGTH) { - Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)); - if (UNLIKELY(array == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - shadow_frame.SetVReg(inst->VRegA_12x(inst_data), array->AsArray()->GetLength()); - ADVANCE(1); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(NEW_INSTANCE) { - Object* obj = nullptr; - Class* c = ResolveVerifyAndClinit(inst->VRegB_21c(), shadow_frame.GetMethod(), - self, false, do_access_check); - if (LIKELY(c != nullptr)) { - if (UNLIKELY(c->IsStringClass())) { - gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator(); - obj = mirror::String::AllocEmptyString(self, allocator_type); - } else { - obj = AllocObjectFromCode( - inst->VRegB_21c(), shadow_frame.GetMethod(), self, - Runtime::Current()->GetHeap()->GetCurrentAllocator()); - } - } - if (UNLIKELY(obj == nullptr)) { - HANDLE_PENDING_EXCEPTION(); - } else { - obj->GetClass()->AssertInitializedOrInitializingInThread(self); - // Don't allow finalizable objects to be allocated during a transaction since these can't be - // finalized without a started runtime. - if (transaction_active && obj->GetClass()->IsFinalizable()) { - AbortTransactionF(self, "Allocating finalizable object in transaction: %s", - PrettyTypeOf(obj).c_str()); - HANDLE_PENDING_EXCEPTION(); - } - shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(NEW_ARRAY) { - int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data)); - Object* obj = AllocArrayFromCode( - inst->VRegC_22c(), length, shadow_frame.GetMethod(), self, - Runtime::Current()->GetHeap()->GetCurrentAllocator()); - if (UNLIKELY(obj == nullptr)) { - HANDLE_PENDING_EXCEPTION(); - } else { - shadow_frame.SetVRegReference(inst->VRegA_22c(inst_data), obj); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY) { - bool success = - DoFilledNewArray(inst, shadow_frame, - self, &result_register); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(FILLED_NEW_ARRAY_RANGE) { - bool success = - DoFilledNewArray(inst, shadow_frame, - self, &result_register); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(FILL_ARRAY_DATA) { - Object* obj = shadow_frame.GetVRegReference(inst->VRegA_31t(inst_data)); - const uint16_t* payload_addr = reinterpret_cast(inst) + inst->VRegB_31t(); - const Instruction::ArrayDataPayload* payload = - reinterpret_cast(payload_addr); - bool success = FillArrayData(obj, payload); - if (transaction_active && success) { - RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count); - } - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(THROW) { - Object* exception = shadow_frame.GetVRegReference(inst->VRegA_11x(inst_data)); - if (UNLIKELY(exception == nullptr)) { - ThrowNullPointerException("throw with null exception"); - } else if (do_assignability_check && !exception->GetClass()->IsThrowableClass()) { - // This should never happen. - std::string temp; - self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;", - "Throwing '%s' that is not instance of Throwable", - exception->GetClass()->GetDescriptor(&temp)); - } else { - self->SetException(exception->AsThrowable()); - } - HANDLE_PENDING_EXCEPTION(); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(GOTO) { - int8_t offset = inst->VRegA_10t(inst_data); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(GOTO_16) { - int16_t offset = inst->VRegA_20t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(GOTO_32) { - int32_t offset = inst->VRegA_30t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(PACKED_SWITCH) { - int32_t offset = DoPackedSwitch(inst, shadow_frame, inst_data); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SPARSE_SWITCH) { - int32_t offset = DoSparseSwitch(inst, shadow_frame, inst_data); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } - HANDLE_INSTRUCTION_END(); - -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wfloat-equal" -#endif - - HANDLE_INSTRUCTION_START(CMPL_FLOAT) { - float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x()); - float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x()); - int32_t result; - if (val1 > val2) { - result = 1; - } else if (val1 == val2) { - result = 0; - } else { - result = -1; - } - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result); - ADVANCE(2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CMPG_FLOAT) { - float val1 = shadow_frame.GetVRegFloat(inst->VRegB_23x()); - float val2 = shadow_frame.GetVRegFloat(inst->VRegC_23x()); - int32_t result; - if (val1 < val2) { - result = -1; - } else if (val1 == val2) { - result = 0; - } else { - result = 1; - } - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result); - ADVANCE(2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CMPL_DOUBLE) { - double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x()); - double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x()); - int32_t result; - if (val1 > val2) { - result = 1; - } else if (val1 == val2) { - result = 0; - } else { - result = -1; - } - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result); - ADVANCE(2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(CMPG_DOUBLE) { - double val1 = shadow_frame.GetVRegDouble(inst->VRegB_23x()); - double val2 = shadow_frame.GetVRegDouble(inst->VRegC_23x()); - int32_t result; - if (val1 < val2) { - result = -1; - } else if (val1 == val2) { - result = 0; - } else { - result = 1; - } - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result); - ADVANCE(2); - } - HANDLE_INSTRUCTION_END(); - -#if defined(__clang__) -#pragma clang diagnostic pop -#endif - - HANDLE_INSTRUCTION_START(CMP_LONG) { - int64_t val1 = shadow_frame.GetVRegLong(inst->VRegB_23x()); - int64_t val2 = shadow_frame.GetVRegLong(inst->VRegC_23x()); - int32_t result; - if (val1 > val2) { - result = 1; - } else if (val1 == val2) { - result = 0; - } else { - result = -1; - } - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), result); - ADVANCE(2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IF_EQ) { - if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) == shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) { - int16_t offset = inst->VRegC_22t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } else { - BRANCH_INSTRUMENTATION(2); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IF_NE) { - if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) != - shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) { - int16_t offset = inst->VRegC_22t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } else { - BRANCH_INSTRUMENTATION(2); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IF_LT) { - if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) < - shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) { - int16_t offset = inst->VRegC_22t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } else { - BRANCH_INSTRUMENTATION(2); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IF_GE) { - if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) >= - shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) { - int16_t offset = inst->VRegC_22t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } else { - BRANCH_INSTRUMENTATION(2); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IF_GT) { - if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) > - shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) { - int16_t offset = inst->VRegC_22t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } else { - BRANCH_INSTRUMENTATION(2); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IF_LE) { - if (shadow_frame.GetVReg(inst->VRegA_22t(inst_data)) <= - shadow_frame.GetVReg(inst->VRegB_22t(inst_data))) { - int16_t offset = inst->VRegC_22t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } else { - BRANCH_INSTRUMENTATION(2); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IF_EQZ) { - if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) == 0) { - int16_t offset = inst->VRegB_21t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } else { - BRANCH_INSTRUMENTATION(2); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IF_NEZ) { - if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) != 0) { - int16_t offset = inst->VRegB_21t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } else { - BRANCH_INSTRUMENTATION(2); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IF_LTZ) { - if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) < 0) { - int16_t offset = inst->VRegB_21t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } else { - BRANCH_INSTRUMENTATION(2); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IF_GEZ) { - if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) >= 0) { - int16_t offset = inst->VRegB_21t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } else { - BRANCH_INSTRUMENTATION(2); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IF_GTZ) { - if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) > 0) { - int16_t offset = inst->VRegB_21t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } else { - BRANCH_INSTRUMENTATION(2); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IF_LEZ) { - if (shadow_frame.GetVReg(inst->VRegA_21t(inst_data)) <= 0) { - int16_t offset = inst->VRegB_21t(); - BRANCH_INSTRUMENTATION(offset); - if (IsBackwardBranch(offset)) { - HOTNESS_UPDATE(); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - } - ADVANCE(offset); - } else { - BRANCH_INSTRUMENTATION(2); - ADVANCE(2); - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AGET_BOOLEAN) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - BooleanArray* array = a->AsBooleanArray(); - if (LIKELY(array->CheckIsValidIndex(index))) { - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AGET_BYTE) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - ByteArray* array = a->AsByteArray(); - if (LIKELY(array->CheckIsValidIndex(index))) { - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AGET_CHAR) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - CharArray* array = a->AsCharArray(); - if (LIKELY(array->CheckIsValidIndex(index))) { - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AGET_SHORT) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - ShortArray* array = a->AsShortArray(); - if (LIKELY(array->CheckIsValidIndex(index))) { - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AGET) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - DCHECK(a->IsIntArray() || a->IsFloatArray()) << PrettyTypeOf(a); - auto* array = down_cast(a); - if (LIKELY(array->CheckIsValidIndex(index))) { - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AGET_WIDE) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - DCHECK(a->IsLongArray() || a->IsDoubleArray()) << PrettyTypeOf(a); - auto* array = down_cast(a); - if (LIKELY(array->CheckIsValidIndex(index))) { - shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AGET_OBJECT) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - ObjectArray* array = a->AsObjectArray(); - if (LIKELY(array->CheckIsValidIndex(index))) { - shadow_frame.SetVRegReference(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(APUT_BOOLEAN) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - uint8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data)); - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - BooleanArray* array = a->AsBooleanArray(); - if (LIKELY(array->CheckIsValidIndex(index))) { - array->SetWithoutChecks(index, val); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(APUT_BYTE) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - int8_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data)); - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - ByteArray* array = a->AsByteArray(); - if (LIKELY(array->CheckIsValidIndex(index))) { - array->SetWithoutChecks(index, val); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(APUT_CHAR) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - uint16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data)); - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - CharArray* array = a->AsCharArray(); - if (LIKELY(array->CheckIsValidIndex(index))) { - array->SetWithoutChecks(index, val); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(APUT_SHORT) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - int16_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data)); - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - ShortArray* array = a->AsShortArray(); - if (LIKELY(array->CheckIsValidIndex(index))) { - array->SetWithoutChecks(index, val); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(APUT) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data)); - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - DCHECK(a->IsIntArray() || a->IsFloatArray()) << PrettyTypeOf(a); - auto* array = down_cast(a); - if (LIKELY(array->CheckIsValidIndex(index))) { - array->SetWithoutChecks(index, val); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(APUT_WIDE) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data)); - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - DCHECK(a->IsLongArray() || a->IsDoubleArray()) << PrettyTypeOf(a); - auto* array = down_cast(a); - if (LIKELY(array->CheckIsValidIndex(index))) { - array->SetWithoutChecks(index, val); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(APUT_OBJECT) { - Object* a = shadow_frame.GetVRegReference(inst->VRegB_23x()); - if (UNLIKELY(a == nullptr)) { - ThrowNullPointerExceptionFromInterpreter(); - HANDLE_PENDING_EXCEPTION(); - } else { - int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - Object* val = shadow_frame.GetVRegReference(inst->VRegA_23x(inst_data)); - ObjectArray* array = a->AsObjectArray(); - if (LIKELY(array->CheckIsValidIndex(index) && array->CheckAssignable(val))) { - array->SetWithoutChecks(index, val); - ADVANCE(2); - } else { - HANDLE_PENDING_EXCEPTION(); - } - } - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_BOOLEAN) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_BYTE) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_CHAR) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_SHORT) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_WIDE) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_OBJECT) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_QUICK) { - bool success = DoIGetQuick(shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_BOOLEAN_QUICK) { - bool success = DoIGetQuick(shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_BYTE_QUICK) { - bool success = DoIGetQuick(shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_CHAR_QUICK) { - bool success = DoIGetQuick(shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_SHORT_QUICK) { - bool success = DoIGetQuick(shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_WIDE_QUICK) { - bool success = DoIGetQuick(shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IGET_OBJECT_QUICK) { - bool success = DoIGetQuick(shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SGET_BOOLEAN) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SGET_BYTE) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SGET_CHAR) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SGET_SHORT) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SGET) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SGET_WIDE) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SGET_OBJECT) { - bool success = DoFieldGet( - self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_BOOLEAN) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_BYTE) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_CHAR) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_SHORT) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_WIDE) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_OBJECT) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_QUICK) { - bool success = DoIPutQuick( - shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_BOOLEAN_QUICK) { - bool success = DoIPutQuick( - shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_BYTE_QUICK) { - bool success = DoIPutQuick( - shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_CHAR_QUICK) { - bool success = DoIPutQuick( - shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_SHORT_QUICK) { - bool success = DoIPutQuick( - shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_WIDE_QUICK) { - bool success = DoIPutQuick( - shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(IPUT_OBJECT_QUICK) { - bool success = DoIPutQuick( - shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SPUT_BOOLEAN) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SPUT_BYTE) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SPUT_CHAR) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SPUT_SHORT) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SPUT) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SPUT_WIDE) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SPUT_OBJECT) { - bool success = DoFieldPut(self, shadow_frame, inst, inst_data); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) { - bool success = DoInvoke( - self, shadow_frame, inst, inst_data, &result_register); - UPDATE_HANDLER_TABLE(); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) { - bool success = DoInvoke( - self, shadow_frame, inst, inst_data, &result_register); - UPDATE_HANDLER_TABLE(); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INVOKE_SUPER) { - bool success = DoInvoke( - self, shadow_frame, inst, inst_data, &result_register); - UPDATE_HANDLER_TABLE(); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) { - bool success = DoInvoke( - self, shadow_frame, inst, inst_data, &result_register); - UPDATE_HANDLER_TABLE(); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INVOKE_DIRECT) { - bool success = DoInvoke( - self, shadow_frame, inst, inst_data, &result_register); - UPDATE_HANDLER_TABLE(); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) { - bool success = DoInvoke( - self, shadow_frame, inst, inst_data, &result_register); - UPDATE_HANDLER_TABLE(); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) { - bool success = DoInvoke( - self, shadow_frame, inst, inst_data, &result_register); - UPDATE_HANDLER_TABLE(); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) { - bool success = DoInvoke( - self, shadow_frame, inst, inst_data, &result_register); - UPDATE_HANDLER_TABLE(); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INVOKE_STATIC) { - bool success = DoInvoke( - self, shadow_frame, inst, inst_data, &result_register); - UPDATE_HANDLER_TABLE(); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) { - bool success = DoInvoke( - self, shadow_frame, inst, inst_data, &result_register); - UPDATE_HANDLER_TABLE(); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) { - bool success = DoInvokeVirtualQuick( - self, shadow_frame, inst, inst_data, &result_register); - UPDATE_HANDLER_TABLE(); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) { - bool success = DoInvokeVirtualQuick( - self, shadow_frame, inst, inst_data, &result_register); - UPDATE_HANDLER_TABLE(); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(NEG_INT) - shadow_frame.SetVReg( - inst->VRegA_12x(inst_data), -shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(NOT_INT) - shadow_frame.SetVReg( - inst->VRegA_12x(inst_data), ~shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(NEG_LONG) - shadow_frame.SetVRegLong( - inst->VRegA_12x(inst_data), -shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(NOT_LONG) - shadow_frame.SetVRegLong( - inst->VRegA_12x(inst_data), ~shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(NEG_FLOAT) - shadow_frame.SetVRegFloat( - inst->VRegA_12x(inst_data), -shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(NEG_DOUBLE) - shadow_frame.SetVRegDouble( - inst->VRegA_12x(inst_data), -shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INT_TO_LONG) - shadow_frame.SetVRegLong( - inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INT_TO_FLOAT) - shadow_frame.SetVRegFloat( - inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INT_TO_DOUBLE) - shadow_frame.SetVRegDouble( - inst->VRegA_12x(inst_data), shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(LONG_TO_INT) - shadow_frame.SetVReg( - inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(LONG_TO_FLOAT) - shadow_frame.SetVRegFloat( - inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(LONG_TO_DOUBLE) - shadow_frame.SetVRegDouble( - inst->VRegA_12x(inst_data), shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(FLOAT_TO_INT) { - float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)); - int32_t result = art_float_to_integral(val); - shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(FLOAT_TO_LONG) { - float val = shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)); - int64_t result = art_float_to_integral(val); - shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(FLOAT_TO_DOUBLE) - shadow_frame.SetVRegDouble( - inst->VRegA_12x(inst_data), shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DOUBLE_TO_INT) { - double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)); - int32_t result = art_float_to_integral(val); - shadow_frame.SetVReg(inst->VRegA_12x(inst_data), result); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DOUBLE_TO_LONG) { - double val = shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)); - int64_t result = art_float_to_integral(val); - shadow_frame.SetVRegLong(inst->VRegA_12x(inst_data), result); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DOUBLE_TO_FLOAT) - shadow_frame.SetVRegFloat( - inst->VRegA_12x(inst_data), shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INT_TO_BYTE) - shadow_frame.SetVReg(inst->VRegA_12x(inst_data), - static_cast(shadow_frame.GetVReg(inst->VRegB_12x(inst_data)))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INT_TO_CHAR) - shadow_frame.SetVReg(inst->VRegA_12x(inst_data), - static_cast(shadow_frame.GetVReg(inst->VRegB_12x(inst_data)))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(INT_TO_SHORT) - shadow_frame.SetVReg(inst->VRegA_12x(inst_data), - static_cast(shadow_frame.GetVReg(inst->VRegB_12x(inst_data)))); - ADVANCE(1); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(ADD_INT) - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), - SafeAdd(shadow_frame.GetVReg(inst->VRegB_23x()), - shadow_frame.GetVReg(inst->VRegC_23x()))); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SUB_INT) - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), - SafeSub(shadow_frame.GetVReg(inst->VRegB_23x()), - shadow_frame.GetVReg(inst->VRegC_23x()))); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MUL_INT) - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), - SafeMul(shadow_frame.GetVReg(inst->VRegB_23x()), - shadow_frame.GetVReg(inst->VRegC_23x()))); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DIV_INT) { - bool success = DoIntDivide(shadow_frame, inst->VRegA_23x(inst_data), - shadow_frame.GetVReg(inst->VRegB_23x()), - shadow_frame.GetVReg(inst->VRegC_23x())); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(REM_INT) { - bool success = DoIntRemainder(shadow_frame, inst->VRegA_23x(inst_data), - shadow_frame.GetVReg(inst->VRegB_23x()), - shadow_frame.GetVReg(inst->VRegC_23x())); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SHL_INT) - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), - shadow_frame.GetVReg(inst->VRegB_23x()) << - (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f)); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SHR_INT) - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), - shadow_frame.GetVReg(inst->VRegB_23x()) >> - (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f)); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(USHR_INT) - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), - static_cast(shadow_frame.GetVReg(inst->VRegB_23x())) >> - (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x1f)); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AND_INT) - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), - shadow_frame.GetVReg(inst->VRegB_23x()) & - shadow_frame.GetVReg(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(OR_INT) - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), - shadow_frame.GetVReg(inst->VRegB_23x()) | - shadow_frame.GetVReg(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(XOR_INT) - shadow_frame.SetVReg(inst->VRegA_23x(inst_data), - shadow_frame.GetVReg(inst->VRegB_23x()) ^ - shadow_frame.GetVReg(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(ADD_LONG) - shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), - SafeAdd(shadow_frame.GetVRegLong(inst->VRegB_23x()), - shadow_frame.GetVRegLong(inst->VRegC_23x()))); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SUB_LONG) - shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), - SafeSub(shadow_frame.GetVRegLong(inst->VRegB_23x()), - shadow_frame.GetVRegLong(inst->VRegC_23x()))); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MUL_LONG) - shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), - SafeMul(shadow_frame.GetVRegLong(inst->VRegB_23x()), - shadow_frame.GetVRegLong(inst->VRegC_23x()))); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DIV_LONG) { - bool success = DoLongDivide(shadow_frame, inst->VRegA_23x(inst_data), - shadow_frame.GetVRegLong(inst->VRegB_23x()), - shadow_frame.GetVRegLong(inst->VRegC_23x())); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(REM_LONG) { - bool success = DoLongRemainder(shadow_frame, inst->VRegA_23x(inst_data), - shadow_frame.GetVRegLong(inst->VRegB_23x()), - shadow_frame.GetVRegLong(inst->VRegC_23x())); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AND_LONG) - shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegLong(inst->VRegB_23x()) & - shadow_frame.GetVRegLong(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(OR_LONG) - shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegLong(inst->VRegB_23x()) | - shadow_frame.GetVRegLong(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(XOR_LONG) - shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegLong(inst->VRegB_23x()) ^ - shadow_frame.GetVRegLong(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SHL_LONG) - shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegLong(inst->VRegB_23x()) << - (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f)); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SHR_LONG) - shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegLong(inst->VRegB_23x()) >> - (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f)); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(USHR_LONG) - shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), - static_cast(shadow_frame.GetVRegLong(inst->VRegB_23x())) >> - (shadow_frame.GetVReg(inst->VRegC_23x()) & 0x3f)); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(ADD_FLOAT) - shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegFloat(inst->VRegB_23x()) + - shadow_frame.GetVRegFloat(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SUB_FLOAT) - shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegFloat(inst->VRegB_23x()) - - shadow_frame.GetVRegFloat(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MUL_FLOAT) - shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegFloat(inst->VRegB_23x()) * - shadow_frame.GetVRegFloat(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DIV_FLOAT) - shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegFloat(inst->VRegB_23x()) / - shadow_frame.GetVRegFloat(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(REM_FLOAT) - shadow_frame.SetVRegFloat(inst->VRegA_23x(inst_data), - fmodf(shadow_frame.GetVRegFloat(inst->VRegB_23x()), - shadow_frame.GetVRegFloat(inst->VRegC_23x()))); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(ADD_DOUBLE) - shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegDouble(inst->VRegB_23x()) + - shadow_frame.GetVRegDouble(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SUB_DOUBLE) - shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegDouble(inst->VRegB_23x()) - - shadow_frame.GetVRegDouble(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MUL_DOUBLE) - shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegDouble(inst->VRegB_23x()) * - shadow_frame.GetVRegDouble(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DIV_DOUBLE) - shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data), - shadow_frame.GetVRegDouble(inst->VRegB_23x()) / - shadow_frame.GetVRegDouble(inst->VRegC_23x())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(REM_DOUBLE) - shadow_frame.SetVRegDouble(inst->VRegA_23x(inst_data), - fmod(shadow_frame.GetVRegDouble(inst->VRegB_23x()), - shadow_frame.GetVRegDouble(inst->VRegC_23x()))); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(ADD_INT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVReg(vregA, - SafeAdd(shadow_frame.GetVReg(vregA), - shadow_frame.GetVReg(inst->VRegB_12x(inst_data)))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SUB_INT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVReg(vregA, - SafeSub(shadow_frame.GetVReg(vregA), - shadow_frame.GetVReg(inst->VRegB_12x(inst_data)))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MUL_INT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVReg(vregA, - SafeMul(shadow_frame.GetVReg(vregA), - shadow_frame.GetVReg(inst->VRegB_12x(inst_data)))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DIV_INT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - bool success = DoIntDivide(shadow_frame, vregA, shadow_frame.GetVReg(vregA), - shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(REM_INT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - bool success = DoIntRemainder(shadow_frame, vregA, shadow_frame.GetVReg(vregA), - shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SHL_INT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVReg(vregA, - shadow_frame.GetVReg(vregA) << - (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f)); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SHR_INT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVReg(vregA, - shadow_frame.GetVReg(vregA) >> - (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f)); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(USHR_INT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVReg(vregA, - static_cast(shadow_frame.GetVReg(vregA)) >> - (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x1f)); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AND_INT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVReg(vregA, - shadow_frame.GetVReg(vregA) & - shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(OR_INT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVReg(vregA, - shadow_frame.GetVReg(vregA) | - shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(XOR_INT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVReg(vregA, - shadow_frame.GetVReg(vregA) ^ - shadow_frame.GetVReg(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(ADD_LONG_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegLong(vregA, - SafeAdd(shadow_frame.GetVRegLong(vregA), - shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SUB_LONG_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegLong(vregA, - SafeSub(shadow_frame.GetVRegLong(vregA), - shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MUL_LONG_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegLong(vregA, - SafeMul(shadow_frame.GetVRegLong(vregA), - shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data)))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DIV_LONG_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - bool success = DoLongDivide(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA), - shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(REM_LONG_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - bool success = DoLongRemainder(shadow_frame, vregA, shadow_frame.GetVRegLong(vregA), - shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AND_LONG_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegLong(vregA, - shadow_frame.GetVRegLong(vregA) & - shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(OR_LONG_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegLong(vregA, - shadow_frame.GetVRegLong(vregA) | - shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(XOR_LONG_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegLong(vregA, - shadow_frame.GetVRegLong(vregA) ^ - shadow_frame.GetVRegLong(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SHL_LONG_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegLong(vregA, - shadow_frame.GetVRegLong(vregA) << - (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f)); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SHR_LONG_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegLong(vregA, - shadow_frame.GetVRegLong(vregA) >> - (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f)); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(USHR_LONG_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegLong(vregA, - static_cast(shadow_frame.GetVRegLong(vregA)) >> - (shadow_frame.GetVReg(inst->VRegB_12x(inst_data)) & 0x3f)); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(ADD_FLOAT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegFloat(vregA, - shadow_frame.GetVRegFloat(vregA) + - shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SUB_FLOAT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegFloat(vregA, - shadow_frame.GetVRegFloat(vregA) - - shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MUL_FLOAT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegFloat(vregA, - shadow_frame.GetVRegFloat(vregA) * - shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DIV_FLOAT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegFloat(vregA, - shadow_frame.GetVRegFloat(vregA) / - shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(REM_FLOAT_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegFloat(vregA, - fmodf(shadow_frame.GetVRegFloat(vregA), - shadow_frame.GetVRegFloat(inst->VRegB_12x(inst_data)))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(ADD_DOUBLE_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegDouble(vregA, - shadow_frame.GetVRegDouble(vregA) + - shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SUB_DOUBLE_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegDouble(vregA, - shadow_frame.GetVRegDouble(vregA) - - shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MUL_DOUBLE_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegDouble(vregA, - shadow_frame.GetVRegDouble(vregA) * - shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DIV_DOUBLE_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegDouble(vregA, - shadow_frame.GetVRegDouble(vregA) / - shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(REM_DOUBLE_2ADDR) { - uint32_t vregA = inst->VRegA_12x(inst_data); - shadow_frame.SetVRegDouble(vregA, - fmod(shadow_frame.GetVRegDouble(vregA), - shadow_frame.GetVRegDouble(inst->VRegB_12x(inst_data)))); - ADVANCE(1); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(ADD_INT_LIT16) - shadow_frame.SetVReg(inst->VRegA_22s(inst_data), - SafeAdd(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), - inst->VRegC_22s())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(RSUB_INT) - shadow_frame.SetVReg(inst->VRegA_22s(inst_data), - SafeSub(inst->VRegC_22s(), - shadow_frame.GetVReg(inst->VRegB_22s(inst_data)))); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MUL_INT_LIT16) - shadow_frame.SetVReg(inst->VRegA_22s(inst_data), - SafeMul(shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), - inst->VRegC_22s())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DIV_INT_LIT16) { - bool success = DoIntDivide( - shadow_frame, inst->VRegA_22s(inst_data), shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), - inst->VRegC_22s()); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(REM_INT_LIT16) { - bool success = DoIntRemainder( - shadow_frame, inst->VRegA_22s(inst_data), shadow_frame.GetVReg(inst->VRegB_22s(inst_data)), - inst->VRegC_22s()); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AND_INT_LIT16) - shadow_frame.SetVReg(inst->VRegA_22s(inst_data), - shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) & - inst->VRegC_22s()); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(OR_INT_LIT16) - shadow_frame.SetVReg(inst->VRegA_22s(inst_data), - shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) | - inst->VRegC_22s()); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(XOR_INT_LIT16) - shadow_frame.SetVReg(inst->VRegA_22s(inst_data), - shadow_frame.GetVReg(inst->VRegB_22s(inst_data)) ^ - inst->VRegC_22s()); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(ADD_INT_LIT8) - shadow_frame.SetVReg(inst->VRegA_22b(inst_data), - SafeAdd(shadow_frame.GetVReg(inst->VRegB_22b()), - inst->VRegC_22b())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(RSUB_INT_LIT8) - shadow_frame.SetVReg(inst->VRegA_22b(inst_data), - SafeSub(inst->VRegC_22b(), - shadow_frame.GetVReg(inst->VRegB_22b()))); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(MUL_INT_LIT8) - shadow_frame.SetVReg(inst->VRegA_22b(inst_data), - SafeMul(shadow_frame.GetVReg(inst->VRegB_22b()), - inst->VRegC_22b())); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(DIV_INT_LIT8) { - bool success = DoIntDivide(shadow_frame, inst->VRegA_22b(inst_data), - shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(REM_INT_LIT8) { - bool success = DoIntRemainder(shadow_frame, inst->VRegA_22b(inst_data), - shadow_frame.GetVReg(inst->VRegB_22b()), inst->VRegC_22b()); - POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 2); - } - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(AND_INT_LIT8) - shadow_frame.SetVReg(inst->VRegA_22b(inst_data), - shadow_frame.GetVReg(inst->VRegB_22b()) & - inst->VRegC_22b()); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(OR_INT_LIT8) - shadow_frame.SetVReg(inst->VRegA_22b(inst_data), - shadow_frame.GetVReg(inst->VRegB_22b()) | - inst->VRegC_22b()); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(XOR_INT_LIT8) - shadow_frame.SetVReg(inst->VRegA_22b(inst_data), - shadow_frame.GetVReg(inst->VRegB_22b()) ^ - inst->VRegC_22b()); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SHL_INT_LIT8) - shadow_frame.SetVReg(inst->VRegA_22b(inst_data), - shadow_frame.GetVReg(inst->VRegB_22b()) << - (inst->VRegC_22b() & 0x1f)); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(SHR_INT_LIT8) - shadow_frame.SetVReg(inst->VRegA_22b(inst_data), - shadow_frame.GetVReg(inst->VRegB_22b()) >> - (inst->VRegC_22b() & 0x1f)); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(USHR_INT_LIT8) - shadow_frame.SetVReg(inst->VRegA_22b(inst_data), - static_cast(shadow_frame.GetVReg(inst->VRegB_22b())) >> - (inst->VRegC_22b() & 0x1f)); - ADVANCE(2); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_3E) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_3F) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_40) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_41) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_42) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_43) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_79) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_7A) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_F3) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_F4) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_F5) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_F6) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_F7) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_F8) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_F9) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_FA) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_FB) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_FC) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_FD) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_FE) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - HANDLE_INSTRUCTION_START(UNUSED_FF) - UnexpectedOpcode(inst, shadow_frame); - HANDLE_INSTRUCTION_END(); - - exception_pending_label: { - CHECK(self->IsExceptionPending()); - if (UNLIKELY(self->TestAllFlags())) { - self->CheckSuspend(); - UPDATE_HANDLER_TABLE(); - } - uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc, - instrumentation); - if (found_dex_pc == DexFile::kDexNoIndex) { - // Structured locking is to be enforced for abnormal termination, too. - DoMonitorCheckOnExit(self, &shadow_frame); - return JValue(); /* Handled in caller. */ - } else { - int32_t displacement = static_cast(found_dex_pc) - static_cast(dex_pc); - ADVANCE(displacement); - } - } - -// Create alternative instruction handlers dedicated to instrumentation. -// Return instructions must not call Instrumentation::DexPcMovedEvent since they already call -// Instrumentation::MethodExited. This is to avoid posting debugger events twice for this location. -// Note: we do not use the kReturn instruction flag here (to test the instruction is a return). The -// compiler seems to not evaluate "(Instruction::FlagsOf(Instruction::code) & kReturn) != 0" to -// a constant condition that would remove the "if" statement so the test is free. -#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, i, a, v) \ - alt_op_##code: { \ - if (UNLIKELY(instrumentation->HasDexPcListeners())) { \ - Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_); \ - instrumentation->DexPcMovedEvent(self, this_object, shadow_frame.GetMethod(), dex_pc); \ - } \ - UPDATE_HANDLER_TABLE(); \ - goto *handlersTable[instrumentation::kMainHandlerTable][Instruction::code]; \ - } -#include "dex_instruction_list.h" - DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER) -#undef DEX_INSTRUCTION_LIST -#undef INSTRUMENTATION_INSTRUCTION_HANDLER -} // NOLINT(readability/fn_size) - -// Explicit definitions of ExecuteGotoImpl. -template HOT_ATTR -JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register); -template HOT_ATTR -JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register); -template -JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register); -template -JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register); - -#else - -template -JValue ExecuteGotoImpl(Thread*, const DexFile::CodeItem*, ShadowFrame&, JValue) { - LOG(FATAL) << "UNREACHABLE"; - UNREACHABLE(); -} -// Explicit definitions of ExecuteGotoImpl. -template<> -JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register); -template<> -JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register); -template<> -JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register); -template<> -JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, JValue result_register); -#endif - -} // namespace interpreter -} // namespace art diff --git a/runtime/interpreter/interpreter_goto_table_impl.h b/runtime/interpreter/interpreter_goto_table_impl.h deleted file mode 100644 index c54746d4f..000000000 --- a/runtime/interpreter/interpreter_goto_table_impl.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ART_RUNTIME_INTERPRETER_INTERPRETER_GOTO_TABLE_IMPL_H_ -#define ART_RUNTIME_INTERPRETER_INTERPRETER_GOTO_TABLE_IMPL_H_ - -#include "base/macros.h" -#include "base/mutex.h" -#include "dex_file.h" -#include "jvalue.h" - -namespace art { - -class ShadowFrame; -class Thread; - -namespace interpreter { - -template -JValue ExecuteGotoImpl(Thread* self, - const DexFile::CodeItem* code_item, - ShadowFrame& shadow_frame, - JValue result_register) REQUIRES_SHARED(Locks::mutator_lock_); - -} // namespace interpreter -} // namespace art - -#endif // ART_RUNTIME_INTERPRETER_INTERPRETER_GOTO_TABLE_IMPL_H_ -- 2.11.0