Merge "Test Method.getModifiers() result for proxy methods"
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index f4b507a..8885652 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -639,14 +639,17 @@
           (!orig->IsStatic() || orig->IsConstructor() || orig->GetDeclaringClass()->IsInitialized())) {
         // We have code for a non-static or initialized method, just use the code.
         copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(quick_code);
-      } else if (quick_code == nullptr && orig->IsNative() && !orig->IsStatic()) {
-        // Non-static native method missing compiled code, use generic JNI version.
+      } else if (quick_code == nullptr && orig->IsNative() &&
+          (!orig->IsStatic() || orig->GetDeclaringClass()->IsInitialized())) {
+        // Non-static or initialized native method missing compiled code, use generic JNI version.
         copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(GetOatAddress(quick_generic_jni_trampoline_offset_));
       } else if (quick_code == nullptr && !orig->IsNative()) {
         // We don't have code at all for a non-native method, use the interpreter.
         copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(GetOatAddress(quick_to_interpreter_bridge_offset_));
       } else {
-        // We have code for a static method, but need to go through the resolution stub for class initialization.
+        CHECK(!orig->GetDeclaringClass()->IsInitialized());
+        // We have code for a static method, but need to go through the resolution stub for class
+        // initialization.
         copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(GetOatAddress(quick_resolution_trampoline_offset_));
       }
       const byte* portable_code = GetOatAddress(orig->GetPortableOatCodeOffset());
diff --git a/runtime/arch/x86_64/quick_entrypoints_x86_64.S b/runtime/arch/x86_64/quick_entrypoints_x86_64.S
index 81d5f4c..ca3516e 100644
--- a/runtime/arch/x86_64/quick_entrypoints_x86_64.S
+++ b/runtime/arch/x86_64/quick_entrypoints_x86_64.S
@@ -421,7 +421,7 @@
 .Lreturn_float_quick2:
     movss %xmm0, (%r8)           // Store the floating point result.
     ret
-END_FUNCTION art_quick_invoke_stub
+END_FUNCTION art_quick_invoke_static_stub
 
 MACRO3(NO_ARG_DOWNCALL, c_name, cxx_name, return_macro)
     DEFINE_FUNCTION VAR(c_name, 0)
@@ -659,6 +659,7 @@
     movq %rsp, %rcx
     call PLT_SYMBOL(artQuickResolutionTrampoline) // (called, receiver, Thread*, SP)
     movq %rax, %r10               // Remember returned code pointer in R10.
+    movq (%rsp), %rdi             // Load called method into RDI.
     RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME
     testq %r10, %r10              // If code pointer is NULL goto deliver pending exception.
     jz 1f
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 6255c8c..b709da3 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1597,7 +1597,10 @@
   }
   const void* result = GetOatMethodFor(method).GetQuickCode();
   if (result == nullptr) {
-    if (method->IsPortableCompiled()) {
+    if (method->IsNative()) {
+      // No code and native? Use generic trampoline.
+      result = GetQuickGenericJniTrampoline();
+    } else if (method->IsPortableCompiled()) {
       // No code? Do we expect portable code?
       result = GetQuickToPortableBridge();
     } else {
@@ -1707,12 +1710,12 @@
     bool have_portable_code = false;
     if (enter_interpreter) {
       // Use interpreter entry point.
-
-      // check whether the method is native, in which case it's generic JNI
-      portable_code = GetPortableToInterpreterBridge();
+      // Check whether the method is native, in which case it's generic JNI.
       if (quick_code == nullptr && portable_code == nullptr && method->IsNative()) {
         quick_code = GetQuickGenericJniTrampoline();
+        portable_code = GetPortableToQuickBridge();
       } else {
+        portable_code = GetPortableToInterpreterBridge();
         quick_code = GetQuickToInterpreterBridge();
       }
     } else {
diff --git a/runtime/elf_file.cc b/runtime/elf_file.cc
index fe33806..4de46e3 100644
--- a/runtime/elf_file.cc
+++ b/runtime/elf_file.cc
@@ -978,7 +978,11 @@
       !check_section_name(all, 11, ".debug_str")) {
     return;
   }
-
+#ifdef __LP64__
+  if (true) {
+    return;  // No ELF debug support in 64bit.
+  }
+#endif
   // This is not needed if we have no .text segment.
   uint32_t text_start_addr = 0;
   for (uint32_t i = 0; i < segments_.size(); i++) {