[vmkit-commits] [vmkit] r68311 - /vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Thu Apr 2 07:30:55 PDT 2009
Author: geoffray
Date: Thu Apr 2 09:30:55 2009
New Revision: 68311
URL: http://llvm.org/viewvc/llvm-project?rev=68311&view=rev
Log:
Fix call of main function.
Modified:
vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp?rev=68311&r1=68310&r2=68311&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp Thu Apr 2 09:30:55 2009
@@ -1579,9 +1579,6 @@
M->CreateStaticInitializer();
- // Print stats before quitting.
- M->printStats();
-
} catch(std::string str) {
fprintf(stderr, "Error : %s\n", str.c_str());
}
@@ -1643,11 +1640,22 @@
Function* MainFunc = Function::Create(FuncTy, GlobalValue::ExternalLinkage,
"main", TheModule);
BasicBlock* currentBlock = BasicBlock::Create("enter", MainFunc);
-
+
+ GlobalVariable* GvarArrayStr = new GlobalVariable(
+ ArrayType::get(Type::Int8Ty, strlen(name) + 1), true,
+ GlobalValue::InternalLinkage, 0, "mainClass", TheModule);
+
+
+ Constant* NameArray = ConstantArray::get(name, true);
+ GvarArrayStr->setInitializer(NameArray);
+ Value* Indices[2] = { JavaIntrinsics.constantZero,
+ JavaIntrinsics.constantZero };
+ Value* ArgName = ConstantExpr::getGetElementPtr(GvarArrayStr, Indices, 2);
+
Function::arg_iterator FuncVals = MainFunc->arg_begin();
Value* Argc = FuncVals++;
Value* Argv = FuncVals++;
- Value* Args[3] = { Argc, Argv, ConstantArray::get(name, true) };
+ Value* Args[3] = { Argc, Argv, ArgName };
FuncArgs.push_back(Args[2]->getType());
@@ -1655,7 +1663,8 @@
Function* CalledFunc =
Function::Create(FuncTy, GlobalValue::ExternalLinkage,
- jit ? "StartWithJIT" : "StartWithoutJIT", TheModule);
+ jit ? "StartJnjvmWithJIT" : "StartJnjvmWithoutJIT",
+ TheModule);
Value* res = CallInst::Create(CalledFunc, Args, Args + 3, "", currentBlock);
ReturnInst::Create(res, currentBlock);
More information about the vmkit-commits
mailing list