Generic JNI implementation for x86_64

Starting implementation for generic JNI on x86_64. Frames are of
large static size (>4K) right now, should be compacted later. Passes
the whole of jni_compiler_test.

Change-Id: I88ac3e13a534afe7568d62a1ef97cb766e8260e4
diff --git a/compiler/common_compiler_test.h b/compiler/common_compiler_test.h
index 3bdc95e..bca72b8 100644
--- a/compiler/common_compiler_test.h
+++ b/compiler/common_compiler_test.h
@@ -204,19 +204,31 @@
     } else {
       // No code? You must mean to go into the interpreter.
       // Or the generic JNI...
-      const void* method_code = method->IsNative() ? GetQuickGenericJniTrampoline()
-                                                   : (kUsePortableCompiler
-                                                        ? GetPortableToInterpreterBridge()
-                                                        : GetQuickToInterpreterBridge());
-      OatFile::OatMethod oat_method = CreateOatMethod(method_code,
-                                                      kStackAlignment,
-                                                      0,
-                                                      0,
-                                                      nullptr,
-                                                      nullptr,
-                                                      nullptr);
-      oat_method.LinkMethod(method);
-      method->SetEntryPointFromInterpreter(interpreter::artInterpreterToInterpreterBridge);
+      if (!method->IsNative()) {
+        const void* method_code = kUsePortableCompiler ? GetPortableToInterpreterBridge()
+                                                       : GetQuickToInterpreterBridge();
+        OatFile::OatMethod oat_method = CreateOatMethod(method_code,
+                                                        kStackAlignment,
+                                                        0,
+                                                        0,
+                                                        nullptr,
+                                                        nullptr,
+                                                        nullptr);
+        oat_method.LinkMethod(method);
+        method->SetEntryPointFromInterpreter(interpreter::artInterpreterToInterpreterBridge);
+      } else {
+        const void* method_code = GetQuickGenericJniTrampoline();
+        mirror::ArtMethod* callee_save_method = runtime_->GetCalleeSaveMethod(Runtime::kRefsAndArgs);
+        OatFile::OatMethod oat_method = CreateOatMethod(method_code,
+                                                        callee_save_method->GetFrameSizeInBytes(),
+                                                        callee_save_method->GetCoreSpillMask(),
+                                                        callee_save_method->GetFpSpillMask(),
+                                                        nullptr,
+                                                        nullptr,
+                                                        nullptr);
+        oat_method.LinkMethod(method);
+        method->SetEntryPointFromInterpreter(artInterpreterToCompiledCodeBridge);
+      }
     }
     // Create bridges to transition between different kinds of compiled bridge.
     if (method->GetEntryPointFromPortableCompiledCode() == nullptr) {