diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-21 16:38:25 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-21 16:38:25 +0000 |
commit | 604ffded8a09b1306bebd0c42f7a268ed344d2bd (patch) | |
tree | 174e144db5baa56d176942efa4f575bd9f3e9d14 | |
parent | 6c1cf06dbdc43c06cec9f3cd49b73187051443e7 (diff) | |
parent | c618f7c01e83409e57f3e74bdc1fd4bdc6a828b5 (diff) | |
download | art-android13-frc-permission-release.tar.gz |
Snap for 8748865 from c618f7c01e83409e57f3e74bdc1fd4bdc6a828b5 to tm-frc-permission-releaset_frc_per_330444010android13-frc-permission-release
Change-Id: I9bfb9fef63313443e56185a10b5c596fe4cf5df1
-rw-r--r-- | openjdkjvmti/deopt_manager.cc | 10 | ||||
-rw-r--r-- | runtime/instrumentation.cc | 17 | ||||
-rw-r--r-- | runtime/instrumentation.h | 7 | ||||
-rw-r--r-- | runtime/jit/jit.cc | 7 | ||||
-rwxr-xr-x | test/etc/run-test-jar | 6 |
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 |