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
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index ee13e03..1f4cf8f 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1601,20 +1601,21 @@
                        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<ClassLinker*>(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 @@
   }
 
   // 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 55332f8..132da67 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -476,6 +476,9 @@
       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_);