diff options
Diffstat (limited to 'runtime/art_method.cc')
-rw-r--r-- | runtime/art_method.cc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/runtime/art_method.cc b/runtime/art_method.cc index 2db2faa408..3c70a92612 100644 --- a/runtime/art_method.cc +++ b/runtime/art_method.cc @@ -20,13 +20,14 @@ #include <cstddef> #include "android-base/stringprintf.h" - #include "arch/context.h" #include "art_method-inl.h" #include "base/enums.h" #include "base/stl_util.h" #include "class_linker-inl.h" #include "class_root-inl.h" +#include "code_simulator.h" +#include "code_simulator_container.h" #include "debugger.h" #include "dex/class_accessor-inl.h" #include "dex/descriptors_names.h" @@ -101,6 +102,11 @@ ArtMethod* ArtMethod::GetSingleImplementation(PointerSize pointer_size) { return reinterpret_cast<ArtMethod*>(GetDataPtrSize(pointer_size)); } +bool ArtMethod::CanBeSimulated() REQUIRES_SHARED(Locks::mutator_lock_) { + CodeSimulatorContainer* simulator = Thread::Current()->GetSimulator(); + return simulator->Get()->CanSimulate(this); +} + ArtMethod* ArtMethod::FromReflectedMethod(const ScopedObjectAccessAlreadyRunnable& soa, jobject jlr_method) { ObjPtr<mirror::Executable> executable = soa.Decode<mirror::Executable>(jlr_method); @@ -355,7 +361,9 @@ void ArtMethod::Invoke(Thread* self, uint32_t* args, uint32_t args_size, JValue* } // Ensure that we won't be accidentally calling quick compiled code when -Xint. - if (kIsDebugBuild && runtime->GetInstrumentation()->IsForcedInterpretOnly()) { + if (kIsDebugBuild && + runtime->GetInstrumentation()->IsForcedInterpretOnly() && + !Runtime::SimulatorMode()) { CHECK(!runtime->UseJitCompilation()); const void* oat_quick_code = (IsNative() || !IsInvokable() || IsProxyMethod() || IsObsolete()) @@ -365,7 +373,10 @@ void ArtMethod::Invoke(Thread* self, uint32_t* args, uint32_t args_size, JValue* << "Don't call compiled code when -Xint " << PrettyMethod(); } - if (!IsStatic()) { + if (Runtime::SimulatorMode() && CanBeSimulated()) { + CodeSimulatorContainer* simulator = Thread::Current()->GetSimulator(); + simulator->Get()->Invoke(this, args, args_size, self, result, shorty, IsStatic()); + } else if (!IsStatic()) { (*art_quick_invoke_stub)(this, args, args_size, self, result, shorty); } else { (*art_quick_invoke_static_stub)(this, args, args_size, self, result, shorty); @@ -570,6 +581,10 @@ const OatQuickMethodHeader* ArtMethod::GetOatQuickMethodHeader(uintptr_t pc) { return nullptr; } + if (Runtime::SimulatorMode()) { + return nullptr; + } + Runtime* runtime = Runtime::Current(); const void* existing_entry_point = GetEntryPointFromQuickCompiledCode(); CHECK(existing_entry_point != nullptr) << PrettyMethod() << "@" << this; |