diff options
author | 2022-01-17 17:12:38 +0000 | |
---|---|---|
committer | 2022-01-24 10:15:09 +0000 | |
commit | c8a694ddbcda17fc90121d7e7985d90d3860a60c (patch) | |
tree | 729f5df88c74983f6cfca6a5d6761d093db7e747 /runtime/class_linker.cc | |
parent | bed84ef16bd124293714b545be1c2d96c6a618b2 (diff) |
Reland "Use InitializeMethodsCode when we need to reinitialize a method entrypoint."
This reverts commit b0f63c93e44bf53a34dda90c74b8725a932922da.
Reason for revert: Fix For proxy init.
Test: test.py
Change-Id: I6b4796115d73a093f86309cec1f03cafd981c2e9
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r-- | runtime/class_linker.cc | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 5ae65139af..5eab75dfb0 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -201,22 +201,6 @@ static void HandleEarlierErroneousStateError(Thread* self, self->AssertPendingException(); } -static void ChangeInterpreterBridgeToNterp(ArtMethod* method, ClassLinker* class_linker) - REQUIRES_SHARED(Locks::mutator_lock_) { - Runtime* runtime = Runtime::Current(); - if (class_linker->IsQuickToInterpreterBridge(method->GetEntryPointFromQuickCompiledCode()) && - CanMethodUseNterp(method)) { - if (method->GetDeclaringClass()->IsVisiblyInitialized() || - !NeedsClinitCheckBeforeCall(method)) { - runtime->GetInstrumentation()->UpdateMethodsCode(method, interpreter::GetNterpEntryPoint()); - } else { - // Put the resolution stub, which will initialize the class and then - // call the method with nterp. - runtime->GetInstrumentation()->UpdateMethodsCode(method, GetQuickResolutionStub()); - } - } -} - static void UpdateClassAfterVerification(Handle<mirror::Class> klass, PointerSize pointer_size, verifier::FailureKind failure_kind) @@ -231,7 +215,9 @@ static void UpdateClassAfterVerification(Handle<mirror::Class> klass, // to methods that currently use the switch interpreter. if (interpreter::CanRuntimeUseNterp()) { for (ArtMethod& m : klass->GetMethods(pointer_size)) { - ChangeInterpreterBridgeToNterp(&m, class_linker); + if (class_linker->IsQuickToInterpreterBridge(m.GetEntryPointFromQuickCompiledCode())) { + runtime->GetInstrumentation()->InitializeMethodsCode(&m, /*aot_code=*/nullptr); + } } } } @@ -2008,10 +1994,11 @@ bool ClassLinker::AddImageSpace( // reset it with the runtime value. method.ResetCounter(hotness_threshold); } - // Set image methods' entry point that point to the interpreter bridge to the - // nterp entry point. if (method.GetEntryPointFromQuickCompiledCode() == nterp_trampoline_) { if (can_use_nterp) { + // Set image methods' entry point that point to the nterp trampoline to the + // nterp entry point. This allows taking the fast path when doing a + // nterp->nterp call. DCHECK(!NeedsClinitCheckBeforeCall(&method) || method.GetDeclaringClass()->IsVisiblyInitialized()); method.SetEntryPointFromQuickCompiledCode(interpreter::GetNterpEntryPoint()); @@ -3388,6 +3375,7 @@ void ClassLinker::FixupStaticTrampolines(Thread* self, ObjPtr<mirror::Class> kla return; } + instrumentation::Instrumentation* instrumentation = runtime->GetInstrumentation(); // Link the code of methods skipped by LinkCode. for (size_t method_index = 0; method_index < num_direct_methods; ++method_index) { ArtMethod* method = klass->GetDirectMethod(method_index, pointer_size); @@ -3395,7 +3383,6 @@ void ClassLinker::FixupStaticTrampolines(Thread* self, ObjPtr<mirror::Class> kla // Only update static methods. continue; } - instrumentation::Instrumentation* instrumentation = runtime->GetInstrumentation(); instrumentation->UpdateMethodsCode(method, instrumentation->GetCodeForInvoke(method)); } // Ignore virtual methods on the iterator. @@ -9779,14 +9766,6 @@ const void* ClassLinker::GetRuntimeQuickGenericJniStub() const { return GetQuickGenericJniStub(); } -void ClassLinker::SetEntryPointsToInterpreter(ArtMethod* method) const { - if (!method->IsNative()) { - method->SetEntryPointFromQuickCompiledCode(GetQuickToInterpreterBridge()); - } else { - method->SetEntryPointFromQuickCompiledCode(GetQuickGenericJniStub()); - } -} - void ClassLinker::SetEntryPointsForObsoleteMethod(ArtMethod* method) const { DCHECK(method->IsObsolete()); // We cannot mess with the entrypoints of native methods because they are used to determine how |