Fix quick fly2iceland after rebase.
Change-Id: I844f005782b3ecdcb52dc2484d44f4ae34e1c670
diff --git a/src/compiler/Compiler.h b/src/compiler/Compiler.h
index 4a7683b..8bda3fe 100644
--- a/src/compiler/Compiler.h
+++ b/src/compiler/Compiler.h
@@ -180,19 +180,15 @@
#if defined(ART_USE_QUICK_COMPILER)
class QuickCompiler {
public:
- QuickCompiler(art::Compiler* compiler);
+ QuickCompiler();
~QuickCompiler();
- const art::Compiler* GetCompiler() const {
- return compiler_;
- }
-
llvm::LLVMContext* GetLLVMContext() {
return llvm_context_.get();
}
llvm::Module* GetLLVMModule() {
- return llvm_module_.get();
+ return llvm_module_;
}
art::greenland::IntrinsicHelper* GetIntrinsicHelper() {
@@ -204,9 +200,8 @@
}
private:
- const art::Compiler* const compiler_;
UniquePtr<llvm::LLVMContext> llvm_context_;
- UniquePtr<llvm::Module> llvm_module_;
+ llvm::Module* llvm_module_; // Managed by context_
UniquePtr<art::greenland::IntrinsicHelper> intrinsic_helper_;
UniquePtr<art::greenland::IRBuilder> ir_builder_;
};
diff --git a/src/compiler/CompilerIR.h b/src/compiler/CompilerIR.h
index d63b295..f7b1bc6 100644
--- a/src/compiler/CompilerIR.h
+++ b/src/compiler/CompilerIR.h
@@ -424,7 +424,6 @@
checkstats(NULL),
#if defined(ART_USE_QUICK_COMPILER)
genBitcode(false),
- gbcOnly(false),
context(NULL),
module(NULL),
func(NULL),
@@ -597,7 +596,7 @@
Checkstats* checkstats;
#if defined(ART_USE_QUICK_COMPILER)
bool genBitcode;
- bool gbcOnly;
+ QuickCompiler* quick_compiler;
llvm::LLVMContext* context;
llvm::Module* module;
llvm::Function* func;
diff --git a/src/compiler/Frontend.cc b/src/compiler/Frontend.cc
index 3862471..ca6ccca 100644
--- a/src/compiler/Frontend.cc
+++ b/src/compiler/Frontend.cc
@@ -24,14 +24,11 @@
namespace art {
#if defined(ART_USE_QUICK_COMPILER)
-QuickCompiler::QuickCompiler(art::Compiler* compiler)
- : compiler_(compiler) {
+QuickCompiler::QuickCompiler() {
// Create context, module, intrinsic helper & ir builder
llvm_context_.reset(new llvm::LLVMContext());
- llvm_module_.reset(new llvm::Module("art", *llvm_context_));
+ llvm_module_ = new llvm::Module("art", *llvm_context_);
llvm::StructType::create(*llvm_context_, "JavaObject");
- llvm::StructType::create(*llvm_context_, "Method");
- llvm::StructType::create(*llvm_context_, "Thread");
intrinsic_helper_.reset( new greenland::IntrinsicHelper(*llvm_context_, *llvm_module_));
ir_builder_.reset(new greenland::IRBuilder(*llvm_context_, *llvm_module_, *intrinsic_helper_));
}
@@ -41,7 +38,7 @@
extern "C" void ArtInitQuickCompilerContext(art::Compiler& compiler) {
CHECK(compiler.GetCompilerContext() == NULL);
- QuickCompiler* quickCompiler = new QuickCompiler(&compiler);
+ QuickCompiler* quickCompiler = new QuickCompiler();
compiler.SetCompilerContext(quickCompiler);
}
@@ -779,10 +776,7 @@
uint32_t method_idx, jobject class_loader,
const DexFile& dex_file
#if defined(ART_USE_QUICK_COMPILER)
- , llvm::Module* module,
- llvm::LLVMContext* context,
- greenland::IntrinsicHelper* intrinsic_helper,
- greenland::IRBuilder* irb,
+ , QuickCompiler* quick_compiler,
bool gbcOnly
#endif
)
@@ -817,11 +811,14 @@
DCHECK((cUnit->instructionSet == kThumb2) ||
(cUnit->instructionSet == kX86) ||
(cUnit->instructionSet == kMips));
- cUnit->module = module;
- cUnit->context = context;
- cUnit->intrinsic_helper = intrinsic_helper;
- cUnit->irb = irb;
- cUnit->gbcOnly = gbcOnly;
+ if (gbcOnly) {
+ cUnit->quick_compiler = quick_compiler;
+ } else {
+ // TODO: We need one LLVMContext per thread.
+ cUnit->quick_compiler =
+ reinterpret_cast<QuickCompiler*>(compiler.GetCompilerContext());
+ }
+ DCHECK(cUnit->quick_compiler != NULL);
if (cUnit->instructionSet == kThumb2) {
// TODO: remove this once x86 is tested
cUnit->genBitcode = true;
@@ -1142,7 +1139,7 @@
if (cUnit->genBitcode) {
// MIR->Bitcode
oatMethodMIR2Bitcode(cUnit.get());
- if (cUnit->gbcOnly) {
+ if (gbcOnly) {
// all done
oatArenaReset(cUnit.get());
return NULL;
@@ -1245,7 +1242,7 @@
const DexFile& dex_file)
{
return compileMethod(compiler, code_item, access_flags, invoke_type, method_idx, class_loader,
- dex_file, NULL, NULL, NULL, NULL, false);
+ dex_file, NULL, false);
}
/*
@@ -1257,13 +1254,10 @@
uint32_t access_flags, InvokeType invoke_type,
uint32_t method_idx, jobject class_loader,
const DexFile& dex_file,
- llvm::Module* module,
- llvm::LLVMContext* context,
- greenland::IntrinsicHelper* intrinsic_helper,
- greenland::IRBuilder* irb)
+ QuickCompiler* quick_compiler)
{
compileMethod(compiler, code_item, access_flags, invoke_type, method_idx, class_loader,
- dex_file, module, context, intrinsic_helper, irb, true);
+ dex_file, quick_compiler, true);
}
#else
CompiledMethod* oatCompileMethod(Compiler& compiler,
diff --git a/src/compiler/codegen/MethodBitcode.cc b/src/compiler/codegen/MethodBitcode.cc
index 9427dcc..c176c4e 100644
--- a/src/compiler/codegen/MethodBitcode.cc
+++ b/src/compiler/codegen/MethodBitcode.cc
@@ -170,8 +170,7 @@
}
void initIR(CompilationUnit* cUnit)
{
- QuickCompiler* quick =
- reinterpret_cast<QuickCompiler*>(cUnit->compiler->GetCompilerContext());
+ QuickCompiler* quick = cUnit->quick_compiler;
cUnit->context = quick->GetLLVMContext();
cUnit->module = quick->GetLLVMModule();
cUnit->intrinsic_helper = quick->GetIntrinsicHelper();