[vmkit-commits] [vmkit] r96142 - in /vmkit/trunk: include/j3/ lib/J3/Compiler/ lib/J3/LLVMRuntime/ lib/J3/VMCore/ lib/Mvm/Compiler/
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sat Feb 13 17:06:48 PST 2010
Author: geoffray
Date: Sat Feb 13 19:06:47 2010
New Revision: 96142
URL: http://llvm.org/viewvc/llvm-project?rev=96142&view=rev
Log:
Add a new framework for creating stubs, that does not depend on LLVM
stub and callback system.
Modified:
vmkit/trunk/include/j3/JavaCompiler.h
vmkit/trunk/include/j3/JnjvmModule.h
vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc
vmkit/trunk/lib/J3/Compiler/JITInfo.cpp
vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp
vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
vmkit/trunk/lib/J3/Compiler/JavaJIT.h
vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
vmkit/trunk/lib/J3/Compiler/JnjvmModule.cpp
vmkit/trunk/lib/J3/Compiler/LLVMMaterializer.cpp
vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll
vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
vmkit/trunk/lib/J3/VMCore/JavaClass.h
vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp
vmkit/trunk/lib/J3/VMCore/JavaTypes.cpp
vmkit/trunk/lib/J3/VMCore/JavaTypes.h
vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
Modified: vmkit/trunk/include/j3/JavaCompiler.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/JavaCompiler.h?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/include/j3/JavaCompiler.h (original)
+++ vmkit/trunk/include/j3/JavaCompiler.h Sat Feb 13 19:06:47 2010
@@ -84,6 +84,21 @@
abort();
}
+ virtual void virtualCallStub(Signdef* sign) {
+ fprintf(stderr, "Asking for a callback in an empty compiler");
+ abort();
+ }
+
+ virtual void specialCallStub(Signdef* sign) {
+ fprintf(stderr, "Asking for a callback in an empty compiler");
+ abort();
+ }
+
+ virtual void staticCallStub(Signdef* sign) {
+ fprintf(stderr, "Asking for a callback in an empty compiler");
+ abort();
+ }
+
virtual ~JavaCompiler() {}
virtual mvm::StackScanner* createStackScanner() {
Modified: vmkit/trunk/include/j3/JnjvmModule.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/JnjvmModule.h?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/include/j3/JnjvmModule.h (original)
+++ vmkit/trunk/include/j3/JnjvmModule.h Sat Feb 13 19:06:47 2010
@@ -172,13 +172,17 @@
llvm::Function* staticBufFunction;
llvm::Function* staticAPFunction;
+ llvm::Function* staticStubFunction;
+ llvm::Function* specialStubFunction;
+ llvm::Function* virtualStubFunction;
+
Signdef* signature;
llvm::Function* createFunctionCallBuf(bool virt);
llvm::Function* createFunctionCallAP(bool virt);
+ llvm::Function* createFunctionStub(bool special, bool virt);
-
public:
const llvm::FunctionType* getVirtualType();
const llvm::FunctionType* getStaticType();
@@ -196,6 +200,10 @@
llvm::Function* getStaticBuf();
llvm::Function* getStaticAP();
+ llvm::Function* getStaticStub();
+ llvm::Function* getSpecialStub();
+ llvm::Function* getVirtualStub();
+
LLVMSignatureInfo(Signdef* sign) :
staticType(0),
virtualType(0),
@@ -209,6 +217,9 @@
virtualAPFunction(0),
staticBufFunction(0),
staticAPFunction(0),
+ staticStubFunction(0),
+ specialStubFunction(0),
+ virtualStubFunction(0),
signature(sign) {}
};
@@ -268,6 +279,11 @@
llvm::Function* ForceLoadedCheckFunction;
llvm::Function* ClassLookupFunction;
llvm::Function* StringLookupFunction;
+
+ llvm::Function* ResolveVirtualStubFunction;
+ llvm::Function* ResolveSpecialStubFunction;
+ llvm::Function* ResolveStaticStubFunction;
+
#ifndef WITHOUT_VTABLE
llvm::Function* VirtualLookupFunction;
#endif
@@ -477,7 +493,7 @@
return meth == NULL;
}
virtual llvm::Value* addCallback(Class* cl, uint16 index, Signdef* sign,
- bool stat) = 0;
+ bool stat, llvm::BasicBlock* insert) = 0;
virtual void staticCallBuf(Signdef* sign) {
getSignatureInfo(sign)->getStaticBuf();
@@ -494,6 +510,18 @@
virtual void virtualCallAP(Signdef* sign) {
getSignatureInfo(sign)->getVirtualAP();
}
+
+ virtual void virtualCallStub(Signdef* sign) {
+ getSignatureInfo(sign)->getVirtualStub();
+ }
+
+ virtual void specialCallStub(Signdef* sign) {
+ getSignatureInfo(sign)->getSpecialStub();
+ }
+
+ virtual void staticCallStub(Signdef* sign) {
+ getSignatureInfo(sign)->getStaticStub();
+ }
llvm::Function* NativeLoader;
@@ -580,7 +608,7 @@
virtual ~JavaJITCompiler() {}
virtual llvm::Value* addCallback(Class* cl, uint16 index, Signdef* sign,
- bool stat);
+ bool stat, llvm::BasicBlock* insert);
virtual uintptr_t getPointerOrStub(JavaMethod& meth, int type);
#ifdef WITH_LLVM_GCC
@@ -596,6 +624,21 @@
};
+class JavaJ3LazyJITCompiler : public JavaJITCompiler {
+public:
+ virtual bool needsCallback(JavaMethod* meth, bool* needsInit);
+ virtual llvm::Value* addCallback(Class* cl, uint16 index, Signdef* sign,
+ bool stat, llvm::BasicBlock* insert);
+ virtual uintptr_t getPointerOrStub(JavaMethod& meth, int side);
+
+ virtual JavaCompiler* Create(const std::string& ModuleID) {
+ return new JavaJ3LazyJITCompiler(ModuleID);
+ }
+
+ JavaJ3LazyJITCompiler(const std::string& ModuleID)
+ : JavaJITCompiler(ModuleID) {}
+};
+
class JavaAOTCompiler : public JavaLLVMCompiler {
public:
@@ -619,7 +662,7 @@
}
virtual llvm::Value* addCallback(Class* cl, uint16 index, Signdef* sign,
- bool stat);
+ bool stat, llvm::BasicBlock* insert);
virtual void makeVT(Class* cl);
virtual void makeIMT(Class* cl);
Modified: vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc (original)
+++ vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc Sat Feb 13 19:06:47 2010
@@ -5,10 +5,7 @@
Instruction* res = CallInst::Create(F, args.begin(), args.end(), Name,
InsertAtEnd);
- DILocation Location =
- module->DebugFactory->CreateLocation(currentLineNumber, currentCtpIndex,
- DIScope(DbgSubprogram));
- res->setMetadata("dbg", Location.getNode());
+ res->setMetadata("dbg", CreateLocation());
if (TheCompiler->hasExceptionsEnabled()) {
Value* threadId = getCurrentThread(module->JavaThreadType);
@@ -66,10 +63,7 @@
BasicBlock *InsertAtEnd) {
Instruction* res = CallInst::Create(F, arg1, Name, InsertAtEnd);
- DILocation Location =
- module->DebugFactory->CreateLocation(currentLineNumber, currentCtpIndex,
- DIScope(DbgSubprogram));
- res->setMetadata("dbg", Location.getNode());
+ res->setMetadata("dbg", CreateLocation());
if (TheCompiler->hasExceptionsEnabled()) {
Value* threadId = getCurrentThread(module->JavaThreadType);
@@ -121,10 +115,7 @@
Value* args[2] = { arg1, arg2 };
Instruction* res = CallInst::Create(F, args, args + 2, Name, InsertAtEnd);
- DILocation Location =
- module->DebugFactory->CreateLocation(currentLineNumber, currentCtpIndex,
- DIScope(DbgSubprogram));
- res->setMetadata("dbg", Location.getNode());
+ res->setMetadata("dbg", CreateLocation());
if (TheCompiler->hasExceptionsEnabled()) {
Value* threadId = getCurrentThread(module->JavaThreadType);
@@ -173,10 +164,7 @@
Instruction* JavaJIT::invoke(Value *F, const char* Name,
BasicBlock *InsertAtEnd) {
Instruction* res = llvm::CallInst::Create(F, Name, InsertAtEnd);
- DILocation Location =
- module->DebugFactory->CreateLocation(currentLineNumber, currentCtpIndex,
- DIScope(DbgSubprogram));
- res->setMetadata("dbg", Location.getNode());
+ res->setMetadata("dbg", CreateLocation());
if (TheCompiler->hasExceptionsEnabled()) {
Value* threadId = getCurrentThread(module->JavaThreadType);
@@ -224,10 +212,8 @@
void JavaJIT::throwException(llvm::Function* F, Value* arg1) {
Instruction* obj = CallInst::Create(F, arg1, "", currentBlock);
- DILocation Location =
- module->DebugFactory->CreateLocation(currentLineNumber, currentCtpIndex,
- DIScope(DbgSubprogram));
- obj->setMetadata("dbg", Location.getNode());
+ obj->setMetadata("dbg", CreateLocation());
+
if (currentExceptionBlock != endExceptionBlock) {
Instruction* insn = currentExceptionBlock->begin();
PHINode* node = dyn_cast<PHINode>(insn);
@@ -268,10 +254,8 @@
void JavaJIT::throwException(llvm::Function* F, Value** args,
uint32 nbArgs) {
Instruction* obj = CallInst::Create(F, args, args + nbArgs, "", currentBlock);
- DILocation Location =
- module->DebugFactory->CreateLocation(currentLineNumber, currentCtpIndex,
- DIScope(DbgSubprogram));
- obj->setMetadata("dbg", Location.getNode());
+ obj->setMetadata("dbg", CreateLocation());
+
if (currentExceptionBlock != endExceptionBlock) {
Instruction* insn = currentExceptionBlock->begin();
PHINode* node = dyn_cast<PHINode>(insn);
Modified: vmkit/trunk/lib/J3/Compiler/JITInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JITInfo.cpp?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JITInfo.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JITInfo.cpp Sat Feb 13 19:06:47 2010
@@ -498,6 +498,87 @@
return res;
}
+Function* LLVMSignatureInfo::createFunctionStub(bool special, bool virt) {
+
+ std::vector<Value*> Args;
+ std::vector<Value*> FunctionArgs;
+
+ JavaLLVMCompiler* Mod =
+ (JavaLLVMCompiler*)signature->initialLoader->getCompiler();
+ JnjvmModule& Intrinsics = *Mod->getIntrinsics();
+ std::string name;
+ if (Mod->isStaticCompiling()) {
+ name += UTF8Buffer(signature->keyName).cString();
+ name += virt ? "virtual_stub" : special ? "special_stub" : "static_stub";
+ } else {
+ name = "";
+ }
+
+ Function* stub = Function::Create((virt || special) ? getVirtualType() :
+ getStaticType(),
+ GlobalValue::InternalLinkage, name,
+ Mod->getLLVMModule());
+ LLVMContext& context = Mod->getLLVMModule()->getContext();
+
+ BasicBlock* currentBlock = BasicBlock::Create(context, "enter", stub);
+ BasicBlock* endBlock = BasicBlock::Create(context, "end", stub);
+ BasicBlock* callBlock = BasicBlock::Create(context, "call", stub);
+ PHINode* node = NULL;
+ if (!signature->getReturnType()->isVoid()) {
+ node = PHINode::Create(stub->getReturnType(), "", endBlock);
+ }
+
+ Function::arg_iterator arg = stub->arg_begin();
+ Value *obj = NULL;
+ if (virt) {
+ obj = arg;
+ Args.push_back(obj);
+ }
+
+ for (; arg != stub->arg_end() ; ++arg) {
+ FunctionArgs.push_back(arg);
+ if (Mod->useCooperativeGC()) {
+ if (arg->getType() == Intrinsics.JavaObjectType) {
+ Value* GCArgs[2] = {
+ new BitCastInst(arg, Intrinsics.ptrPtrType, "", currentBlock),
+ Intrinsics.constantPtrNull
+ };
+
+ CallInst::Create(Intrinsics.llvm_gc_gcroot, GCArgs, GCArgs + 2, "",
+ currentBlock);
+ }
+ }
+ }
+
+ Value* val = CallInst::Create(virt ? Intrinsics.ResolveVirtualStubFunction :
+ special ? Intrinsics.ResolveSpecialStubFunction:
+ Intrinsics.ResolveStaticStubFunction,
+ Args.begin(), Args.end(), "", currentBlock);
+
+ Constant* nullValue = Constant::getNullValue(val->getType());
+ Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ,
+ nullValue, val, "");
+ BranchInst::Create(endBlock, callBlock, cmp, currentBlock);
+ if (node) node->addIncoming(Constant::getNullValue(node->getType()),
+ currentBlock);
+
+ currentBlock = callBlock;
+ Value* Func = new BitCastInst(val, stub->getType(), "", currentBlock);
+ Value* res = CallInst::Create(Func, FunctionArgs.begin(), FunctionArgs.end(),
+ "", currentBlock);
+ if (node) node->addIncoming(res, currentBlock);
+ BranchInst::Create(endBlock, currentBlock);
+
+ currentBlock = endBlock;
+ if (node) {
+ ReturnInst::Create(context, node, currentBlock);
+ } else {
+ ReturnInst::Create(context, currentBlock);
+ }
+
+ return stub;
+}
+
const PointerType* LLVMSignatureInfo::getStaticPtrType() {
if (!staticPtrType) {
staticPtrType = PointerType::getUnqual(getStaticType());
@@ -621,6 +702,57 @@
return staticAPFunction;
}
+Function* LLVMSignatureInfo::getStaticStub() {
+ // Lock here because we are called by arbitrary code. Also put that here
+ // because we are waiting on staticStubFunction to have an address.
+ mvm::MvmModule::protectIR();
+ if (!staticStubFunction) {
+ staticStubFunction = createFunctionStub(false, false);
+ if (!signature->initialLoader->getCompiler()->isStaticCompiling()) {
+ signature->setStaticCallStub((intptr_t)
+ mvm::MvmModule::executionEngine->getPointerToGlobal(staticStubFunction));
+ // Now that it's compiled, we don't need the IR anymore
+ staticStubFunction->deleteBody();
+ }
+ }
+ mvm::MvmModule::unprotectIR();
+ return staticStubFunction;
+}
+
+Function* LLVMSignatureInfo::getSpecialStub() {
+ // Lock here because we are called by arbitrary code. Also put that here
+ // because we are waiting on specialStubFunction to have an address.
+ mvm::MvmModule::protectIR();
+ if (!specialStubFunction) {
+ specialStubFunction = createFunctionStub(true, false);
+ if (!signature->initialLoader->getCompiler()->isStaticCompiling()) {
+ signature->setSpecialCallStub((intptr_t)
+ mvm::MvmModule::executionEngine->getPointerToGlobal(specialStubFunction));
+ // Now that it's compiled, we don't need the IR anymore
+ specialStubFunction->deleteBody();
+ }
+ }
+ mvm::MvmModule::unprotectIR();
+ return specialStubFunction;
+}
+
+Function* LLVMSignatureInfo::getVirtualStub() {
+ // Lock here because we are called by arbitrary code. Also put that here
+ // because we are waiting on virtualStubFunction to have an address.
+ mvm::MvmModule::protectIR();
+ if (!virtualStubFunction) {
+ virtualStubFunction = createFunctionStub(false, true);
+ if (!signature->initialLoader->getCompiler()->isStaticCompiling()) {
+ signature->setVirtualCallStub((intptr_t)
+ mvm::MvmModule::executionEngine->getPointerToGlobal(virtualStubFunction));
+ // Now that it's compiled, we don't need the IR anymore
+ virtualStubFunction->deleteBody();
+ }
+ }
+ mvm::MvmModule::unprotectIR();
+ return virtualStubFunction;
+}
+
void LLVMAssessorInfo::initialise() {
AssessorInfo[I_VOID].llvmType = Type::getVoidTy(getGlobalContext());
AssessorInfo[I_VOID].llvmTypePtr = 0;
Modified: vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp Sat Feb 13 19:06:47 2010
@@ -1829,7 +1829,8 @@
}
Value* JavaAOTCompiler::addCallback(Class* cl, uint16 index,
- Signdef* sign, bool stat) {
+ Signdef* sign, bool stat,
+ BasicBlock* insert) {
JavaConstantPool* ctpInfo = cl->ctpInfo;
Signdef* signature = 0;
Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Sat Feb 13 19:06:47 2010
@@ -20,6 +20,7 @@
#include <llvm/Instructions.h>
#include <llvm/Module.h>
#include <llvm/Type.h>
+#include <llvm/Analysis/DebugInfo.h>
#include <llvm/Support/CFG.h>
#include "mvm/JIT.h"
@@ -161,21 +162,46 @@
Constant* Offset = LMI->getOffset();
indexes2[1] = Offset;
#ifdef ISOLATE_SHARING
- indexesCtp = ConstantInt::get(Type::getInt32Ty(getGlobalContext()),
+ indexesCtp = ConstantInt::get(Type::getInt32Ty(*llvmContext),
Offset->getZExtValue() * -1);
#endif
} else {
-
- Value* val = getConstantPoolAt(index, module->VirtualLookupFunction,
- Type::getInt32Ty(getGlobalContext()), args[0], true);
- indexes2[1] = val;
+
+ GlobalVariable* GV = new GlobalVariable(*llvmFunction->getParent(),
+ Type::getInt32Ty(*llvmContext),
+ false,
+ GlobalValue::ExternalLinkage,
+ module->constantZero, "");
+
+ BasicBlock* resolveVirtual = createBasicBlock("resolveVirtual");
+ BasicBlock* endResolveVirtual = createBasicBlock("endResolveVirtual");
+ PHINode* node = PHINode::Create(Type::getInt32Ty(*llvmContext), "",
+ endResolveVirtual);
+
+ Value* load = new LoadInst(GV, "", false, currentBlock);
+ Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, load,
+ module->constantZero, "");
+ BranchInst::Create(resolveVirtual, endResolveVirtual, test, currentBlock);
+ node->addIncoming(load, currentBlock);
+ currentBlock = resolveVirtual;
+ std::vector<Value*> Args;
+ Args.push_back(TheCompiler->getNativeClass(compilingClass));
+ Args.push_back(ConstantInt::get(Type::getInt32Ty(*llvmContext), index));
+ Args.push_back(GV);
+ Args.push_back(args[0]);
+ load = invoke(module->VirtualLookupFunction, Args, "", currentBlock);
+ node->addIncoming(load, currentBlock);
+ BranchInst::Create(endResolveVirtual, currentBlock);
+ currentBlock = endResolveVirtual;
+
+ indexes2[1] = node;
#ifdef ISOLATE_SHARING
Value* mul = BinaryOperator::CreateMul(val, module->constantMinusOne,
"", currentBlock);
indexesCtp = mul;
#endif
}
-
+
Value* FuncPtr = GetElementPtrInst::Create(VT, indexes2, indexes2 + 2, "",
currentBlock);
@@ -1624,9 +1650,9 @@
#if defined(ISOLATE_SHARING)
const Type* Ty = module->ConstantPoolType;
Constant* Nil = Constant::getNullValue(Ty);
- GlobalVariable* GV = new GlobalVariable(Ty, false,
+ GlobalVariable* GV = new GlobalVariable(*llvmFunction->getParent(),Ty, false,
GlobalValue::ExternalLinkage, Nil,
- "", module);
+ "");
Value* res = new LoadInst(GV, "", false, currentBlock);
Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, res, Nil, "");
@@ -1659,10 +1685,12 @@
UserCommonClass* cl = 0;
Value* Cl = getResolvedCommonClass(clIndex, false, &cl);
if (!cl) {
- CallInst::Create(module->ForceLoadedCheckFunction, Cl, "",currentBlock);
+ CallInst::Create(module->ForceLoadedCheckFunction, Cl, "",
+ currentBlock);
}
}
- func = TheCompiler->addCallback(compilingClass, index, signature, false);
+ func = TheCompiler->addCallback(compilingClass, index, signature, false,
+ currentBlock);
} else {
func = TheCompiler->getMethod(meth);
}
@@ -1676,7 +1704,8 @@
push(val, false, signature->getReturnType()->findAssocClass(JCL));
} else {
push(val, signature->getReturnType()->isUnsigned());
- if (retType == Type::getDoubleTy(getGlobalContext()) || retType == Type::getInt64Ty(getGlobalContext())) {
+ if (retType == Type::getDoubleTy(getGlobalContext()) ||
+ retType == Type::getInt64Ty(getGlobalContext())) {
push(module->constantZero, false);
}
}
@@ -1735,7 +1764,8 @@
Value* func = 0;
bool needsInit = false;
if (TheCompiler->needsCallback(meth, &needsInit)) {
- func = TheCompiler->addCallback(compilingClass, index, signature, true);
+ func = TheCompiler->addCallback(compilingClass, index, signature,
+ true, currentBlock);
} else {
/*if (meth == upcalls->SystemArraycopy ||
meth == upcalls->VMSystemArraycopy) {
@@ -1755,7 +1785,8 @@
push(val, false, signature->getReturnType()->findAssocClass(JCL));
} else {
push(val, signature->getReturnType()->isUnsigned());
- if (retType == Type::getDoubleTy(getGlobalContext()) || retType == Type::getInt64Ty(getGlobalContext())) {
+ if (retType == Type::getDoubleTy(getGlobalContext()) ||
+ retType == Type::getInt64Ty(getGlobalContext())) {
push(module->constantZero, false);
}
}
@@ -2543,6 +2574,14 @@
currentBlock = label_return;
}
+MDNode* JavaJIT::CreateLocation() {
+ uint32_t first = currentLineNumber | (currentBytecodeIndex << 16);
+ uint32_t second = currentCtpIndex | (callNumber << 16);
+ DILocation Location = module->DebugFactory->CreateLocation(
+ first, second, DIScope(DbgSubprogram));
+ callNumber++;
+ return Location.getNode();
+}
#ifdef DWARF_EXCEPTIONS
#include "ExceptionsDwarf.inc"
Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.h?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.h (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.h Sat Feb 13 19:06:47 2010
@@ -83,7 +83,9 @@
endNode = 0;
currentStackIndex = 0;
currentLineNumber = 0;
+ currentBytecodeIndex = 0;
currentCtpIndex = -1;
+ callNumber = 0;
}
/// javaCompile - Compile the Java method.
@@ -147,10 +149,19 @@
llvm::MDNode* DbgSubprogram;
/// currentLineIndex - The current line being processed.
- uint32 currentLineNumber;
+ uint16 currentLineNumber;
+
+ /// currentBytecodeIndex - The current bytecode being processed.
+ uint16 currentBytecodeIndex;
/// currentCtpIndex - The constant pool index being processed.
uint16 currentCtpIndex;
+
+ /// callNumber - The number of a call for a single opcode.
+ uint16 callNumber;
+
+ /// CreateLocation - Create debug information for a call.
+ llvm::MDNode* CreateLocation();
//===--------------------------- Inline support ---------------------------===//
Modified: vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp Sat Feb 13 19:06:47 2010
@@ -28,6 +28,7 @@
#include "JavaClass.h"
#include "JavaConstantPool.h"
#include "JavaThread.h"
+#include "JavaTypes.h"
#include "Jnjvm.h"
#include "j3/JnjvmModule.h"
@@ -69,10 +70,13 @@
new(Alloc, "CodeLineInfo") CodeLineInfo[infoLength];
for (uint32 i = 0; i < infoLength; ++i) {
DILocation DLT = Details.MF->getDILocation(Details.LineStarts[i].Loc);
+ uint32_t first = DLT.getLineNumber();
+ uint32_t second = DLT.getColumnNumber();
currentCompiledMethod->codeInfo[i].address =
Details.LineStarts[i].Address;
- currentCompiledMethod->codeInfo[i].lineNumber = DLT.getLineNumber();
- currentCompiledMethod->codeInfo[i].ctpIndex = DLT.getColumnNumber();
+ currentCompiledMethod->codeInfo[i].lineNumber = first & 0xFFFF;
+ currentCompiledMethod->codeInfo[i].bytecodeIndex = first >> 16;
+ currentCompiledMethod->codeInfo[i].ctpIndex = second & 0xFFFF;
}
}
}
@@ -422,3 +426,35 @@
Function* func = LMI->getMethod();
return (uintptr_t)EE->getPointerToFunctionOrStub(func);
}
+
+
+uintptr_t JavaJ3LazyJITCompiler::getPointerOrStub(JavaMethod& meth,
+ int side) {
+ return meth.getSignature()->getVirtualCallStub();
+}
+
+Value* JavaJ3LazyJITCompiler::addCallback(Class* cl, uint16 index,
+ Signdef* sign, bool stat,
+ llvm::BasicBlock* insert) {
+ LLVMSignatureInfo* LSI = getSignatureInfo(sign);
+ // Set the stub in the constant pool.
+ JavaConstantPool* ctpInfo = cl->ctpInfo;
+ intptr_t stub = stat ? sign->getStaticCallStub() : sign->getSpecialCallStub();
+ __sync_val_compare_and_swap(&(ctpInfo->ctpRes[index]), NULL, stub);
+ // Load the constant pool.
+ Value* CTP = getConstantPool(ctpInfo);
+ Value* Index = ConstantInt::get(Type::getInt32Ty(insert->getContext()),
+ index);
+ Value* func = GetElementPtrInst::Create(CTP, Index, "", insert);
+ func = new LoadInst(func, "", false, insert);
+ // Bitcast it to the LLVM function.
+ func = new BitCastInst(func, stat ? LSI->getStaticPtrType() :
+ LSI->getVirtualPtrType(),
+ "", insert);
+ return func;
+}
+
+bool JavaJ3LazyJITCompiler::needsCallback(JavaMethod* meth, bool* needsInit) {
+ *needsInit = true;
+ return (meth == NULL || meth->code == NULL);
+}
Modified: vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp Sat Feb 13 19:06:47 2010
@@ -170,7 +170,11 @@
// Update the line number information.
if (opinfo->lineNumber)
currentLineNumber = opinfo->lineNumber;
-
+
+ currentCtpIndex = -1;
+ currentBytecodeIndex = i;
+ callNumber = 0;
+
// To prevent a gcj bug with useless goto
if (currentBlock->getTerminator() != 0) {
currentBlock = createBasicBlock("gcj bug");
Modified: vmkit/trunk/lib/J3/Compiler/JnjvmModule.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JnjvmModule.cpp?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JnjvmModule.cpp Sat Feb 13 19:06:47 2010
@@ -290,6 +290,10 @@
StartJNIFunction = module->getFunction("j3StartJNI");
EndJNIFunction = module->getFunction("j3EndJNI");
+ ResolveVirtualStubFunction = module->getFunction("j3ResolveVirtualStub");
+ ResolveStaticStubFunction = module->getFunction("j3ResolveStaticStub");
+ ResolveSpecialStubFunction = module->getFunction("j3ResolveSpecialStub");
+
NullPointerExceptionFunction =
module->getFunction("j3NullPointerException");
ClassCastExceptionFunction = module->getFunction("j3ClassCastException");
@@ -427,9 +431,10 @@
void JavaJITMethodInfo::print(void* ip, void* addr) {
void* new_ip = NULL;
if (ip) new_ip = isStub(ip, addr);
- fprintf(stderr, "; %p in %s.%s", new_ip,
+ uint16 line = meth->lookupLineNumber((uintptr_t)ip);
+ fprintf(stderr, "; %p in %s.%s (line %d)", new_ip,
UTF8Buffer(meth->classDef->name).cString(),
- UTF8Buffer(meth->name).cString());
+ UTF8Buffer(meth->name).cString(), line);
if (ip != new_ip) fprintf(stderr, " (from stub)");
fprintf(stderr, "\n");
}
Modified: vmkit/trunk/lib/J3/Compiler/LLVMMaterializer.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LLVMMaterializer.cpp?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/LLVMMaterializer.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/LLVMMaterializer.cpp Sat Feb 13 19:06:47 2010
@@ -49,7 +49,8 @@
Value* JavaJITCompiler::addCallback(Class* cl, uint16 index,
- Signdef* sign, bool stat) {
+ Signdef* sign, bool stat,
+ BasicBlock* insert) {
Function* F = 0;
LLVMSignatureInfo* LSI = getSignatureInfo(sign);
Modified: vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll (original)
+++ vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll Sat Feb 13 19:06:47 2010
@@ -136,9 +136,8 @@
%JavaClass*, i32, ...) readnone
;;; j3VirtualTableLookup - Look up the offset in a virtual table of a
-;;; specific function. This function takes a class and an index to lookup in the
-;;; constant pool and returns and stores it in the constant pool cache.
-declare i8* @j3VirtualTableLookup(%JavaClass*, i32, ...)
+;;; specific function.
+declare i32 @j3VirtualTableLookup(%JavaClass*, i32, i32*, %JavaObject*)
;;; j3ClassLookup - Look up a specific class. The function takes a class and
;;; an index to lookup in the constant pool and returns and stores it in the
@@ -196,6 +195,10 @@
declare float @getFinalFloatField(float*) readnone
declare %JavaObject* @getFinalObjectField(%JavaObject**) readnone
+declare i8* @j3ResolveVirtualStub(%JavaObject*)
+declare i8* @j3ResolveSpecialStub()
+declare i8* @j3ResolveStaticStub()
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Exception methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.cpp?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.cpp Sat Feb 13 19:06:47 2010
@@ -1741,3 +1741,14 @@
if (codeInfoLength) return codeInfo[codeInfoLength - 1].lineNumber;
return 0;
}
+
+uint16 JavaMethod::lookupCtpIndex(uintptr_t ip) {
+ for(uint16 i = 0; i < codeInfoLength; ++i) {
+ if (codeInfo[i].address > ip) {
+ assert(i > 0 && "Wrong ip address for method");
+ return codeInfo[i - 1].ctpIndex;
+ }
+ }
+ if (codeInfoLength) return codeInfo[codeInfoLength - 1].ctpIndex;
+ return 0;
+}
Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.h?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.h Sat Feb 13 19:06:47 2010
@@ -994,6 +994,7 @@
uintptr_t address;
uint16 lineNumber;
uint16 ctpIndex;
+ uint16 bytecodeIndex;
// TODO: Use these fields when inlining.
JavaMethod* executingMethod;
// The code where the inlined method starts.
@@ -1089,6 +1090,11 @@
/// pointer.
///
uint16 lookupLineNumber(uintptr_t ip);
+
+ /// lookupCtpIndex - Lookup the constant pool index pointed by the opcode
+ /// related to the given instruction pointer.
+ ///
+ uint16 lookupCtpIndex(uintptr_t ip);
/// getSignature - Get the signature of thes method, resolving it if
/// necessary.
Modified: vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp Sat Feb 13 19:06:47 2010
@@ -140,9 +140,10 @@
#ifndef WITHOUT_VTABLE
// Throws if the method is not found.
-extern "C" void* j3VirtualTableLookup(UserClass* caller, uint32 index, ...) {
-
- void* res = 0;
+extern "C" uint32 j3VirtualTableLookup(UserClass* caller, uint32 index,
+ uint32* offset, JavaObject* obj) {
+ llvm_gcroot(obj, 0);
+ uint32 res = 0;
BEGIN_NATIVE_EXCEPTION(1)
@@ -155,10 +156,6 @@
JavaMethod* dmeth = lookup->lookupMethodDontThrow(utf8, sign->keyName, false,
true, 0);
if (!dmeth) {
- va_list ap;
- va_start(ap, index);
- JavaObject* obj = va_arg(ap, JavaObject*);
- va_end(ap);
assert((obj->getClass()->isClass() &&
obj->getClass()->asClass()->isInitializing()) &&
"Class not ready in a virtual lookup.");
@@ -168,7 +165,7 @@
obj->getClass()->asClass();
dmeth = lookup->lookupMethod(utf8, sign->keyName, false, true, 0);
} else {
- caller->getConstantPool()->ctpRes[index] = (void*)dmeth->offset;
+ *offset = dmeth->offset;
}
#if !defined(ISOLATE_SHARING) && !defined(SERVICE)
@@ -176,15 +173,10 @@
"Class not ready in a virtual lookup.");
#endif
- res = (void*)dmeth->offset;
+ res = dmeth->offset;
END_NATIVE_EXCEPTION
- // Since the function is marked readnone, LLVM may move it after the
- // exception check. Therefore, we trick LLVM to check the return value of the
- // function.
- JavaObject* obj = JavaThread::get()->pendingException;
- if (obj) return (void*)obj;
return res;
}
#endif
@@ -392,7 +384,8 @@
// Creates a Java object and then throws it.
extern "C" JavaObject* j3NullPointerException() {
-
+ JavaThread::get()->printBacktrace();
+ abort();
JavaObject *exc = 0;
JavaThread *th = JavaThread::get();
@@ -597,6 +590,146 @@
return (void*)str;
}
+extern "C" void* j3ResolveVirtualStub(JavaObject* obj) {
+ llvm_gcroot(obj, 0);
+ JavaThread *th = JavaThread::get();
+ UserCommonClass* cl = obj->getClass();
+ void* result = NULL;
+
+ BEGIN_NATIVE_EXCEPTION(1)
+
+ // Lookup the caller of this class.
+ mvm::StackWalker Walker(th);
+ ++Walker;
+ mvm::MethodInfo* MI = Walker.get();
+ assert(MI->MethodType == 1 && "Wrong call to stub");
+ JavaMethod* meth = (JavaMethod*)MI->getMetaInfo();
+ void* ip = *Walker;
+
+ // Lookup the method info in the constant pool of the caller.
+ uint16 ctpIndex = meth->lookupCtpIndex(reinterpret_cast<uintptr_t>(ip));
+ assert(ctpIndex && "No constant pool index");
+ JavaConstantPool* ctpInfo = meth->classDef->getConstantPool();
+ CommonClass* ctpCl = 0;
+ const UTF8* utf8 = 0;
+ Signdef* sign = 0;
+
+ ctpInfo->resolveMethod(ctpIndex, ctpCl, utf8, sign);
+ assert(cl->isAssignableFrom(ctpCl) && "Wrong call object");
+ UserClass* lookup = cl->isArray() ? cl->super : cl->asClass();
+ JavaMethod* Virt = lookup->lookupMethod(utf8, sign->keyName, false, true, 0);
+
+ // Compile the found method.
+ result = Virt->compiledPtr();
+
+ // Update the virtual table.
+ assert(lookup->isResolved() && "Class not resolved");
+#if !defined(ISOLATE_SHARING) && !defined(SERVICE)
+ assert(lookup->isInitializing() && "Class not ready");
+#endif
+ assert(lookup->virtualVT && "Class has no VT");
+ assert(lookup->virtualTableSize > Virt->offset &&
+ "The method's offset is greater than the virtual table size");
+ ((void**)obj->getVirtualTable())[Virt->offset] = result;
+
+ if (ctpCl->isInterface()) {
+ InterfaceMethodTable* IMT = cl->virtualVT->IMT;
+ uint32_t index = InterfaceMethodTable::getIndex(Virt->name, Virt->type);
+ if ((IMT->contents[index] & 1) == 0) {
+ IMT->contents[index] = (uintptr_t)result;
+ } else {
+
+ JavaMethod* Imeth =
+ ctpCl->asClass()->lookupInterfaceMethodDontThrow(utf8, sign->keyName);
+ assert(Imeth && "Method not in hierarchy?");
+ uintptr_t* table = (uintptr_t*)(IMT->contents[index] & ~1);
+ uint32 i = 0;
+ while (table[i] != (uintptr_t)Imeth) { i += 2; }
+ table[i + 1] = (uintptr_t)result;
+ }
+ }
+
+ END_NATIVE_EXCEPTION
+
+ return result;
+}
+
+extern "C" void* j3ResolveStaticStub() {
+ JavaThread *th = JavaThread::get();
+ void* result = NULL;
+
+ BEGIN_NATIVE_EXCEPTION(1)
+
+ // Lookup the caller of this class.
+ mvm::StackWalker Walker(th);
+ ++Walker;
+ mvm::MethodInfo* MI = Walker.get();
+ assert(MI->MethodType == 1 && "Wrong call to stub");
+ JavaMethod* caller = (JavaMethod*)MI->getMetaInfo();
+ void* ip = *Walker;
+
+ // Lookup the method info in the constant pool of the caller.
+ uint16 ctpIndex = caller->lookupCtpIndex(reinterpret_cast<uintptr_t>(ip));
+ assert(ctpIndex && "No constant pool index");
+ JavaConstantPool* ctpInfo = caller->classDef->getConstantPool();
+ CommonClass* cl = 0;
+ const UTF8* utf8 = 0;
+ Signdef* sign = 0;
+
+ ctpInfo->resolveMethod(ctpIndex, cl, utf8, sign);
+ UserClass* lookup = cl->isArray() ? cl->super : cl->asClass();
+ assert(lookup->isInitializing() && "Class not ready");
+ JavaMethod* callee = lookup->lookupMethod(utf8, sign->keyName, true, true, 0);
+
+ // Compile the found method.
+ result = callee->compiledPtr();
+
+ // Update the entry in the constant pool.
+ ctpInfo->ctpRes[ctpIndex] = result;
+
+ END_NATIVE_EXCEPTION
+
+ return result;
+}
+
+extern "C" void* j3ResolveSpecialStub() {
+ JavaThread *th = JavaThread::get();
+ void* result = NULL;
+
+ BEGIN_NATIVE_EXCEPTION(1)
+
+ // Lookup the caller of this class.
+ mvm::StackWalker Walker(th);
+ ++Walker;
+ mvm::MethodInfo* MI = Walker.get();
+ assert(MI->MethodType == 1 && "Wrong call to stub");
+ JavaMethod* caller = (JavaMethod*)MI->getMetaInfo();
+ void* ip = *Walker;
+
+ // Lookup the method info in the constant pool of the caller.
+ uint16 ctpIndex = caller->lookupCtpIndex(reinterpret_cast<uintptr_t>(ip));
+ assert(ctpIndex && "No constant pool index");
+ JavaConstantPool* ctpInfo = caller->classDef->getConstantPool();
+ CommonClass* cl = 0;
+ const UTF8* utf8 = 0;
+ Signdef* sign = 0;
+
+ ctpInfo->resolveMethod(ctpIndex, cl, utf8, sign);
+ UserClass* lookup = cl->isArray() ? cl->super : cl->asClass();
+ assert(lookup->isInitializing() && "Class not ready");
+ JavaMethod* callee = lookup->lookupMethod(utf8, sign->keyName, false, true,0);
+
+ // Compile the found method.
+ result = callee->compiledPtr();
+
+ // Update the entry in the constant pool.
+ ctpInfo->ctpRes[ctpIndex] = result;
+
+ END_NATIVE_EXCEPTION
+
+ return result;
+}
+
extern "C" void j3PrintMethodStart(JavaMethod* meth) {
fprintf(stderr, "[%p] executing %s.%s\n", (void*)mvm::Thread::get(),
UTF8Buffer(meth->classDef->name).cString(),
Modified: vmkit/trunk/lib/J3/VMCore/JavaTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaTypes.cpp?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaTypes.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaTypes.cpp Sat Feb 13 19:06:47 2010
@@ -114,6 +114,50 @@
return _virtualCallAP;
}
+intptr_t Signdef::virtualCallStub() {
+ if (!_virtualCallAP) {
+ char* buf = (char*)alloca((keyName->size << 1) + 1 + 11);
+ nativeName(buf, "virtual_stub");
+ bool unused = false;
+ intptr_t res = initialLoader->loadInLib(buf, unused);
+ if (res) {
+ _virtualCallStub = res;
+ } else {
+ initialLoader->getCompiler()->virtualCallStub(this);
+ }
+ }
+ return _virtualCallStub;
+}
+
+intptr_t Signdef::specialCallStub() {
+ if (!_specialCallStub) {
+ char* buf = (char*)alloca((keyName->size << 1) + 1 + 11);
+ nativeName(buf, "special_stub");
+ bool unused = false;
+ intptr_t res = initialLoader->loadInLib(buf, unused);
+ if (res) {
+ _specialCallStub = res;
+ } else {
+ initialLoader->getCompiler()->specialCallStub(this);
+ }
+ }
+ return _specialCallStub;
+}
+
+intptr_t Signdef::staticCallStub() {
+ if (!_staticCallStub) {
+ char* buf = (char*)alloca((keyName->size << 1) + 1 + 11);
+ nativeName(buf, "static_stub");
+ bool unused = false;
+ intptr_t res = initialLoader->loadInLib(buf, unused);
+ if (res) {
+ _staticCallStub = res;
+ } else {
+ initialLoader->getCompiler()->staticCallStub(this);
+ }
+ }
+ return _staticCallStub;
+}
void Signdef::nativeName(char* ptr, const char* ext) const {
sint32 i = 0;
Modified: vmkit/trunk/lib/J3/VMCore/JavaTypes.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaTypes.h?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaTypes.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaTypes.h Sat Feb 13 19:06:47 2010
@@ -291,6 +291,15 @@
intptr_t _virtualCallAP;
intptr_t virtualCallAP();
+ intptr_t _virtualCallStub;
+ intptr_t virtualCallStub();
+
+ intptr_t _specialCallStub;
+ intptr_t specialCallStub();
+
+ intptr_t _staticCallStub;
+ intptr_t staticCallStub();
+
public:
/// initialLoader - The loader that first loaded this signdef.
@@ -347,6 +356,21 @@
return _virtualCallAP;
}
+ intptr_t getVirtualCallStub() {
+ if (!_virtualCallStub) return virtualCallStub();
+ return _virtualCallStub;
+ }
+
+ intptr_t getSpecialCallStub() {
+ if (!_specialCallStub) return specialCallStub();
+ return _specialCallStub;
+ }
+
+ intptr_t getStaticCallStub() {
+ if (!_staticCallStub) return staticCallStub();
+ return _staticCallStub;
+ }
+
void setStaticCallBuf(intptr_t code) {
_staticCallBuf = code;
}
@@ -362,6 +386,18 @@
void setVirtualCallAP(intptr_t code) {
_virtualCallAP = code;
}
+
+ void setVirtualCallStub(intptr_t code) {
+ _virtualCallStub = code;
+ }
+
+ void setSpecialCallStub(intptr_t code) {
+ _specialCallStub = code;
+ }
+
+ void setStaticCallStub(intptr_t code) {
+ _staticCallStub = code;
+ }
//===----------------------------------------------------------------------===//
//
Modified: vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/JIT.cpp?rev=96142&r1=96141&r2=96142&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Sat Feb 13 19:06:47 2010
@@ -118,6 +118,11 @@
#else
llvm::DwarfExceptionHandling = false;
#endif
+
+ // Disable branch fold for accurate line numbers.
+ char* commands[2] = { (char*)"vmkit", (char*)"-disable-branch-fold" };
+ llvm::cl::ParseCommandLineOptions(2, commands);
+
if (!M) {
globalModule = new Module("bootstrap module", getGlobalContext());
More information about the vmkit-commits
mailing list