diff options
author | Mingyao Yang <mingyao@google.com> | 2015-04-01 14:03:04 -0700 |
---|---|---|
committer | Mingyao Yang <mingyao@google.com> | 2015-04-01 14:05:13 -0700 |
commit | d43b3ac88cd46b8815890188c9c2b9a3f1564648 (patch) | |
tree | 6c599c3f40d57e92786bd7f41c0541d9eaa2643b /runtime | |
parent | a109632b240f3c9355ca95500f6f48e4478e3c51 (diff) | |
download | art-d43b3ac88cd46b8815890188c9c2b9a3f1564648.tar.gz art-d43b3ac88cd46b8815890188c9c2b9a3f1564648.tar.bz2 art-d43b3ac88cd46b8815890188c9c2b9a3f1564648.zip |
Revert "Revert "Deoptimization-based bce.""
This reverts commit 0ba627337274ccfb8c9cb9bf23fffb1e1b9d1430.
Change-Id: I1ca10d15bbb49897a0cf541ab160431ec180a006
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/arch/arm/entrypoints_init_arm.cc | 2 | ||||
-rw-r--r-- | runtime/arch/arm64/entrypoints_init_arm64.cc | 3 | ||||
-rw-r--r-- | runtime/arch/x86/entrypoints_init_x86.cc | 3 | ||||
-rw-r--r-- | runtime/arch/x86/quick_entrypoints_x86.S | 5 | ||||
-rw-r--r-- | runtime/arch/x86_64/entrypoints_init_x86_64.cc | 3 | ||||
-rw-r--r-- | runtime/arch/x86_64/quick_entrypoints_x86_64.S | 7 | ||||
-rw-r--r-- | runtime/asm_support.h | 2 | ||||
-rw-r--r-- | runtime/entrypoints/quick/quick_entrypoints_list.h | 1 | ||||
-rw-r--r-- | runtime/entrypoints/runtime_asm_entrypoints.h | 2 | ||||
-rw-r--r-- | runtime/entrypoints_order_test.cc | 3 | ||||
-rw-r--r-- | runtime/interpreter/interpreter.cc | 4 | ||||
-rw-r--r-- | runtime/thread.cc | 1 |
12 files changed, 30 insertions, 6 deletions
diff --git a/runtime/arch/arm/entrypoints_init_arm.cc b/runtime/arch/arm/entrypoints_init_arm.cc index ce0e614854..055b5ab1c6 100644 --- a/runtime/arch/arm/entrypoints_init_arm.cc +++ b/runtime/arch/arm/entrypoints_init_arm.cc @@ -159,6 +159,8 @@ void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method; qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception; qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow; + + qpoints->pDeoptimize = art_quick_deoptimize; } } // namespace art diff --git a/runtime/arch/arm64/entrypoints_init_arm64.cc b/runtime/arch/arm64/entrypoints_init_arm64.cc index e68d41df5a..6c787e312f 100644 --- a/runtime/arch/arm64/entrypoints_init_arm64.cc +++ b/runtime/arch/arm64/entrypoints_init_arm64.cc @@ -151,6 +151,9 @@ void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method; qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception; qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow; + + // Deoptimize + qpoints->pDeoptimize = art_quick_deoptimize; }; } // namespace art diff --git a/runtime/arch/x86/entrypoints_init_x86.cc b/runtime/arch/x86/entrypoints_init_x86.cc index 7cdd2fc74e..c0121736eb 100644 --- a/runtime/arch/x86/entrypoints_init_x86.cc +++ b/runtime/arch/x86/entrypoints_init_x86.cc @@ -141,6 +141,9 @@ void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method; qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception; qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow; + + // Deoptimize + qpoints->pDeoptimize = art_quick_deoptimize_from_compiled_slow_path; }; } // namespace art diff --git a/runtime/arch/x86/quick_entrypoints_x86.S b/runtime/arch/x86/quick_entrypoints_x86.S index e59c881c73..c5a020a2da 100644 --- a/runtime/arch/x86/quick_entrypoints_x86.S +++ b/runtime/arch/x86/quick_entrypoints_x86.S @@ -1542,7 +1542,10 @@ END_FUNCTION art_quick_instrumentation_exit * will long jump to the upcall with a special exception of -1. */ DEFINE_FUNCTION art_quick_deoptimize - pushl %ebx // Fake that we were called. + pushl %ebx // Entry point for a jump. Fake that we were called. +.globl SYMBOL(art_quick_deoptimize_from_compiled_slow_path) // Entry point for real calls + // from compiled slow paths. +SYMBOL(art_quick_deoptimize_from_compiled_slow_path): SETUP_SAVE_ALL_CALLEE_SAVE_FRAME ebx, ebx subl LITERAL(12), %esp // Align stack. CFI_ADJUST_CFA_OFFSET(12) diff --git a/runtime/arch/x86_64/entrypoints_init_x86_64.cc b/runtime/arch/x86_64/entrypoints_init_x86_64.cc index b25d7a7c8e..3bc0dc41bd 100644 --- a/runtime/arch/x86_64/entrypoints_init_x86_64.cc +++ b/runtime/arch/x86_64/entrypoints_init_x86_64.cc @@ -146,6 +146,9 @@ void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method; qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception; qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow; + + // Deoptimize + qpoints->pDeoptimize = art_quick_deoptimize_from_compiled_slow_path; #endif // __APPLE__ }; diff --git a/runtime/arch/x86_64/quick_entrypoints_x86_64.S b/runtime/arch/x86_64/quick_entrypoints_x86_64.S index 5edcd96f59..3a448a5409 100644 --- a/runtime/arch/x86_64/quick_entrypoints_x86_64.S +++ b/runtime/arch/x86_64/quick_entrypoints_x86_64.S @@ -1600,7 +1600,11 @@ END_FUNCTION art_quick_instrumentation_exit * will long jump to the upcall with a special exception of -1. */ DEFINE_FUNCTION art_quick_deoptimize - pushq %rsi // Fake that we were called. Use hidden arg. + pushq %rsi // Entry point for a jump. Fake that we were called. + // Use hidden arg. +.globl SYMBOL(art_quick_deoptimize_from_compiled_slow_path) // Entry point for real calls + // from compiled slow paths. +SYMBOL(art_quick_deoptimize_from_compiled_slow_path): SETUP_SAVE_ALL_CALLEE_SAVE_FRAME // Stack should be aligned now. movq %gs:THREAD_SELF_OFFSET, %rdi // Pass Thread. @@ -1608,7 +1612,6 @@ DEFINE_FUNCTION art_quick_deoptimize int3 // Unreachable. END_FUNCTION art_quick_deoptimize - /* * String's compareTo. * diff --git a/runtime/asm_support.h b/runtime/asm_support.h index b1dbf6f5f3..0d0017df0b 100644 --- a/runtime/asm_support.h +++ b/runtime/asm_support.h @@ -103,7 +103,7 @@ ADD_TEST_EQ(THREAD_TOP_QUICK_FRAME_OFFSET, ADD_TEST_EQ(THREAD_SELF_OFFSET, art::Thread::SelfOffset<__SIZEOF_POINTER__>().Int32Value()) -#define THREAD_LOCAL_POS_OFFSET (THREAD_CARD_TABLE_OFFSET + 125 * __SIZEOF_POINTER__) +#define THREAD_LOCAL_POS_OFFSET (THREAD_CARD_TABLE_OFFSET + 126 * __SIZEOF_POINTER__) ADD_TEST_EQ(THREAD_LOCAL_POS_OFFSET, art::Thread::ThreadLocalPosOffset<__SIZEOF_POINTER__>().Int32Value()) #define THREAD_LOCAL_END_OFFSET (THREAD_LOCAL_POS_OFFSET + __SIZEOF_POINTER__) diff --git a/runtime/entrypoints/quick/quick_entrypoints_list.h b/runtime/entrypoints/quick/quick_entrypoints_list.h index da454f3110..eaf874eae8 100644 --- a/runtime/entrypoints/quick/quick_entrypoints_list.h +++ b/runtime/entrypoints/quick/quick_entrypoints_list.h @@ -120,6 +120,7 @@ V(ThrowNoSuchMethod, void, int32_t) \ V(ThrowNullPointer, void, void) \ V(ThrowStackOverflow, void, void*) \ + V(Deoptimize, void, void) \ \ V(A64Load, int64_t, volatile const int64_t *) \ V(A64Store, void, volatile int64_t *, int64_t) diff --git a/runtime/entrypoints/runtime_asm_entrypoints.h b/runtime/entrypoints/runtime_asm_entrypoints.h index 420e8db7c8..bfe7ee8a34 100644 --- a/runtime/entrypoints/runtime_asm_entrypoints.h +++ b/runtime/entrypoints/runtime_asm_entrypoints.h @@ -70,6 +70,8 @@ static inline const void* GetQuickInstrumentationEntryPoint() { return reinterpret_cast<const void*>(art_quick_instrumentation_entry); } +extern "C" void art_quick_deoptimize_from_compiled_slow_path(); + // The return_pc of instrumentation exit stub. extern "C" void art_quick_instrumentation_exit(); static inline const void* GetQuickInstrumentationExitPc() { diff --git a/runtime/entrypoints_order_test.cc b/runtime/entrypoints_order_test.cc index 88209a3d3c..0664fa0881 100644 --- a/runtime/entrypoints_order_test.cc +++ b/runtime/entrypoints_order_test.cc @@ -265,7 +265,8 @@ class EntrypointsOrderTest : public CommonRuntimeTest { EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pThrowDivZero, pThrowNoSuchMethod, sizeof(void*)); EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pThrowNoSuchMethod, pThrowNullPointer, sizeof(void*)); EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pThrowNullPointer, pThrowStackOverflow, sizeof(void*)); - EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pThrowStackOverflow, pA64Load, sizeof(void*)); + EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pThrowStackOverflow, pDeoptimize, sizeof(void*)); + EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pDeoptimize, pA64Load, sizeof(void*)); EXPECT_OFFSET_DIFFNP(QuickEntryPoints, pA64Load, pA64Store, sizeof(void*)); CHECKED(OFFSETOF_MEMBER(QuickEntryPoints, pA64Store) diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc index 686b518c5f..4801124fc6 100644 --- a/runtime/interpreter/interpreter.cc +++ b/runtime/interpreter/interpreter.cc @@ -401,7 +401,9 @@ void EnterInterpreterFromDeoptimize(Thread* self, ShadowFrame* shadow_frame, JVa // or DexFile::kDexNoIndex if there is none. } else { const Instruction* instr = Instruction::At(&code_item->insns_[dex_pc]); - new_dex_pc = dex_pc + instr->SizeInCodeUnits(); // the dex pc of the next instruction. + // For an invoke, use the dex pc of the next instruction. + // TODO: should be tested more once b/17586779 is fixed. + new_dex_pc = dex_pc + (instr->IsInvoke() ? instr->SizeInCodeUnits() : 0); } if (new_dex_pc != DexFile::kDexNoIndex) { shadow_frame->SetDexPC(new_dex_pc); diff --git a/runtime/thread.cc b/runtime/thread.cc index e1a07e9c67..9fee779c63 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -1996,6 +1996,7 @@ void Thread::DumpThreadOffset(std::ostream& os, uint32_t offset) { QUICK_ENTRY_POINT_INFO(pThrowNoSuchMethod) QUICK_ENTRY_POINT_INFO(pThrowNullPointer) QUICK_ENTRY_POINT_INFO(pThrowStackOverflow) + QUICK_ENTRY_POINT_INFO(pDeoptimize) QUICK_ENTRY_POINT_INFO(pA64Load) QUICK_ENTRY_POINT_INFO(pA64Store) #undef QUICK_ENTRY_POINT_INFO |