From 474e99956e8be96e84404b5be6ad075bb5cb6b79 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Wed, 12 Feb 2025 10:25:46 +0000 Subject: Refactor `ArtMethod` entrypoint initialization. Introduce `Instrumentation::ReinitializeMethodsCode()` for the cases where we want to reset the entrypoint after the method has already been initialized. Keep the old function `Instrumentation::InitializeMethodsCode()` exclusively for the initialization of a newly loaded method's entrypoint, split out the work that can be done in suspended state and remove any unnecessary work. For example, we do not use the Nterp entrypoint until the class has been verified, so all the Nterp checks can be removed. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 329196666 Change-Id: I1d0c195b0118fe50434d496f56346a9f744fbaf7 --- compiler/common_compiler_test.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'compiler/common_compiler_test.cc') diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc index f24406e599..26800637fa 100644 --- a/compiler/common_compiler_test.cc +++ b/compiler/common_compiler_test.cc @@ -32,6 +32,7 @@ #include "driver/compiled_code_storage.h" #include "driver/compiler_options.h" #include "jni/java_vm_ext.h" +#include "instrumentation-inl.h" #include "interpreter/interpreter.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" @@ -306,7 +307,11 @@ void CommonCompilerTestImpl::CompileMethod(ArtMethod* method) { storage.GetStackMap(), storage.GetInstructionSet()); LOG(INFO) << "MakeExecutable " << method->PrettyMethod() << " code=" << method_code; - GetRuntime()->GetInstrumentation()->InitializeMethodsCode(method, /*aot_code=*/ method_code); + instrumentation::Instrumentation* instr = GetRuntime()->GetInstrumentation(); + const void* entrypoint = instr->GetInitialEntrypoint(method->GetAccessFlags(), method_code); + CHECK(!instr->IsForcedInterpretOnly()); + CHECK(!instr->EntryExitStubsInstalled()); + instr->UpdateMethodsCode(method, entrypoint); } } -- cgit v1.2.3-59-g8ed1b