Build oat compiler on host, wire in JniCompiler to CompileMethod

Change-Id: I9531eea8e216e9835856bfee5aa9d934d9f64126
diff --git a/src/compiler.cc b/src/compiler.cc
index 8f529ce..a623d20 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -2,13 +2,16 @@
 
 #include "compiler.h"
 
+#include "assembler.h"
 #include "class_linker.h"
 #include "dex_cache.h"
+#include "jni_compiler.h"
 
 extern bool oatCompileMethod(art::Method*, art::InstructionSet);
 
 namespace art {
 
+// TODO need to specify target
 void Compiler::Compile(std::vector<const DexFile*> class_path) {
   ClassLoader* class_loader = PathClassLoader::Alloc(class_path);
   Resolve(class_loader);
@@ -74,10 +77,20 @@
 }
 
 void Compiler::CompileMethod(Method* method) {
-// TODO need to compile art/src/compiler for host as well as target
-#ifdef __arm__
-  oatCompileMethod(method, kThumb2);
-#endif
+  // TODO remove this as various compilers come on line
+  if (true) {
+    return;
+  }
+  if (method->IsNative()) {
+    Assembler jni_asm;
+    JniCompiler jni_compiler;
+    jni_compiler.Compile(&jni_asm, method);
+  } else if (method->IsAbstract()) {
+    // TODO setup precanned code to throw something like AbstractMethodError
+  } else {
+    oatCompileMethod(method, kThumb2);
+  }
+  CHECK(method->HasCode());
 }
 
 }  // namespace art
diff --git a/src/jni_internal.cc b/src/jni_internal.cc
index 00976c1..6cbf153 100644
--- a/src/jni_internal.cc
+++ b/src/jni_internal.cc
@@ -264,11 +264,9 @@
   const Method::InvokeStub* stub = method->GetInvokeStub();
   CHECK(stub != NULL);
 
-#ifdef __arm__
   // Compile...
   // TODO: not here!
   oatCompileMethod(method, kThumb2);
-#endif
 
   JValue result;
   if (method->HasCode()) {