Revert "Remove interpreter entrypoint in ArtMethod."
Build failures on bots. Investigating.
This reverts commit fa2c054b28d4b540c1b3651401a7a091282a015f.
Change-Id: Id65b2009aa66cb291fb8c39758a58e0b0d22616c
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index 0980ea1..fa103b1 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -19,7 +19,6 @@
#include <cmath>
#include "debugger.h"
-#include "entrypoints/runtime_asm_entrypoints.h"
#include "mirror/array-inl.h"
#include "unstarted_runtime.h"
#include "verifier/method_verifier.h"
@@ -491,23 +490,6 @@
uint32_t arg[Instruction::kMaxVarArgRegs],
uint32_t vregC) ALWAYS_INLINE;
-SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
-static inline bool NeedsInterpreter(Thread* self, ShadowFrame* new_shadow_frame) ALWAYS_INLINE;
-
-static inline bool NeedsInterpreter(Thread* self, ShadowFrame* new_shadow_frame) {
- ArtMethod* target = new_shadow_frame->GetMethod();
- if (UNLIKELY(target->IsNative() || target->IsProxyMethod())) {
- return false;
- }
- Runtime* runtime = Runtime::Current();
- ClassLinker* class_linker = runtime->GetClassLinker();
- return runtime->GetInstrumentation()->IsForcedInterpretOnly() ||
- // Doing this check avoids doing compiled/interpreter transitions.
- class_linker->IsQuickToInterpreterBridge(target->GetEntryPointFromQuickCompiledCode()) ||
- // Force the use of interpreter when it is required by the debugger.
- Dbg::IsForcedInterpreterNeededForCalling(self, target);
-}
-
template<bool is_range, bool do_assignability_check>
static inline bool DoCallCommon(ArtMethod* called_method,
Thread* self,
@@ -678,11 +660,28 @@
// Do the call now.
if (LIKELY(Runtime::Current()->IsStarted())) {
- if (NeedsInterpreter(self, new_shadow_frame)) {
- artInterpreterToInterpreterBridge(self, code_item, new_shadow_frame, result);
- } else {
- artInterpreterToCompiledCodeBridge(self, code_item, new_shadow_frame, result);
+ if (kIsDebugBuild && new_shadow_frame->GetMethod()->GetEntryPointFromInterpreter() == nullptr) {
+ LOG(FATAL) << "Attempt to invoke non-executable method: "
+ << PrettyMethod(new_shadow_frame->GetMethod());
+ UNREACHABLE();
}
+ if (kIsDebugBuild && Runtime::Current()->GetInstrumentation()->IsForcedInterpretOnly() &&
+ !new_shadow_frame->GetMethod()->IsNative() &&
+ !new_shadow_frame->GetMethod()->IsProxyMethod() &&
+ new_shadow_frame->GetMethod()->GetEntryPointFromInterpreter()
+ == artInterpreterToCompiledCodeBridge) {
+ LOG(FATAL) << "Attempt to call compiled code when -Xint: "
+ << PrettyMethod(new_shadow_frame->GetMethod());
+ UNREACHABLE();
+ }
+ // Force the use of interpreter when it is required by the debugger.
+ EntryPointFromInterpreter* entry;
+ if (UNLIKELY(Dbg::IsForcedInterpreterNeededForCalling(self, new_shadow_frame->GetMethod()))) {
+ entry = &art::artInterpreterToInterpreterBridge;
+ } else {
+ entry = new_shadow_frame->GetMethod()->GetEntryPointFromInterpreter();
+ }
+ entry(self, code_item, new_shadow_frame, result);
} else {
UnstartedRuntime::Invoke(self, code_item, new_shadow_frame, result, first_dest_reg);
}