Build oat compiler on host, wire in JniCompiler to CompileMethod
Change-Id: I9531eea8e216e9835856bfee5aa9d934d9f64126
diff --git a/build/Android.common.mk b/build/Android.common.mk
index 0011280..8137d81 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -43,6 +43,18 @@
src/calling_convention.cc \
src/class_linker.cc \
src/compiler.cc \
+ src/compiler/Dataflow.cc \
+ src/compiler/Frontend.cc \
+ src/compiler/IntermediateRep.cc \
+ src/compiler/Ralloc.cc \
+ src/compiler/SSATransformation.cc \
+ src/compiler/Utility.cc \
+ src/compiler/codegen/RallocUtil.cc \
+ src/compiler/codegen/arm/ArchUtility.cc \
+ src/compiler/codegen/arm/ArmRallocUtil.cc \
+ src/compiler/codegen/arm/Assemble.cc \
+ src/compiler/codegen/arm/LocalOptimizations.cc \
+ src/compiler/codegen/arm/armv7-a/Codegen.cc \
src/dex_cache.cc \
src/dex_file.cc \
src/dex_instruction.cc \
@@ -77,18 +89,6 @@
LIBART_TARGET_SRC_FILES := \
$(LIBART_COMMON_SRC_FILES) \
- src/compiler/Utility.cc \
- src/compiler/SSATransformation.cc \
- src/compiler/Dataflow.cc \
- src/compiler/IntermediateRep.cc \
- src/compiler/Ralloc.cc \
- src/compiler/Frontend.cc \
- src/compiler/codegen/RallocUtil.cc \
- src/compiler/codegen/arm/Assemble.cc \
- src/compiler/codegen/arm/ArchUtility.cc \
- src/compiler/codegen/arm/LocalOptimizations.cc \
- src/compiler/codegen/arm/ArmRallocUtil.cc \
- src/compiler/codegen/arm/armv7-a/Codegen.cc \
src/assembler_arm.cc \
src/calling_convention_arm.cc \
src/jni_internal_arm.cc \
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()) {