diff options
23 files changed, 58 insertions, 213 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index f74b079aed..74f19a1029 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -456,14 +456,6 @@ CompilerDriver::~CompilerDriver() { type ## _ENTRYPOINT_OFFSET(4, offset)); \ } -const std::vector<uint8_t>* CompilerDriver::CreateInterpreterToInterpreterBridge() const { - CREATE_TRAMPOLINE(INTERPRETER, kInterpreterAbi, pInterpreterToInterpreterBridge) -} - -const std::vector<uint8_t>* CompilerDriver::CreateInterpreterToCompiledCodeBridge() const { - CREATE_TRAMPOLINE(INTERPRETER, kInterpreterAbi, pInterpreterToCompiledCodeBridge) -} - const std::vector<uint8_t>* CompilerDriver::CreateJniDlsymLookup() const { CREATE_TRAMPOLINE(JNI, kJniAbi, pDlsymLookup) } diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h index 11e782f437..0dc8261aac 100644 --- a/compiler/driver/compiler_driver.h +++ b/compiler/driver/compiler_driver.h @@ -155,10 +155,6 @@ class CompilerDriver { } // Generate the trampolines that are invoked by unresolved direct methods. - const std::vector<uint8_t>* CreateInterpreterToInterpreterBridge() const - SHARED_REQUIRES(Locks::mutator_lock_); - const std::vector<uint8_t>* CreateInterpreterToCompiledCodeBridge() const - SHARED_REQUIRES(Locks::mutator_lock_); const std::vector<uint8_t>* CreateJniDlsymLookup() const SHARED_REQUIRES(Locks::mutator_lock_); const std::vector<uint8_t>* CreateQuickGenericJniTrampoline() const diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc index 4ddd457ac5..7b410bfe37 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -1091,8 +1091,6 @@ size_t OatWriter::InitOatCode(size_t offset) { field.reset(compiler_driver_->Create ## fn_name()); \ offset += field->size(); - DO_TRAMPOLINE(interpreter_to_interpreter_bridge_, InterpreterToInterpreterBridge); - DO_TRAMPOLINE(interpreter_to_compiled_code_bridge_, InterpreterToCompiledCodeBridge); DO_TRAMPOLINE(jni_dlsym_lookup_, JniDlsymLookup); DO_TRAMPOLINE(quick_generic_jni_trampoline_, QuickGenericJniTrampoline); DO_TRAMPOLINE(quick_imt_conflict_trampoline_, QuickImtConflictTrampoline); @@ -1350,8 +1348,6 @@ size_t OatWriter::WriteCode(OutputStream* out, const size_t file_offset, size_t DCHECK_OFFSET(); \ } while (false) - DO_TRAMPOLINE(interpreter_to_interpreter_bridge_); - DO_TRAMPOLINE(interpreter_to_compiled_code_bridge_); DO_TRAMPOLINE(jni_dlsym_lookup_); DO_TRAMPOLINE(quick_generic_jni_trampoline_); DO_TRAMPOLINE(quick_imt_conflict_trampoline_); diff --git a/compiler/oat_writer.h b/compiler/oat_writer.h index 760fb7c12c..48fbc0b2ac 100644 --- a/compiler/oat_writer.h +++ b/compiler/oat_writer.h @@ -285,8 +285,6 @@ class OatWriter { OatHeader* oat_header_; std::vector<OatDexFile*> oat_dex_files_; std::vector<OatClass*> oat_classes_; - std::unique_ptr<const std::vector<uint8_t>> interpreter_to_interpreter_bridge_; - std::unique_ptr<const std::vector<uint8_t>> interpreter_to_compiled_code_bridge_; std::unique_ptr<const std::vector<uint8_t>> jni_dlsym_lookup_; std::unique_ptr<const std::vector<uint8_t>> quick_generic_jni_trampoline_; std::unique_ptr<const std::vector<uint8_t>> quick_imt_conflict_trampoline_; diff --git a/runtime/Android.mk b/runtime/Android.mk index 8d81f2a7f6..b8d3e13744 100644 --- a/runtime/Android.mk +++ b/runtime/Android.mk @@ -203,7 +203,6 @@ LIBART_COMMON_SRC_FILES += \ arch/x86/registers_x86.cc \ arch/x86_64/registers_x86_64.cc \ entrypoints/entrypoint_utils.cc \ - entrypoints/interpreter/interpreter_entrypoints.cc \ entrypoints/jni/jni_entrypoints.cc \ entrypoints/math_entrypoints.cc \ entrypoints/quick/quick_alloc_entrypoints.cc \ diff --git a/runtime/arch/arm/entrypoints_init_arm.cc b/runtime/arch/arm/entrypoints_init_arm.cc index 1599025697..76c7c4f6f0 100644 --- a/runtime/arch/arm/entrypoints_init_arm.cc +++ b/runtime/arch/arm/entrypoints_init_arm.cc @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "entrypoints/interpreter/interpreter_entrypoints.h" #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "entrypoints/quick/quick_default_externs.h" @@ -47,12 +46,7 @@ extern "C" int __aeabi_idivmod(int32_t, int32_t); // [DIV|REM]_INT[_2ADDR|_LIT8 // Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR] extern "C" int64_t __aeabi_ldivmod(int64_t, int64_t); -void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, - QuickEntryPoints* qpoints) { - // Interpreter - ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge; - ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge; - +void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { // JNI jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; diff --git a/runtime/arch/arm64/entrypoints_init_arm64.cc b/runtime/arch/arm64/entrypoints_init_arm64.cc index e9c816f260..371cbb2673 100644 --- a/runtime/arch/arm64/entrypoints_init_arm64.cc +++ b/runtime/arch/arm64/entrypoints_init_arm64.cc @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "entrypoints/interpreter/interpreter_entrypoints.h" #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "entrypoints/quick/quick_default_externs.h" @@ -30,12 +29,7 @@ namespace art { extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass, const mirror::Class* ref_class); -void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, - QuickEntryPoints* qpoints) { - // Interpreter - ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge; - ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge; - +void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { // JNI jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; diff --git a/runtime/arch/mips/entrypoints_init_mips.cc b/runtime/arch/mips/entrypoints_init_mips.cc index 6721e5452f..59421dd8b9 100644 --- a/runtime/arch/mips/entrypoints_init_mips.cc +++ b/runtime/arch/mips/entrypoints_init_mips.cc @@ -15,7 +15,6 @@ */ #include "atomic.h" -#include "entrypoints/interpreter/interpreter_entrypoints.h" #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "entrypoints/quick/quick_default_externs.h" @@ -59,12 +58,7 @@ extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR] extern "C" int64_t __divdi3(int64_t, int64_t); extern "C" int64_t __moddi3(int64_t, int64_t); -void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, - QuickEntryPoints* qpoints) { - // Interpreter - ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge; - ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge; - +void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { // JNI jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; diff --git a/runtime/arch/mips64/entrypoints_init_mips64.cc b/runtime/arch/mips64/entrypoints_init_mips64.cc index 9f1f0e021c..417d5fc632 100644 --- a/runtime/arch/mips64/entrypoints_init_mips64.cc +++ b/runtime/arch/mips64/entrypoints_init_mips64.cc @@ -15,7 +15,6 @@ */ #include "atomic.h" -#include "entrypoints/interpreter/interpreter_entrypoints.h" #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "entrypoints/quick/quick_default_externs.h" @@ -57,12 +56,7 @@ extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR] extern "C" int64_t __divdi3(int64_t, int64_t); extern "C" int64_t __moddi3(int64_t, int64_t); -void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, - QuickEntryPoints* qpoints) { - // Interpreter - ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge; - ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge; - +void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { // JNI jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; diff --git a/runtime/arch/x86/entrypoints_init_x86.cc b/runtime/arch/x86/entrypoints_init_x86.cc index 10fc281e3d..019546f2ce 100644 --- a/runtime/arch/x86/entrypoints_init_x86.cc +++ b/runtime/arch/x86/entrypoints_init_x86.cc @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "entrypoints/interpreter/interpreter_entrypoints.h" #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "entrypoints/quick/quick_default_externs.h" @@ -31,12 +30,7 @@ extern "C" uint32_t art_quick_is_assignable(const mirror::Class* klass, // Read barrier entrypoints. extern "C" mirror::Object* art_quick_read_barrier_slow(mirror::Object*, mirror::Object*, uint32_t); -void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, - QuickEntryPoints* qpoints) { - // Interpreter - ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge; - ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge; - +void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { // JNI jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; diff --git a/runtime/arch/x86_64/entrypoints_init_x86_64.cc b/runtime/arch/x86_64/entrypoints_init_x86_64.cc index 5cc72e3c4b..eae09ee1f4 100644 --- a/runtime/arch/x86_64/entrypoints_init_x86_64.cc +++ b/runtime/arch/x86_64/entrypoints_init_x86_64.cc @@ -14,7 +14,6 @@ * limitations under the License. */ -#include "entrypoints/interpreter/interpreter_entrypoints.h" #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "entrypoints/quick/quick_default_externs.h" @@ -32,16 +31,11 @@ extern "C" uint32_t art_quick_assignable_from_code(const mirror::Class* klass, // Read barrier entrypoints. extern "C" mirror::Object* art_quick_read_barrier_slow(mirror::Object*, mirror::Object*, uint32_t); -void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, - QuickEntryPoints* qpoints) { +void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { #if defined(__APPLE__) - UNUSED(ipoints, jpoints, qpoints); + UNUSED(jpoints, qpoints); UNIMPLEMENTED(FATAL); #else - // Interpreter - ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge; - ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge; - // JNI jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; diff --git a/runtime/asm_support.h b/runtime/asm_support.h index 1b569fe74a..d98fc5179f 100644 --- a/runtime/asm_support.h +++ b/runtime/asm_support.h @@ -109,7 +109,7 @@ ADD_TEST_EQ(THREAD_SELF_OFFSET, art::Thread::SelfOffset<__SIZEOF_POINTER__>().Int32Value()) // Offset of field Thread::tlsPtr_.thread_local_pos. -#define THREAD_LOCAL_POS_OFFSET (THREAD_CARD_TABLE_OFFSET + 152 * __SIZEOF_POINTER__) +#define THREAD_LOCAL_POS_OFFSET (THREAD_CARD_TABLE_OFFSET + 150 * __SIZEOF_POINTER__) ADD_TEST_EQ(THREAD_LOCAL_POS_OFFSET, art::Thread::ThreadLocalPosOffset<__SIZEOF_POINTER__>().Int32Value()) // Offset of field Thread::tlsPtr_.thread_local_end. diff --git a/runtime/entrypoints/interpreter/interpreter_entrypoints.cc b/runtime/entrypoints/interpreter/interpreter_entrypoints.cc deleted file mode 100644 index 72c2e0a5b0..0000000000 --- a/runtime/entrypoints/interpreter/interpreter_entrypoints.cc +++ /dev/null @@ -1,56 +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 "art_method-inl.h" -#include "class_linker.h" -#include "dex_file-inl.h" -#include "interpreter/interpreter.h" -#include "mirror/object-inl.h" -#include "reflection.h" -#include "runtime.h" -#include "stack.h" - -namespace art { - -extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame* shadow_frame, JValue* result) { - ArtMethod* method = shadow_frame->GetMethod(); - // Ensure static methods are initialized. - if (method->IsStatic()) { - mirror::Class* declaringClass = method->GetDeclaringClass(); - if (UNLIKELY(!declaringClass->IsInitialized())) { - self->PushShadowFrame(shadow_frame); - StackHandleScope<1> hs(self); - Handle<mirror::Class> h_class(hs.NewHandle(declaringClass)); - if (UNLIKELY(!Runtime::Current()->GetClassLinker()->EnsureInitialized(self, h_class, true, - true))) { - self->PopShadowFrame(); - DCHECK(self->IsExceptionPending()); - return; - } - self->PopShadowFrame(); - CHECK(h_class->IsInitializing()); - // Reload from shadow frame in case the method moved, this is faster than adding a handle. - method = shadow_frame->GetMethod(); - } - } - uint16_t arg_offset = (code_item == nullptr) ? 0 : code_item->registers_size_ - code_item->ins_size_; - method->Invoke(self, shadow_frame->GetVRegArgs(arg_offset), - (shadow_frame->NumberOfVRegs() - arg_offset) * sizeof(uint32_t), - result, method->GetInterfaceMethodIfProxy(sizeof(void*))->GetShorty()); -} - -} // namespace art diff --git a/runtime/entrypoints/interpreter/interpreter_entrypoints.h b/runtime/entrypoints/interpreter/interpreter_entrypoints.h deleted file mode 100644 index 09522149a7..0000000000 --- a/runtime/entrypoints/interpreter/interpreter_entrypoints.h +++ /dev/null @@ -1,43 +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_ENTRYPOINTS_INTERPRETER_INTERPRETER_ENTRYPOINTS_H_ -#define ART_RUNTIME_ENTRYPOINTS_INTERPRETER_INTERPRETER_ENTRYPOINTS_H_ - -#include "base/macros.h" -#include "dex_file.h" -#include "offsets.h" - -#define INTERPRETER_ENTRYPOINT_OFFSET(ptr_size, x) \ - Thread::InterpreterEntryPointOffset<ptr_size>(OFFSETOF_MEMBER(InterpreterEntryPoints, x)) - -namespace art { - -union JValue; -class ShadowFrame; -class Thread; - -// Pointers to functions that are called by interpreter trampolines via thread-local storage. -struct PACKED(4) InterpreterEntryPoints { - void (*pInterpreterToInterpreterBridge)(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame* shadow_frame, JValue* result); - void (*pInterpreterToCompiledCodeBridge)(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame* shadow_frame, JValue* result); -}; - -} // namespace art - -#endif // ART_RUNTIME_ENTRYPOINTS_INTERPRETER_INTERPRETER_ENTRYPOINTS_H_ diff --git a/runtime/entrypoints/jni/jni_entrypoints.h b/runtime/entrypoints/jni/jni_entrypoints.h index 6fb0560a18..9c1b0dc62e 100644 --- a/runtime/entrypoints/jni/jni_entrypoints.h +++ b/runtime/entrypoints/jni/jni_entrypoints.h @@ -17,6 +17,8 @@ #ifndef ART_RUNTIME_ENTRYPOINTS_JNI_JNI_ENTRYPOINTS_H_ #define ART_RUNTIME_ENTRYPOINTS_JNI_JNI_ENTRYPOINTS_H_ +#include "jni.h" + #include "base/macros.h" #include "offsets.h" diff --git a/runtime/entrypoints_order_test.cc b/runtime/entrypoints_order_test.cc index c37d159d1a..78f56eef8d 100644 --- a/runtime/entrypoints_order_test.cc +++ b/runtime/entrypoints_order_test.cc @@ -114,7 +114,7 @@ class EntrypointsOrderTest : public CommonRuntimeTest { sizeof(void*)); EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, last_no_thread_suspension_cause, checkpoint_functions, sizeof(void*)); - EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, checkpoint_functions, interpreter_entrypoints, + EXPECT_OFFSET_DIFFP(Thread, tlsPtr_, checkpoint_functions, jni_entrypoints, sizeof(void*) * 6); // Skip across the entrypoints structures. @@ -137,15 +137,6 @@ class EntrypointsOrderTest : public CommonRuntimeTest { thread_tlsptr_end); } - void CheckInterpreterEntryPoints() { - CHECKED(OFFSETOF_MEMBER(InterpreterEntryPoints, pInterpreterToInterpreterBridge) == 0, - InterpreterEntryPoints_start_with_i2i); - EXPECT_OFFSET_DIFFNP(InterpreterEntryPoints, pInterpreterToInterpreterBridge, - pInterpreterToCompiledCodeBridge, sizeof(void*)); - CHECKED(OFFSETOF_MEMBER(InterpreterEntryPoints, pInterpreterToCompiledCodeBridge) - + sizeof(void*) == sizeof(InterpreterEntryPoints), InterpreterEntryPoints_all); - } - void CheckJniEntryPoints() { CHECKED(OFFSETOF_MEMBER(JniEntryPoints, pDlsymLookup) == 0, JniEntryPoints_start_with_dlsymlookup); @@ -321,10 +312,6 @@ TEST_F(EntrypointsOrderTest, ThreadOffsets) { CheckThreadOffsets(); } -TEST_F(EntrypointsOrderTest, InterpreterEntryPoints) { - CheckInterpreterEntryPoints(); -} - TEST_F(EntrypointsOrderTest, JniEntryPoints) { CheckJniEntryPoints(); } diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc index f783b04b95..2a76f94688 100644 --- a/runtime/interpreter/interpreter.cc +++ b/runtime/interpreter/interpreter.cc @@ -14,10 +14,11 @@ * limitations under the License. */ -#include "interpreter_common.h" +#include "interpreter.h" #include <limits> +#include "interpreter_common.h" #include "mirror/string-inl.h" #include "scoped_thread_state_change.h" #include "ScopedLocalRef.h" @@ -448,8 +449,8 @@ JValue EnterInterpreterFromEntryPoint(Thread* self, const DexFile::CodeItem* cod return Execute(self, code_item, *shadow_frame, JValue()); } -extern "C" void artInterpreterToInterpreterBridge(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame* shadow_frame, JValue* result) { +void ArtInterpreterToInterpreterBridge(Thread* self, const DexFile::CodeItem* code_item, + ShadowFrame* shadow_frame, JValue* result) { bool implicit_check = !Runtime::Current()->ExplicitStackOverflowChecks(); if (UNLIKELY(__builtin_frame_address(0) < self->GetStackEndForInterpreter(implicit_check))) { ThrowStackOverflowError(self); diff --git a/runtime/interpreter/interpreter.h b/runtime/interpreter/interpreter.h index 61140a24cf..b21ea84d8e 100644 --- a/runtime/interpreter/interpreter.h +++ b/runtime/interpreter/interpreter.h @@ -45,16 +45,11 @@ extern JValue EnterInterpreterFromEntryPoint(Thread* self, const DexFile::CodeIt ShadowFrame* shadow_frame) SHARED_REQUIRES(Locks::mutator_lock_); - -} // namespace interpreter - -extern "C" void artInterpreterToInterpreterBridge(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame* shadow_frame, JValue* result) +void ArtInterpreterToInterpreterBridge(Thread* self, const DexFile::CodeItem* code_item, + ShadowFrame* shadow_frame, JValue* result) SHARED_REQUIRES(Locks::mutator_lock_); -extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, const DexFile::CodeItem* code_item, - ShadowFrame* shadow_frame, JValue* result) - SHARED_REQUIRES(Locks::mutator_lock_); +} // namespace interpreter } // namespace art diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index ad34c9ad9e..6f5b843ee4 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -516,6 +516,39 @@ static inline bool NeedsInterpreter(Thread* self, ShadowFrame* new_shadow_frame) Dbg::IsForcedInterpreterNeededForCalling(self, target); } +static void ArtInterpreterToCompiledCodeBridge(Thread* self, + const DexFile::CodeItem* code_item, + ShadowFrame* shadow_frame, + JValue* result) + SHARED_REQUIRES(Locks::mutator_lock_) { + ArtMethod* method = shadow_frame->GetMethod(); + // Ensure static methods are initialized. + if (method->IsStatic()) { + mirror::Class* declaringClass = method->GetDeclaringClass(); + if (UNLIKELY(!declaringClass->IsInitialized())) { + self->PushShadowFrame(shadow_frame); + StackHandleScope<1> hs(self); + Handle<mirror::Class> h_class(hs.NewHandle(declaringClass)); + if (UNLIKELY(!Runtime::Current()->GetClassLinker()->EnsureInitialized(self, h_class, true, + true))) { + self->PopShadowFrame(); + DCHECK(self->IsExceptionPending()); + return; + } + self->PopShadowFrame(); + CHECK(h_class->IsInitializing()); + // Reload from shadow frame in case the method moved, this is faster than adding a handle. + method = shadow_frame->GetMethod(); + } + } + uint16_t arg_offset = (code_item == nullptr) + ? 0 + : code_item->registers_size_ - code_item->ins_size_; + method->Invoke(self, shadow_frame->GetVRegArgs(arg_offset), + (shadow_frame->NumberOfVRegs() - arg_offset) * sizeof(uint32_t), + result, method->GetInterfaceMethodIfProxy(sizeof(void*))->GetShorty()); +} + template <bool is_range, bool do_assignability_check, size_t kVarArgMax> @@ -690,9 +723,9 @@ static inline bool DoCallCommon(ArtMethod* called_method, // Do the call now. if (LIKELY(Runtime::Current()->IsStarted())) { if (NeedsInterpreter(self, new_shadow_frame)) { - artInterpreterToInterpreterBridge(self, code_item, new_shadow_frame, result); + ArtInterpreterToInterpreterBridge(self, code_item, new_shadow_frame, result); } else { - artInterpreterToCompiledCodeBridge(self, code_item, new_shadow_frame, result); + ArtInterpreterToCompiledCodeBridge(self, code_item, new_shadow_frame, result); } } else { UnstartedRuntime::Invoke(self, code_item, new_shadow_frame, result, first_dest_reg); diff --git a/runtime/interpreter/unstarted_runtime.cc b/runtime/interpreter/unstarted_runtime.cc index c559389dba..92b6e4fe0d 100644 --- a/runtime/interpreter/unstarted_runtime.cc +++ b/runtime/interpreter/unstarted_runtime.cc @@ -1099,7 +1099,7 @@ void UnstartedRuntime::Invoke(Thread* self, const DexFile::CodeItem* code_item, (*iter->second)(self, shadow_frame, result, arg_offset); } else { // Not special, continue with regular interpreter execution. - artInterpreterToInterpreterBridge(self, code_item, shadow_frame, result); + ArtInterpreterToInterpreterBridge(self, code_item, shadow_frame, result); } } diff --git a/runtime/oat.h b/runtime/oat.h index 24acbc8c4a..2aa5783bde 100644 --- a/runtime/oat.h +++ b/runtime/oat.h @@ -32,7 +32,7 @@ class InstructionSetFeatures; class PACKED(4) OatHeader { public: static constexpr uint8_t kOatMagic[] = { 'o', 'a', 't', '\n' }; - static constexpr uint8_t kOatVersion[] = { '0', '7', '1', '\0' }; + static constexpr uint8_t kOatVersion[] = { '0', '7', '2', '\0' }; static constexpr const char* kImageLocationKey = "image-location"; static constexpr const char* kDex2OatCmdLineKey = "dex2oat-cmdline"; diff --git a/runtime/thread.cc b/runtime/thread.cc index 65f71efc06..12b2e88cbb 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -106,19 +106,17 @@ static void UnimplementedEntryPoint() { UNIMPLEMENTED(FATAL); } -void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, - QuickEntryPoints* qpoints); +void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints); void Thread::InitTlsEntryPoints() { // Insert a placeholder so we can easily tell if we call an unimplemented entry point. - uintptr_t* begin = reinterpret_cast<uintptr_t*>(&tlsPtr_.interpreter_entrypoints); + uintptr_t* begin = reinterpret_cast<uintptr_t*>(&tlsPtr_.jni_entrypoints); uintptr_t* end = reinterpret_cast<uintptr_t*>(reinterpret_cast<uint8_t*>(&tlsPtr_.quick_entrypoints) + sizeof(tlsPtr_.quick_entrypoints)); for (uintptr_t* it = begin; it != end; ++it) { *it = reinterpret_cast<uintptr_t>(UnimplementedEntryPoint); } - InitEntryPoints(&tlsPtr_.interpreter_entrypoints, &tlsPtr_.jni_entrypoints, - &tlsPtr_.quick_entrypoints); + InitEntryPoints(&tlsPtr_.jni_entrypoints, &tlsPtr_.quick_entrypoints); } void Thread::InitStringEntryPoints() { @@ -2367,15 +2365,6 @@ void Thread::DumpThreadOffset(std::ostream& os, uint32_t offset) { DO_THREAD_OFFSET(ThreadSuspendTriggerOffset<ptr_size>(), "suspend_trigger") #undef DO_THREAD_OFFSET -#define INTERPRETER_ENTRY_POINT_INFO(x) \ - if (INTERPRETER_ENTRYPOINT_OFFSET(ptr_size, x).Uint32Value() == offset) { \ - os << #x; \ - return; \ - } - INTERPRETER_ENTRY_POINT_INFO(pInterpreterToInterpreterBridge) - INTERPRETER_ENTRY_POINT_INFO(pInterpreterToCompiledCodeBridge) -#undef INTERPRETER_ENTRY_POINT_INFO - #define JNI_ENTRY_POINT_INFO(x) \ if (JNI_ENTRYPOINT_OFFSET(ptr_size, x).Uint32Value() == offset) { \ os << #x; \ diff --git a/runtime/thread.h b/runtime/thread.h index d262c62224..8cea10c844 100644 --- a/runtime/thread.h +++ b/runtime/thread.h @@ -30,7 +30,6 @@ #include "atomic.h" #include "base/macros.h" #include "base/mutex.h" -#include "entrypoints/interpreter/interpreter_entrypoints.h" #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_entrypoints.h" #include "globals.h" @@ -580,12 +579,6 @@ class Thread { } template<size_t pointer_size> - static ThreadOffset<pointer_size> InterpreterEntryPointOffset(size_t interp_entrypoint_offset) { - return ThreadOffsetFromTlsPtr<pointer_size>( - OFFSETOF_MEMBER(tls_ptr_sized_values, interpreter_entrypoints) + interp_entrypoint_offset); - } - - template<size_t pointer_size> static ThreadOffset<pointer_size> JniEntryPointOffset(size_t jni_entrypoint_offset) { return ThreadOffsetFromTlsPtr<pointer_size>( OFFSETOF_MEMBER(tls_ptr_sized_values, jni_entrypoints) + jni_entrypoint_offset); @@ -1329,7 +1322,6 @@ class Thread { // Entrypoint function pointers. // TODO: move this to more of a global offset table model to avoid per-thread duplication. - InterpreterEntryPoints interpreter_entrypoints; JniEntryPoints jni_entrypoints; QuickEntryPoints quick_entrypoints; |