[vmkit-commits] [vmkit] r86899 - /vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Wed Nov 11 15:23:42 PST 2009
Author: geoffray
Date: Wed Nov 11 17:23:41 2009
New Revision: 86899
URL: http://llvm.org/viewvc/llvm-project?rev=86899&view=rev
Log:
No need to initialize gc roots, the GCStrategy already does it.
Modified:
vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp?rev=86899&r1=86898&r2=86899&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp Wed Nov 11 17:23:41 2009
@@ -369,12 +369,13 @@
Instruction* temp = new AllocaInst(module->JavaObjectType, "",
func->begin()->begin());
- Value* GCArgs[2] = {
- new BitCastInst(temp, module->ptrPtrType, "", currentBlock),
- module->constantPtrNull
- };
if (TheCompiler->useCooperativeGC()) {
+ Value* GCArgs[2] = {
+ new BitCastInst(temp, module->ptrPtrType, "", currentBlock),
+ module->constantPtrNull
+ };
+
CallInst::Create(module->llvm_gc_gcroot, GCArgs, GCArgs + 2, "",
temp);
}
@@ -396,17 +397,20 @@
if (returnType == module->JavaObjectType) {
ResultObject = new AllocaInst(module->JavaObjectType, "",
func->begin()->begin());
- Value* GCArgs[2] = {
- new BitCastInst(ResultObject, module->ptrPtrType, "", currentBlock),
- module->constantPtrNull
- };
-
+
if (TheCompiler->useCooperativeGC()) {
+
+ Value* GCArgs[2] = {
+ new BitCastInst(ResultObject, module->ptrPtrType, "", currentBlock),
+ module->constantPtrNull
+ };
+
CallInst::Create(module->llvm_gc_gcroot, GCArgs, GCArgs + 2, "",
currentBlock);
+ } else {
+ new StoreInst(module->JavaObjectNullConstant, ResultObject, "",
+ currentBlock);
}
- new StoreInst(module->JavaObjectNullConstant, ResultObject, "",
- currentBlock);
}
Value* nativeFunc = TheCompiler->getNativeFunction(compilingMethod,
@@ -802,12 +806,14 @@
new StoreInst(Constant::getNullValue(Type::getFloatTy(*llvmContext)), floatLocals.back(), false, firstInstruction);
objectLocals.push_back(new AllocaInst(module->JavaObjectType, "",
firstInstruction));
- new StoreInst(Constant::getNullValue(module->JavaObjectType), objectLocals.back(), false, firstInstruction);
+
+ // The GCStrategy will already initialize the value.
+ if (!TheCompiler->useCooperativeGC())
+ new StoreInst(Constant::getNullValue(module->JavaObjectType), objectLocals.back(), false, firstInstruction);
}
for (int i = 0; i < maxStack; i++) {
objectStack.push_back(new AllocaInst(module->JavaObjectType, "",
firstInstruction));
- new StoreInst(Constant::getNullValue(module->JavaObjectType), objectStack.back(), false, firstInstruction);
intStack.push_back(new AllocaInst(Type::getInt32Ty(getGlobalContext()), "", firstInstruction));
doubleStack.push_back(new AllocaInst(Type::getDoubleTy(getGlobalContext()), "",
firstInstruction));
@@ -827,13 +833,14 @@
new StoreInst(Constant::getNullValue(Type::getFloatTy(*llvmContext)), floatLocals.back(), false, firstBB);
objectLocals.push_back(new AllocaInst(module->JavaObjectType, "",
firstBB));
- new StoreInst(Constant::getNullValue(module->JavaObjectType), objectLocals.back(), false, firstBB);
+ // The GCStrategy will already initialize the value.
+ if (!TheCompiler->useCooperativeGC())
+ new StoreInst(Constant::getNullValue(module->JavaObjectType), objectLocals.back(), false, firstBB);
}
for (int i = 0; i < maxStack; i++) {
objectStack.push_back(new AllocaInst(module->JavaObjectType, "",
firstBB));
- new StoreInst(Constant::getNullValue(module->JavaObjectType), objectStack.back(), false, firstBB);
intStack.push_back(new AllocaInst(Type::getInt32Ty(getGlobalContext()), "", firstBB));
doubleStack.push_back(new AllocaInst(Type::getDoubleTy(getGlobalContext()), "", firstBB));
longStack.push_back(new AllocaInst(Type::getInt64Ty(getGlobalContext()), "", firstBB));
@@ -986,13 +993,14 @@
new StoreInst(Constant::getNullValue(Type::getFloatTy(*llvmContext)), floatLocals.back(), false, currentBlock);
objectLocals.push_back(new AllocaInst(module->JavaObjectType, "",
currentBlock));
- new StoreInst(Constant::getNullValue(module->JavaObjectType), objectLocals.back(), false, currentBlock);
+ // The GCStrategy will already initialize the value.
+ if (!TheCompiler->useCooperativeGC())
+ new StoreInst(Constant::getNullValue(module->JavaObjectType), objectLocals.back(), false, currentBlock);
}
for (int i = 0; i < maxStack; i++) {
objectStack.push_back(new AllocaInst(module->JavaObjectType, "",
currentBlock));
- new StoreInst(Constant::getNullValue(module->JavaObjectType), objectStack.back(), false, currentBlock);
intStack.push_back(new AllocaInst(Type::getInt32Ty(getGlobalContext()), "", currentBlock));
doubleStack.push_back(new AllocaInst(Type::getDoubleTy(getGlobalContext()), "", currentBlock));
longStack.push_back(new AllocaInst(Type::getInt64Ty(getGlobalContext()), "", currentBlock));
More information about the vmkit-commits
mailing list