From a89d7ed6f091ac495cd43560ece6988776d14d61 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Fri, 5 Dec 2014 10:57:13 -0800 Subject: [PATCH] Add pointer size logic to InitFromImageInterpretOnly Previously we didn't have this logic which broke dex2oat if passed --runtime-option -Xint flag. Also we now no longer call InitFromImageInterpretOnlyCallback if we are the compiler. Bug: 18631640 Change-Id: Ie84fceeb85cabeeec7a5fedefd73dd919cca8e5e --- runtime/class_linker.cc | 16 +++++++++------- runtime/class_linker.h | 3 +++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index ee13e0389..1f4cf8fcf 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -1601,20 +1601,21 @@ const OatFile* ClassLinker::FindOatFileFromOatLocation(const std::string& oat_lo error_msg); } -static void InitFromImageInterpretOnlyCallback(mirror::Object* obj, void* arg) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void ClassLinker::InitFromImageInterpretOnlyCallback(mirror::Object* obj, void* arg) { ClassLinker* class_linker = reinterpret_cast(arg); - DCHECK(obj != nullptr); DCHECK(class_linker != nullptr); + size_t pointer_size = class_linker->image_pointer_size_; if (obj->IsArtMethod()) { mirror::ArtMethod* method = obj->AsArtMethod(); if (!method->IsNative()) { - method->SetEntryPointFromInterpreter(artInterpreterToInterpreterBridge); + method->SetEntryPointFromInterpreterPtrSize(artInterpreterToInterpreterBridge, pointer_size); if (method != Runtime::Current()->GetResolutionMethod()) { - method->SetEntryPointFromQuickCompiledCode(GetQuickToInterpreterBridge()); - method->SetEntryPointFromPortableCompiledCode(GetPortableToInterpreterBridge()); + method->SetEntryPointFromQuickCompiledCodePtrSize(GetQuickToInterpreterBridge(), + pointer_size); + method->SetEntryPointFromPortableCompiledCodePtrSize(GetPortableToInterpreterBridge(), + pointer_size); } } } @@ -1697,7 +1698,8 @@ void ClassLinker::InitFromImage() { } // Set entry point to interpreter if in InterpretOnly mode. - if (Runtime::Current()->GetInstrumentation()->InterpretOnly()) { + Runtime* runtime = Runtime::Current(); + if (!runtime->IsCompiler() && runtime->GetInstrumentation()->InterpretOnly()) { ReaderMutexLock mu(self, *Locks::heap_bitmap_lock_); heap->VisitObjects(InitFromImageInterpretOnlyCallback, this); } diff --git a/runtime/class_linker.h b/runtime/class_linker.h index 55332f808..132da675c 100644 --- a/runtime/class_linker.h +++ b/runtime/class_linker.h @@ -476,6 +476,9 @@ class ClassLinker { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); private: + static void InitFromImageInterpretOnlyCallback(mirror::Object* obj, void* arg) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + const OatFile::OatMethod FindOatMethodFor(mirror::ArtMethod* method, bool* found) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); -- 2.11.0