summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-20 23:00:48 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-20 23:00:48 +0000
commit88baac34da072b41917b4adc1987c55546266b33 (patch)
tree174e144db5baa56d176942efa4f575bd9f3e9d14
parente94ec6d8037802bbe451a704b2d6f0b4ee94cc48 (diff)
parentc618f7c01e83409e57f3e74bdc1fd4bdc6a828b5 (diff)
downloadart-android13-release.tar.gz
Change-Id: I4b584491ca686c3e747bc58327b742a34be79b8b
-rw-r--r--openjdkjvmti/deopt_manager.cc10
-rw-r--r--runtime/instrumentation.cc17
-rw-r--r--runtime/instrumentation.h7
-rw-r--r--runtime/jit/jit.cc7
-rwxr-xr-xtest/etc/run-test-jar6
5 files changed, 17 insertions, 30 deletions
diff --git a/openjdkjvmti/deopt_manager.cc b/openjdkjvmti/deopt_manager.cc
index a15e6678f1..312a797b9d 100644
--- a/openjdkjvmti/deopt_manager.cc
+++ b/openjdkjvmti/deopt_manager.cc
@@ -460,15 +460,7 @@ void DeoptManager::AddDeoptimizationRequester() {
art::ScopedThreadStateChange stsc(self, art::ThreadState::kSuspended);
deoptimization_status_lock_.ExclusiveLock(self);
deopter_count_++;
- if (deopter_count_ == 1) {
- ScopedDeoptimizationContext sdc(self, this);
- art::instrumentation::Instrumentation* instrumentation =
- art::Runtime::Current()->GetInstrumentation();
- // Tell instrumentation we will be deopting single threads.
- instrumentation->EnableSingleThreadDeopt(kInstrumentationKey);
- } else {
- deoptimization_status_lock_.ExclusiveUnlock(self);
- }
+ deoptimization_status_lock_.ExclusiveUnlock(self);
}
void DeoptManager::DeoptimizeThread(art::Thread* target) {
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc
index 1e328a31d2..6ec98ff4d8 100644
--- a/runtime/instrumentation.cc
+++ b/runtime/instrumentation.cc
@@ -372,7 +372,7 @@ void Instrumentation::InitializeMethodsCode(ArtMethod* method, const void* aot_c
REQUIRES_SHARED(Locks::mutator_lock_) {
// Use instrumentation entrypoints if instrumentation is installed.
if (UNLIKELY(EntryExitStubsInstalled()) && !IsProxyInit(method)) {
- if (!method->IsNative() && InterpretOnly()) {
+ if (!method->IsNative() && InterpretOnly(method)) {
UpdateEntryPoints(method, GetQuickToInterpreterBridge());
} else {
UpdateEntryPoints(method, GetQuickInstrumentationEntryPoint());
@@ -380,7 +380,7 @@ void Instrumentation::InitializeMethodsCode(ArtMethod* method, const void* aot_c
return;
}
- if (UNLIKELY(IsForcedInterpretOnly())) {
+ if (UNLIKELY(IsForcedInterpretOnly() || IsDeoptimized(method))) {
UpdateEntryPoints(
method, method->IsNative() ? GetQuickGenericJniStub() : GetQuickToInterpreterBridge());
return;
@@ -896,11 +896,6 @@ void Instrumentation::ConfigureStubs(const char* key, InstrumentationLevel desir
UpdateStubs();
}
-void Instrumentation::EnableSingleThreadDeopt(const char* key) {
- // Prepare for single thread deopt by installing instrumentation stubs.
- ConfigureStubs(key, InstrumentationLevel::kInstrumentWithInstrumentationStubs);
-}
-
void Instrumentation::UpdateInstrumentationLevel(InstrumentationLevel requested_level) {
instrumentation_level_ = requested_level;
}
@@ -922,7 +917,9 @@ void Instrumentation::MaybeRestoreInstrumentationStack() {
Locks::mutator_lock_->AssertExclusiveHeld(self);
Runtime::Current()->GetThreadList()->ForEach([&](Thread* t) NO_THREAD_SAFETY_ANALYSIS {
no_remaining_deopts =
- no_remaining_deopts && !t->IsForceInterpreter() &&
+ no_remaining_deopts &&
+ !t->IsForceInterpreter() &&
+ !t->HasDebuggerShadowFrames() &&
std::all_of(t->GetInstrumentationStack()->cbegin(),
t->GetInstrumentationStack()->cend(),
[&](const auto& frame) REQUIRES_SHARED(Locks::mutator_lock_) {
@@ -1058,7 +1055,7 @@ std::string Instrumentation::EntryPointString(const void* code) {
}
void Instrumentation::UpdateMethodsCodeImpl(ArtMethod* method, const void* new_code) {
- if (!EntryExitStubsInstalled()) {
+ if (!AreExitStubsInstalled()) {
// Fast path: no instrumentation.
DCHECK(!IsDeoptimized(method));
UpdateEntryPoints(method, new_code);
@@ -1079,7 +1076,7 @@ void Instrumentation::UpdateMethodsCodeImpl(ArtMethod* method, const void* new_c
return;
}
- if (CodeNeedsEntryExitStub(new_code, method)) {
+ if (EntryExitStubsInstalled() && CodeNeedsEntryExitStub(new_code, method)) {
DCHECK(method->GetEntryPointFromQuickCompiledCode() == GetQuickInstrumentationEntryPoint() ||
class_linker->IsQuickToInterpreterBridge(method->GetEntryPointFromQuickCompiledCode()))
<< EntryPointString(method->GetEntryPointFromQuickCompiledCode())
diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h
index b1631091ae..c811935e9d 100644
--- a/runtime/instrumentation.h
+++ b/runtime/instrumentation.h
@@ -524,13 +524,6 @@ class Instrumentation {
void InstallStubsForMethod(ArtMethod* method)
REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!GetDeoptimizedMethodsLock());
- // Sets up instrumentation to allow single thread deoptimization using ForceInterpreterCount.
- void EnableSingleThreadDeopt(const char* key)
- REQUIRES(Locks::mutator_lock_, Roles::uninterruptible_)
- REQUIRES(!Locks::thread_list_lock_,
- !Locks::classlinker_classes_lock_,
- !GetDeoptimizedMethodsLock());
-
// Install instrumentation exit stub on every method of the stack of the given thread.
// This is used by:
// - the debugger to cause a deoptimization of the all frames in thread's stack (for
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 5e01aaa7fa..6d634ae120 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -568,7 +568,12 @@ bool Jit::MaybeDoOnStackReplacement(Thread* thread,
// Before allowing the jump, make sure no code is actively inspecting the method to avoid
// jumping from interpreter to OSR while e.g. single stepping. Note that we could selectively
// disable OSR when single stepping, but that's currently hard to know at this point.
- if (Runtime::Current()->GetRuntimeCallbacks()->IsMethodBeingInspected(method)) {
+ if (Runtime::Current()->GetInstrumentation()->InterpreterStubsInstalled() ||
+ Runtime::Current()->GetInstrumentation()->IsDeoptimized(method) ||
+ thread->IsForceInterpreter() ||
+ method->GetDeclaringClass()->IsObsoleteObject() ||
+ Dbg::IsForcedInterpreterNeededForUpcall(thread, method) ||
+ Runtime::Current()->GetRuntimeCallbacks()->IsMethodBeingInspected(method)) {
return false;
}
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 75dc8fe728..ef168ca871 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -650,11 +650,11 @@ if [ "$USE_JVMTI" = "y" ]; then
# needed anymore since the plugin can do it for us now.
FLAGS="${FLAGS} -Xplugin:${plugin}"
- # For jvmti tests, set the threshold of compilation to 0, so we jit on the first
- # use to provide better test coverage for jvmti + jit. This means we won't run
+ # For jvmti tests, set the threshold of compilation to 1, so we jit early to
+ # provide better test coverage for jvmti + jit. This means we won't run
# the default --jit configuration but it is not too important test scenario for
# jvmti tests. This is art specific flag, so don't use it with jvm.
- FLAGS="${FLAGS} -Xjitthreshold:0"
+ FLAGS="${FLAGS} -Xjitthreshold:1"
fi
fi