Fix the bug that some compiled code was invoked with -Xint.
Some compiled code (probably static methods) is still being invoked
with -Xint. Added an assert to detect this case.
Bug: 13250375
Change-Id: Iecfe8ef40c6c326962593db78e6e1d9f1c93842e
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc
index 9d05169..01ad46d 100644
--- a/runtime/instrumentation.cc
+++ b/runtime/instrumentation.cc
@@ -80,9 +80,19 @@
method->ClearIsPortableCompiled();
}
if (!method->IsResolutionMethod()) {
- if (quick_code == GetQuickToInterpreterBridge()) {
- DCHECK(portable_code == GetPortableToInterpreterBridge());
+ if (quick_code == GetQuickToInterpreterBridge() ||
+ (quick_code == GetQuickResolutionTrampoline(Runtime::Current()->GetClassLinker()) &&
+ Runtime::Current()->GetInstrumentation()->IsForcedInterpretOnly()
+ && !method->IsNative() && !method->IsProxyMethod())) {
+ if (kIsDebugBuild) {
+ if (quick_code == GetQuickToInterpreterBridge()) {
+ DCHECK(portable_code == GetPortableToInterpreterBridge());
+ } else if (quick_code == GetQuickResolutionTrampoline(Runtime::Current()->GetClassLinker())) {
+ DCHECK(portable_code == GetPortableResolutionTrampoline(Runtime::Current()->GetClassLinker()));
+ }
+ }
DCHECK(!method->IsNative()) << PrettyMethod(method);
+ DCHECK(!method->IsProxyMethod()) << PrettyMethod(method);
method->SetEntryPointFromInterpreter(art::interpreter::artInterpreterToInterpreterBridge);
} else {
method->SetEntryPointFromInterpreter(art::artInterpreterToCompiledCodeBridge);
diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h
index 1ce72bd..017573a 100644
--- a/runtime/instrumentation.h
+++ b/runtime/instrumentation.h
@@ -192,6 +192,10 @@
return interpret_only_;
}
+ bool IsForcedInterpretOnly() const {
+ return forced_interpret_only_;
+ }
+
bool ShouldPortableCodeDeoptimize() const {
return instrumentation_stubs_installed_;
}
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index f76d50c..e8cea9d 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -155,6 +155,11 @@
if (kIsDebugBuild && method->GetEntryPointFromInterpreter() == nullptr) {
LOG(FATAL) << "Attempt to invoke non-executable method: " << PrettyMethod(method);
}
+ if (kIsDebugBuild && Runtime::Current()->GetInstrumentation()->IsForcedInterpretOnly() &&
+ !method->IsNative() && !method->IsProxyMethod() &&
+ method->GetEntryPointFromInterpreter() == artInterpreterToCompiledCodeBridge) {
+ LOG(FATAL) << "Attempt to call compiled code when -Xint: " << PrettyMethod(method);
+ }
(method->GetEntryPointFromInterpreter())(self, mh, code_item, new_shadow_frame, result);
} else {
UnstartedRuntimeInvoke(self, mh, code_item, new_shadow_frame, result, first_dest_reg);