Support for cross compilation.
Refactor architecture specific files into arm and x86 name spaces. Make
assemblers and calling conventions use the factory pattern and an
instruction set specifier.
Change-Id: I20cd7aecacc1ae3d418221d98bbe1d69be9162a7
diff --git a/src/common_test.h b/src/common_test.h
index 98d9127..1f3f063 100644
--- a/src/common_test.h
+++ b/src/common_test.h
@@ -10,6 +10,7 @@
#include "class_linker.h"
#include "class_loader.h"
#include "compiler.h"
+#include "constants.h"
#include "dex_file.h"
#include "gtest/gtest.h"
#include "heap.h"
@@ -108,6 +109,14 @@
runtime_->Start();
class_linker_ = runtime_->GetClassLinker();
+#if defined(__i386__)
+ compiler_ = new Compiler(kX86);
+#elif defined(__arm__)
+ compiler_ = new Compiler(kThumb2);
+#else
+ compiler_ = new Compiler(kNone);
+#endif
+
Heap::VerifyHeap(); // Check for heap corruption before the test
}
@@ -148,6 +157,8 @@
IcuCleanupFn icu_cleanup_fn = reinterpret_cast<IcuCleanupFn>(sym);
(*icu_cleanup_fn)();
+ delete compiler_;
+
Heap::VerifyHeap(); // Check for heap corruption after the test
}
@@ -237,8 +248,7 @@
void CompileMethod(Method* method) {
CHECK(method != NULL);
- Compiler compiler;
- compiler.CompileOne(method);
+ compiler_->CompileOne(method);
MakeExecutable(method->GetCodeArray());
MakeExecutable(method->GetInvokeStubArray());
}
@@ -276,6 +286,7 @@
std::vector<const DexFile*> boot_class_path_;
UniquePtr<Runtime> runtime_;
ClassLinker* class_linker_;
+ Compiler* compiler_;
private:
std::vector<const DexFile*> loaded_dex_files_;