[vmkit-commits] [vmkit] r93131 - /vmkit/trunk/lib/J3/Compiler/JITInfo.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sun Jan 10 13:15:01 PST 2010
Author: geoffray
Date: Sun Jan 10 15:15:01 2010
New Revision: 93131
URL: http://llvm.org/viewvc/llvm-project?rev=93131&view=rev
Log:
Fix for stubs that take a va_list as argument.
Modified:
vmkit/trunk/lib/J3/Compiler/JITInfo.cpp
Modified: vmkit/trunk/lib/J3/Compiler/JITInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JITInfo.cpp?rev=93131&r1=93130&r2=93131&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JITInfo.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JITInfo.cpp Sun Jan 10 15:15:01 2010
@@ -426,6 +426,7 @@
JavaLLVMCompiler* Mod =
(JavaLLVMCompiler*)signature->initialLoader->getCompiler();
+ JnjvmModule& Intrinsics = *Mod->getIntrinsics();
std::string name;
if (Mod->isStaticCompiling()) {
name += UTF8Buffer(signature->keyName).cString();
@@ -459,7 +460,29 @@
Typedef* const* arguments = signature->getArgumentsType();
for (uint32 i = 0; i < signature->nbArguments; ++i) {
LLVMAssessorInfo& LAI = JavaLLVMCompiler::getTypedefInfo(arguments[i]);
- Args.push_back(new VAArgInst(ap, LAI.llvmType, "", currentBlock));
+ Value* arg = new VAArgInst(ap, LAI.llvmType, "", currentBlock);
+ if (arguments[i]->isReference()) {
+ arg = new IntToPtrInst(arg, Intrinsics.JavaObjectType, "", currentBlock);
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ,
+ Intrinsics.JavaObjectNullConstant,
+ arg, "");
+ BasicBlock* endBlock = BasicBlock::Create(context, "end", res);
+ BasicBlock* loadBlock = BasicBlock::Create(context, "load", res);
+ PHINode* node = PHINode::Create(Intrinsics.JavaObjectType, "",
+ endBlock);
+ node->addIncoming(Intrinsics.JavaObjectNullConstant, currentBlock);
+ BranchInst::Create(endBlock, loadBlock, cmp, currentBlock);
+ currentBlock = loadBlock;
+ arg = new BitCastInst(arg,
+ PointerType::getUnqual(Intrinsics.JavaObjectType),
+ "", currentBlock);
+ arg = new LoadInst(arg, "", false, currentBlock);
+ node->addIncoming(arg, currentBlock);
+ BranchInst::Create(endBlock, currentBlock);
+ currentBlock = endBlock;
+ arg = node;
+ }
+ Args.push_back(arg);
}
#if defined(ISOLATE_SHARING)
More information about the vmkit-commits
mailing list