Run the inlining pass even in AOT mode.
llvm-svn: 200856
diff --git a/vmkit/include/j3/j3object.h b/vmkit/include/j3/j3object.h
index 581d838..8c6b713 100644
--- a/vmkit/include/j3/j3object.h
+++ b/vmkit/include/j3/j3object.h
@@ -80,9 +80,9 @@
uint32_t offset() { return checker.offset; }
bool isPrimaryChecker() { return checker.offset < J3TypeChecker::cacheOffset; }
- bool slowIsAssignableTo(J3VirtualTable* parent) __attribute__((always_inline));
- bool fastIsAssignableToPrimaryChecker(J3VirtualTable* parent, uint32_t parentOffset);
- bool fastIsAssignableToNonPrimaryChecker(J3VirtualTable* parent);
+ bool slowIsAssignableTo(J3VirtualTable* parent) __attribute__((noinline));
+ bool fastIsAssignableToPrimaryChecker(J3VirtualTable* parent, uint32_t parentOffset) __attribute__((always_inline));
+ bool fastIsAssignableToNonPrimaryChecker(J3VirtualTable* parent) __attribute__((noinline));
bool isAssignableTo(J3VirtualTable* parent);
J3Type* type() const { return _type; }
diff --git a/vmkit/include/vmkit/compiler.h b/vmkit/include/vmkit/compiler.h
index c82f782..e1d0c95 100644
--- a/vmkit/include/vmkit/compiler.h
+++ b/vmkit/include/vmkit/compiler.h
@@ -73,6 +73,7 @@
BumpAllocator* allocator() { return _allocator; }
llvm::ExecutionEngine* ee() { return _ee; }
+ void prepareModule(llvm::Module* module);
void compileModule(llvm::Module* module);
};
}
diff --git a/vmkit/lib/j3/vm/j3codegen.cc b/vmkit/lib/j3/vm/j3codegen.cc
index b759d29..1494e84 100644
--- a/vmkit/lib/j3/vm/j3codegen.cc
+++ b/vmkit/lib/j3/vm/j3codegen.cc
@@ -118,6 +118,8 @@
llvmFunction->dump();
}
+ loader->prepareModule(module);
+
uint32_t needsCaller = withCaller() && !signature->caller(access);
if(needsCaller)
diff --git a/vmkit/lib/j3/vm/j3codegenexception.cc b/vmkit/lib/j3/vm/j3codegenexception.cc
index ad369c2..c16bdaa 100644
--- a/vmkit/lib/j3/vm/j3codegenexception.cc
+++ b/vmkit/lib/j3/vm/j3codegenexception.cc
@@ -51,9 +51,9 @@
if(curCheck) { /* = 0 if I already have a finally */
codeGen->builder.SetInsertPoint(curCheck);
- curCheck = codeGen->newBB("next-exception-check");
if(entry->catchType) {
+ curCheck = codeGen->newBB("next-exception-check");
codeGen->stack.metaStack[0] = codeGen->vm->typeJ3ObjectPtr;
codeGen->stack.topStack = 1;
llvm::CallInst* is = codeGen->isAssignableTo(codeGen->stack.top(0),
diff --git a/vmkit/lib/j3/vm/j3method.cc b/vmkit/lib/j3/vm/j3method.cc
index b4508db..cfc4de2 100644
--- a/vmkit/lib/j3/vm/j3method.cc
+++ b/vmkit/lib/j3/vm/j3method.cc
@@ -52,7 +52,7 @@
}
uint64_t J3Method::inlineWeight() {
- if(1 && J3Thread::get()->vm()->options()->enableInlining)
+ if(J3Thread::get()->vm()->options()->enableInlining)
return vmkit::Symbol::inlineWeight();
else
return (uint64_t)-1;
diff --git a/vmkit/lib/mmtk/magic/lower-java-runtime.cc b/vmkit/lib/mmtk/magic/lower-java-runtime.cc
index 5d0ccbc..cf11e07 100644
--- a/vmkit/lib/mmtk/magic/lower-java-runtime.cc
+++ b/vmkit/lib/mmtk/magic/lower-java-runtime.cc
@@ -39,14 +39,14 @@
for(llvm::Module::global_iterator it = module.global_begin(); it!=module.global_end(); it++) {
llvm::GlobalValue* gv = it;
- fprintf(stderr, "Global: %s\n", gv->getName().data());
+ //fprintf(stderr, "Global: %s\n", gv->getName().data());
}
for(llvm::Module::iterator it = module.begin(); it!=module.end(); it++) {
llvm::Function* function = it;
- if(!strncmp(function->getName().data(), "j3_java", 7))
- fprintf(stderr, "processing %s\n", function->getName().data());
+ //if(!strncmp(function->getName().data(), "j3_java", 7))
+ //fprintf(stderr, "processing %s\n", function->getName().data());
}
return Changed;
diff --git a/vmkit/lib/vmkit/compiler.cc b/vmkit/lib/vmkit/compiler.cc
index bc2f843..88dd810 100644
--- a/vmkit/lib/vmkit/compiler.cc
+++ b/vmkit/lib/vmkit/compiler.cc
@@ -88,9 +88,10 @@
if(runInlinePass || onlyAlwaysInline)
pm->add(vmkit::createFunctionInlinerPass(this, onlyAlwaysInline));
+
+#if 0
pm->add(llvm::createCFGSimplificationPass()); // Clean up disgusting code
-#if 1
pm->add(llvm::createPromoteMemoryToRegisterPass());// Kill useless allocas
pm->add(llvm::createInstructionCombiningPass()); // Cleanup for scalarrepl.
pm->add(llvm::createScalarReplAggregatesPass()); // Break up aggregate allocas
@@ -170,8 +171,11 @@
return (uint64_t)(uintptr_t)getSymbol(System::mcjitSymbol(Name.c_str()))->getSymbolAddress();
}
-void CompilationUnit::compileModule(llvm::Module* module) {
+void CompilationUnit::prepareModule(llvm::Module* module) {
pm->run(*module);
+}
+
+void CompilationUnit::compileModule(llvm::Module* module) {
ee()->addModule(module);
ee()->finalizeObject();