[vmkit-commits] [vmkit] r78064 - in /vmkit/trunk/lib/N3/VMCore: CLIJit.cpp CLIJit.h Opcodes.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Tue Aug 4 08:33:19 PDT 2009
Author: geoffray
Date: Tue Aug 4 10:33:11 2009
New Revision: 78064
URL: http://llvm.org/viewvc/llvm-project?rev=78064&view=rev
Log:
Move to new LLVM API and use maps instead of annotations to attach
per-function information.
Modified:
vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
vmkit/trunk/lib/N3/VMCore/CLIJit.h
vmkit/trunk/lib/N3/VMCore/Opcodes.cpp
Modified: vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJit.cpp?rev=78064&r1=78063&r2=78064&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJit.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJit.cpp Tue Aug 4 10:33:11 2009
@@ -744,7 +744,7 @@
} else {
type = field->signature->naturalType;
if (val == constantVMObjectNull) {
- val = llvmFunction->getContext().getNullValue(type);
+ val = Constant::getNullValue(type);
} else if (type != valType) {
val = changeType(val, type);
}
@@ -770,7 +770,7 @@
const Type* type = field->signature->naturalType;
const Type* valType = val->getType();
if (val == constantVMObjectNull) {
- val = llvmFunction->getContext().getNullValue(type);
+ val = Constant::getNullValue(type);
} else if (type != valType) {
val = changeType(val, type);
}
@@ -779,7 +779,7 @@
void CLIJit::JITVerifyNull(Value* obj) {
CLIJit* jit = this;
- Constant* zero = llvmFunction->getContext().getNullValue(obj->getType());
+ Constant* zero = Constant::getNullValue(obj->getType());
Value* test = new ICmpInst(*jit->currentBlock, ICmpInst::ICMP_EQ, obj,
zero, "");
@@ -1224,7 +1224,7 @@
cl->resolveType(false, false, genMethod);
AllocaInst* alloc = new AllocaInst(cl->naturalType, "", currentBlock);
if (cl->naturalType->isSingleValueType()) {
- new StoreInst(llvmFunction->getContext().getNullValue(cl->naturalType), alloc, false,
+ new StoreInst(Constant::getNullValue(cl->naturalType), alloc, false,
currentBlock);
} else {
uint64 size = module->getTypeSize(cl->naturalType);
@@ -1401,7 +1401,7 @@
cl->resolveType(false, false, genMethod);
AllocaInst* alloc = new AllocaInst(cl->naturalType, "", currentBlock);
if (cl->naturalType->isSingleValueType()) {
- new StoreInst(llvmFunction->getContext().getNullValue(cl->naturalType), alloc, false,
+ new StoreInst(Constant::getNullValue(cl->naturalType), alloc, false,
currentBlock);
} else {
uint64 size = module->getTypeSize(cl->naturalType);
@@ -1464,17 +1464,6 @@
return func;
}
-static AnnotationID CLIMethod_ID(
- AnnotationManager::getID("CLI::VMMethod"));
-
-
-class N3Annotation: public llvm::Annotation {
-public:
- VMMethod* meth;
-
- N3Annotation(VMMethod* M) : llvm::Annotation(CLIMethod_ID), meth(M) {}
-};
-
llvm::Function *VMMethod::compiledPtr(VMGenericMethod* genMethod) {
if (methPtr != 0) return methPtr;
@@ -1484,18 +1473,15 @@
methPtr = Function::Create(getSignature(genMethod), GlobalValue::GhostLinkage,
printString(), classDef->vm->getLLVMModule());
classDef->vm->functions->hash(methPtr, this);
- N3Annotation* A = new N3Annotation(this);
- methPtr->addAnnotation(A);
}
classDef->release();
return methPtr;
}
}
-VMMethod* CLIJit::getMethod(const llvm::Function* F) {
- N3Annotation* A = (N3Annotation*)F->getAnnotation(CLIMethod_ID);
- if (A) return A->meth;
- return 0;
+VMMethod* CLIJit::getMethod(llvm::Function* F) {
+ VMMethod* meth = VMThread::get()->vm->functions->lookup(F);
+ return meth;
}
void VMField::initField(VMObject* obj) {
@@ -1602,7 +1588,7 @@
- constantVMObjectNull = module->getContext().getNullValue(VMObject::llvmType);
+ constantVMObjectNull = Constant::getNullValue(VMObject::llvmType);
}
Constant* CLIJit::constantVMObjectNull;
Modified: vmkit/trunk/lib/N3/VMCore/CLIJit.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJit.h?rev=78064&r1=78063&r2=78064&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJit.h (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJit.h Tue Aug 4 10:33:11 2009
@@ -222,7 +222,7 @@
llvm::Instruction* invokeInline(VMMethod* meth,
std::vector<llvm::Value*>& args, VMGenericClass* genClass, VMGenericMethod* genMethod);
- static VMMethod* getMethod(const llvm::Function* F);
+ static VMMethod* getMethod(llvm::Function* F);
};
enum Opcode {
Modified: vmkit/trunk/lib/N3/VMCore/Opcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Opcodes.cpp?rev=78064&r1=78063&r2=78064&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/Opcodes.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/Opcodes.cpp Tue Aug 4 10:33:11 2009
@@ -341,7 +341,7 @@
#define TEST(name, read, cmpf, cmpi, offset) case name : { \
uint32 tmp = i; \
Value* val2 = pop(); \
- Value* val1 = llvmFunction->getContext().getNullValue(val2->getType()); \
+ Value* val1 = Constant::getNullValue(val2->getType()); \
BasicBlock* ifTrue = opcodeInfos[tmp + offset + read(bytecodes, i)].newBlock; \
Value* test = 0; \
if (val1->getType()->isFloatingPoint()) { \
@@ -1020,7 +1020,7 @@
case NEG : {
Value* val = pop();
push(BinaryOperator::CreateSub(
- llvmFunction->getContext().getNullValue(val->getType()),
+ Constant::getNullValue(val->getType()),
val, "", currentBlock));
break;
}
@@ -1383,8 +1383,8 @@
Value* obj = pop();
Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, obj,
- llvmFunction->getContext().getNullValue(obj->getType()), "");
- Constant* nullVirtual = llvmFunction->getContext().getNullValue(dcl->virtualType);
+ Constant::getNullValue(obj->getType()), "");
+ Constant* nullVirtual = Constant::getNullValue(dcl->virtualType);
BasicBlock* isInstEndBlock = createBasicBlock("end isinst");
More information about the vmkit-commits
mailing list