[vmkit-commits] [vmkit] r60103 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaClass.h JavaJIT.cpp JavaJITOpcodes.cpp LowerConstantCalls.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Wed Nov 26 04:19:25 PST 2008
Author: geoffray
Date: Wed Nov 26 06:19:20 2008
New Revision: 60103
URL: http://llvm.org/viewvc/llvm-project?rev=60103&view=rev
Log:
Code cleanup, no functionality changes.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp
vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=60103&r1=60102&r2=60103&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Wed Nov 26 06:19:20 2008
@@ -182,16 +182,7 @@
// New fields can be added from now, or reordered.
//
//===----------------------------------------------------------------------===//
-
-
- uint32 getVirtualSize() {
- return virtualSize;
- }
- VirtualTable* getVirtualVT() {
- return virtualVT;
- }
-
/// virtualTableSize - The size of the virtual table of this class.
///
uint32 virtualTableSize;
@@ -200,79 +191,27 @@
///
uint32 access;
- uint32 getAccess() {
- return access;
- }
-
/// isArray - Is the class an array class?
///
bool array;
- bool isArray() {
- return array;
- }
-
- bool primitive;
-
/// isPrimitive - Is the class a primitive class?
///
- bool isPrimitive() {
- return primitive;
- }
-
- /// isInterface - Is the class an interface?
- ///
- bool isInterface() {
- return jnjvm::isInterface(access);
- }
-
- /// asClass - Returns the class as a user-defined class
- /// if it is not a primitive or an array.
- UserClass* asClass() {
- if (!primitive && !array) return (UserClass*)this;
- return 0;
- }
-
- /// asPrimitiveClass - Returns the class if it's a primitive class.
- ///
- UserClassPrimitive* asPrimitiveClass() {
- if (primitive) return (UserClassPrimitive*)this;
- return 0;
- }
-
- /// asArrayClass - Returns the class if it's an array class.
- ///
- UserClassArray* asArrayClass() {
- if (array) return (UserClassArray*)this;
- return 0;
- }
-
+ bool primitive;
+
/// interfaces - The interfaces this class implements.
///
- Class** interfaces;
-
- Class** getInterfaces() {
- return interfaces;
- }
-
+ Class** interfaces;
uint16 nbInterfaces;
/// name - The name of the class.
///
const UTF8* name;
-
- const UTF8* getName() {
- return name;
- }
-
+
/// super - The parent of this class.
///
CommonClass * super;
- CommonClass* getSuper() {
- return super;
- }
-
/// lockVar - When multiple threads want to load/resolve/initialize a class,
/// they must be synchronized so that these steps are only performed once
/// for a given class.
@@ -306,10 +245,60 @@
JavaMethod* staticMethods;
uint16 nbStaticMethods;
+ /// ownerClass - Who is initializing this class.
+ ///
+ mvm::Thread* ownerClass;
+
+ // Assessor methods.
+ uint32 getVirtualSize() { return virtualSize; }
+ VirtualTable* getVirtualVT() { return virtualVT; }
+ uint32 getAccess() { return access;}
+ Class** getInterfaces() { return interfaces; }
+ const UTF8* getName() { return name; }
+ CommonClass* getSuper() { return super; }
JavaField* getStaticFields() { return staticFields; }
JavaField* getVirtualFields() { return virtualFields; }
JavaMethod* getStaticMethods() { return staticMethods; }
JavaMethod* getVirtualMethods() { return virtualMethods; }
+
+ /// isArray - Is the class an array class?
+ ///
+ bool isArray() {
+ return array;
+ }
+
+ /// isPrimitive - Is the class a primitive class?
+ ///
+ bool isPrimitive() {
+ return primitive;
+ }
+
+ /// isInterface - Is the class an interface?
+ ///
+ bool isInterface() {
+ return jnjvm::isInterface(access);
+ }
+
+ /// asClass - Returns the class as a user-defined class
+ /// if it is not a primitive or an array.
+ UserClass* asClass() {
+ if (!primitive && !array) return (UserClass*)this;
+ return 0;
+ }
+
+ /// asPrimitiveClass - Returns the class if it's a primitive class.
+ ///
+ UserClassPrimitive* asPrimitiveClass() {
+ if (primitive) return (UserClassPrimitive*)this;
+ return 0;
+ }
+
+ /// asArrayClass - Returns the class if it's an array class.
+ ///
+ UserClassArray* asArrayClass() {
+ if (array) return (UserClassArray*)this;
+ return 0;
+ }
/// constructMethod - Create a new method.
///
@@ -350,15 +339,15 @@
void broadcastClass() {
condVar.broadcast();
}
-
- /// ownerClass - Who is initializing this class.
- ///
- mvm::Thread* ownerClass;
+ /// getOwnerClass - Get the thread that is currently initializing the class.
+ ///
mvm::Thread* getOwnerClass() {
return ownerClass;
}
+ /// setOwnerClass - Set the thread that is currently initializing the class.
+ ///
void setOwnerClass(mvm::Thread* th) {
ownerClass = th;
}
@@ -402,6 +391,7 @@
virtual void TRACER;
/// printString - Prints the class.
+ ///
char *printString() const {
mvm::PrintBuffer *buf = mvm::PrintBuffer::alloc();
print(buf);
@@ -472,19 +462,40 @@
/// CommonClass - Default constructor.
///
CommonClass();
-
+
+ /// getDeclaredConstructors - Returns the methods defined in this class which
+ /// are constructors.
+ ///
void getDeclaredConstructors(std::vector<JavaMethod*>& res, bool publicOnly);
+
+ /// getDeclaredMethod - Returns the methods defined in this class which are
+ /// not constructors.
+ //
void getDeclaredMethods(std::vector<JavaMethod*>& res, bool publicOnly);
+
+ /// getDeclaredFields - Returns the fields defined in this class.
+ ///
void getDeclaredFields(std::vector<JavaField*>& res, bool publicOnly);
+
+ /// setInterfaces - Set the interfaces of the class.
+ ///
void setInterfaces(Class** I) {
interfaces = I;
}
+
+ /// setSuper - Set the super of the class.
+ ///
void setSuper(CommonClass* S) {
super = S;
}
+ /// toPrimitive - Returns the primitive class which represents
+ /// this class, ie void for java/lang/Void.
+ ///
UserClassPrimitive* toPrimitive(Jnjvm* vm) const;
-
+
+ /// getInternal - Return the class.
+ ///
CommonClass* getInternal() {
return this;
}
@@ -615,10 +626,6 @@
///
uint16 innerAccess;
- void setInnerAccess(uint32 access) {
- innerAccess = access;
- }
-
/// innerOuterResolved - Is the inner/outer resolution done?
///
bool innerOuterResolved;
@@ -630,6 +637,10 @@
/// staticVT - The virtual table of the static instance of this class.
///
VirtualTable* staticVT;
+
+ void setInnerAccess(uint32 access) {
+ innerAccess = access;
+ }
uint32 getStaticSize() {
return staticSize;
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=60103&r1=60102&r2=60103&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Wed Nov 26 06:19:20 2008
@@ -114,40 +114,36 @@
Value* VT = CallInst::Create(module->GetVTFunction, args[0], "",
currentBlock);
- std::vector<Value*> indexes2; //[3];
+ Value* indexes2; //[3];
#ifdef ISOLATE_SHARING
- std::vector<Value*> indexesCtp; //[3];
+ Value* indexesCtp; //[3];
#endif
if (meth) {
LLVMMethodInfo* LMI = module->getMethodInfo(meth);
ConstantInt* Offset = LMI->getOffset();
- indexes2.push_back(Offset);
+ indexes2 = Offset;
#ifdef ISOLATE_SHARING
- indexesCtp.push_back(ConstantInt::get(Type::Int32Ty,
- Offset->getZExtValue() * -1));
+ indexesCtp = ConstantInt::get(Type::Int32Ty,
+ Offset->getZExtValue() * -1);
#endif
} else {
Value* val = getConstantPoolAt(index, module->VirtualLookupFunction,
Type::Int32Ty, args[0], true);
- indexes2.push_back(val);
+ indexes2 = val;
#ifdef ISOLATE_SHARING
Value* mul = BinaryOperator::CreateMul(val, module->constantMinusOne,
"", currentBlock);
- indexesCtp.push_back(mul);
+ indexesCtp = mul;
#endif
}
- Value* FuncPtr = GetElementPtrInst::Create(VT, indexes2.begin(),
- indexes2.end(), "",
- currentBlock);
+ Value* FuncPtr = GetElementPtrInst::Create(VT, indexes2, "", currentBlock);
Value* Func = new LoadInst(FuncPtr, "", currentBlock);
Func = new BitCastInst(Func, LSI->getVirtualPtrType(), "", currentBlock);
#ifdef ISOLATE_SHARING
- Value* CTP = GetElementPtrInst::Create(VT, indexesCtp.begin(),
- indexesCtp.end(), "",
- currentBlock);
+ Value* CTP = GetElementPtrInst::Create(VT, indexesCtp, "", currentBlock);
CTP = new LoadInst(CTP, "", currentBlock);
CTP = new BitCastInst(CTP, module->ConstantPoolType, "", currentBlock);
@@ -291,10 +287,9 @@
void JavaJIT::monitorEnter(Value* obj) {
- std::vector<Value*> gep;
- gep.push_back(module->constantZero);
- gep.push_back(module->JavaObjectLockOffsetConstant);
- Value* lockPtr = GetElementPtrInst::Create(obj, gep.begin(), gep.end(), "",
+ Value* gep[2] = { module->constantZero,
+ module->JavaObjectLockOffsetConstant };
+ Value* lockPtr = GetElementPtrInst::Create(obj, gep, gep + 2, "",
currentBlock);
Value* lock = new LoadInst(lockPtr, "", currentBlock);
lock = new PtrToIntInst(lock, module->pointerSizeType, "", currentBlock);
@@ -335,10 +330,9 @@
}
void JavaJIT::monitorExit(Value* obj) {
- std::vector<Value*> gep;
- gep.push_back(module->constantZero);
- gep.push_back(module->JavaObjectLockOffsetConstant);
- Value* lockPtr = GetElementPtrInst::Create(obj, gep.begin(), gep.end(), "",
+ Value* gep[2] = { module->constantZero,
+ module->JavaObjectLockOffsetConstant };
+ Value* lockPtr = GetElementPtrInst::Create(obj, gep, gep + 2, "",
currentBlock);
Value* lock = new LoadInst(lockPtr, "", currentBlock);
lock = new PtrToIntInst(lock, module->pointerSizeType, "", currentBlock);
@@ -379,19 +373,16 @@
#ifdef ISOLATE_SHARING
Value* JavaJIT::getStaticInstanceCtp() {
Value* cl = getClassCtp();
- std::vector<Value*> indexes; //[3];
- indexes.push_back(module->constantZero);
- indexes.push_back(module->constantSeven);
- Value* arg1 = GetElementPtrInst::Create(cl, indexes.begin(),
- indexes.end(), "", currentBlock);
+ Value* indexes[2] = { module->constantZero, module->constantSeven };
+ Value* arg1 = GetElementPtrInst::Create(cl, indexes, indexes + 2,
+ "", currentBlock);
arg1 = new LoadInst(arg1, "", false, currentBlock);
return arg1;
}
Value* JavaJIT::getClassCtp() {
- std::vector<Value*> indexes; //[3];
- indexes.push_back(module->constantOne);
+ Value* indexes = module->constantOne;
Value* arg1 = GetElementPtrInst::Create(ctpCache, indexes.begin(),
indexes.end(), "", currentBlock);
arg1 = new LoadInst(arg1, "", false, currentBlock);
@@ -576,13 +567,12 @@
#if JNJVM_EXECUTE > 0
{
- std::vector<llvm::Value*> args;
- args.push_back(ConstantExpr::getIntToPtr(
+ Value* arg = ConstantExpr::getIntToPtr(
ConstantInt::get(Type::Int64Ty, uint64_t (compilingMethod)),
- module->ptrType));
+ module->ptrType);
- llvm::CallInst::Create(module->PrintMethodStartFunction, args.begin(),
- args.end(), "", currentBlock);
+ llvm::CallInst::Create(module->PrintMethodStartFunction, arg, "",
+ currentBlock);
}
#endif
@@ -669,9 +659,7 @@
threadId = new IntToPtrInst(threadId, module->ptrPtrType, "", currentBlock);
- std::vector<Value*> GEP;
- GEP.push_back(module->constantThree);
- IsolateIDPtr = GetElementPtrInst::Create(threadId, GEP.begin(), GEP.end(),
+ IsolateIDPtr = GetElementPtrInst::Create(threadId, module->constantThree,
"", currentBlock);
const Type* realType = PointerType::getUnqual(module->pointerSizeType);
IsolateIDPtr = new BitCastInst(IsolateIDPtr, realType, "",
@@ -690,9 +678,7 @@
currentBlock = ServiceBB;
new StoreInst(MyID, IsolateIDPtr, currentBlock);
- GEP.clear();
- GEP.push_back(module->constantFour);
- IsolatePtr = GetElementPtrInst::Create(threadId, GEP.begin(), GEP.end(), "",
+ IsolatePtr = GetElementPtrInst::Create(threadId, module->constantFour, "",
currentBlock);
OldIsolate = new LoadInst(IsolatePtr, "", currentBlock);
@@ -700,11 +686,9 @@
NewIsolate = new LoadInst(NewIsolate, "", currentBlock);
new StoreInst(NewIsolate, IsolatePtr, currentBlock);
- GEP.clear();
- GEP.push_back(OldIsolate);
- GEP.push_back(NewIsolate);
#if DEBUG
- CallInst::Create(module->ServiceCallStartFunction, GEP.begin(), GEP.end(),
+ Value* GEP[2] = { OldIsolate, NewIsolate };
+ CallInst::Create(module->ServiceCallStartFunction, GEP, GEP + 2,
"", currentBlock);
#endif
BranchInst::Create(EndBB, currentBlock);
@@ -759,12 +743,10 @@
#if JNJVM_EXECUTE > 0
{
- std::vector<llvm::Value*> args;
- args.push_back(ConstantExpr::getIntToPtr(
+ Value* arg = ConstantExpr::getIntToPtr(
ConstantInt::get(Type::Int64Ty, uint64_t (compilingMethod)),
- module->ptrType));
- llvm::CallInst::Create(module->PrintMethodEndFunction, args.begin(),
- args.end(), "", currentBlock);
+ module->ptrType);
+ CallInst::Create(module->PrintMethodEndFunction, arg, "", currentBlock);
}
#endif
@@ -780,11 +762,9 @@
new StoreInst(OldIsolateID, IsolateIDPtr, currentBlock);
new StoreInst(OldIsolate, IsolatePtr, currentBlock);
- std::vector<Value*> GEP;
- GEP.push_back(OldIsolate);
- GEP.push_back(NewIsolate);
#if DEBUG
- CallInst::Create(module->ServiceCallStopFunction, GEP.begin(), GEP.end(),
+ Value* GEP[2] = { OldIsolate, NewIsolate };
+ CallInst::Create(module->ServiceCallStopFunction, GEP, GEP + 2,
"", currentBlock);
#endif
BranchInst::Create(EndBB, currentBlock);
@@ -855,34 +835,32 @@
createBasicBlock("trySynchronizeExceptionBlock");
realEndExceptionBlock = synchronizeExceptionBlock;
endExceptionBlockCatcher = trySynchronizeExceptionBlock;
- std::vector<Value*> argsSync;
+ Value* argsSync = 0;
if (isVirtual(compilingMethod->access)) {
- argsSync.push_back(llvmFunction->arg_begin());
+ argsSync = llvmFunction->arg_begin();
} else {
Value* cl = module->getNativeClass(compilingClass);
cl = new LoadInst(cl, "", currentBlock);
Value* arg = CallInst::Create(module->GetStaticInstanceFunction, cl, "",
currentBlock);
- argsSync.push_back(arg);
+ argsSync = arg;
}
- llvm::CallInst::Create(module->ReleaseObjectFunction, argsSync.begin(),
- argsSync.end(), "", synchronizeExceptionBlock);
+ llvm::CallInst::Create(module->ReleaseObjectFunction, argsSync, "",
+ synchronizeExceptionBlock);
llvm::BranchInst::Create(endExceptionBlock, synchronizeExceptionBlock);
const PointerType* PointerTy_0 = module->ptrType;
- std::vector<Value*> int32_eh_select_params;
Instruction* ptr_eh_ptr =
llvm::CallInst::Create(module->llvmGetException, "eh_ptr",
trySynchronizeExceptionBlock);
- int32_eh_select_params.push_back(ptr_eh_ptr);
Constant* C = ConstantExpr::getCast(Instruction::BitCast,
module->personality, PointerTy_0);
- int32_eh_select_params.push_back(C);
- int32_eh_select_params.push_back(module->constantPtrNull);
+ Value* int32_eh_select_params[3] =
+ { ptr_eh_ptr, C, module->constantPtrNull };
llvm::CallInst::Create(module->exceptionSelector,
- int32_eh_select_params.begin(),
- int32_eh_select_params.end(),
+ int32_eh_select_params,
+ int32_eh_select_params + 3,
"eh_select", trySynchronizeExceptionBlock);
llvm::BranchInst::Create(synchronizeExceptionBlock,
@@ -1001,17 +979,15 @@
if (cur->realTest != cur->test) {
const PointerType* PointerTy_0 = module->ptrType;
- std::vector<Value*> int32_eh_select_params;
Instruction* ptr_eh_ptr =
llvm::CallInst::Create(module->llvmGetException, "eh_ptr", cur->test);
- int32_eh_select_params.push_back(ptr_eh_ptr);
Constant* C = ConstantExpr::getCast(Instruction::BitCast,
module->personality, PointerTy_0);
- int32_eh_select_params.push_back(C);
- int32_eh_select_params.push_back(module->constantPtrNull);
+ Value* int32_eh_select_params[3] =
+ { ptr_eh_ptr, C, module->constantPtrNull };
llvm::CallInst::Create(module->exceptionSelector,
- int32_eh_select_params.begin(),
- int32_eh_select_params.end(), "eh_select",
+ int32_eh_select_params,
+ int32_eh_select_params + 3, "eh_select",
cur->test);
llvm::BranchInst::Create(cur->realTest, cur->test);
cur->exceptionPHI->addIncoming(ptr_eh_ptr, cur->test);
@@ -1030,8 +1006,8 @@
cl = module->getNativeClass(cur->catchClass);
cl = new LoadInst(cl, "", currentBlock);
#endif
- Value* cmp = llvm::CallInst::Create(module->CompareExceptionFunction, cl, "",
- currentBlock);
+ Value* cmp = CallInst::Create(module->CompareExceptionFunction, cl, "",
+ currentBlock);
llvm::BranchInst::Create(cur->nativeHandler, bbNext, cmp, currentBlock);
if (nodeNext)
nodeNext->addIncoming(cur->exceptionPHI, currentBlock);
@@ -1039,22 +1015,18 @@
cur->handlerPHI = llvm::PHINode::Create(module->ptrType, "",
cur->nativeHandler);
cur->handlerPHI->addIncoming(cur->exceptionPHI, currentBlock);
- Value* exc = llvm::CallInst::Create(module->GetJavaExceptionFunction,
- "", cur->nativeHandler);
- llvm::CallInst::Create(module->ClearExceptionFunction, "",
- cur->nativeHandler);
- llvm::CallInst::Create(module->exceptionBeginCatch, cur->handlerPHI,
+ Value* exc = CallInst::Create(module->GetJavaExceptionFunction,
+ "", cur->nativeHandler);
+ CallInst::Create(module->ClearExceptionFunction, "", cur->nativeHandler);
+ CallInst::Create(module->exceptionBeginCatch, cur->handlerPHI,
"tmp8", cur->nativeHandler);
- std::vector<Value*> void_28_params;
- llvm::CallInst::Create(module->exceptionEndCatch,
- void_28_params.begin(), void_28_params.end(), "",
- cur->nativeHandler);
+ CallInst::Create(module->exceptionEndCatch, "", cur->nativeHandler);
BranchInst::Create(cur->javaHandler, cur->nativeHandler);
if (cur->javaHandler->empty()) {
- PHINode* node = llvm::PHINode::Create(JnjvmModule::JavaObjectType, "",
- cur->javaHandler);
+ PHINode* node = PHINode::Create(JnjvmModule::JavaObjectType, "",
+ cur->javaHandler);
node->addIncoming(exc, cur->nativeHandler);
new StoreInst(node, supplLocal, false, cur->javaHandler);
@@ -1083,9 +1055,7 @@
threadId = new IntToPtrInst(threadId, module->ptrPtrType, "",
cur->javaHandler);
- std::vector<Value*> GEP;
- GEP.push_back(module->constantThree);
- IsolateIDPtr = GetElementPtrInst::Create(threadId, GEP.begin(), GEP.end(),
+ IsolateIDPtr = GetElementPtrInst::Create(threadId, module->constantThree,
"", cur->javaHandler);
const Type* realType = PointerType::getUnqual(module->pointerSizeType);
IsolateIDPtr = new BitCastInst(IsolateIDPtr, realType, "",
@@ -1096,9 +1066,7 @@
loader->isolate->IsolateID);
new StoreInst(MyID, IsolateIDPtr, cur->javaHandler);
- GEP.clear();
- GEP.push_back(module->constantFour);
- IsolatePtr = GetElementPtrInst::Create(threadId, GEP.begin(), GEP.end(), "",
+ IsolatePtr = GetElementPtrInst::Create(threadId, module->constantFour, "",
cur->javaHandler);
OldIsolate = new LoadInst(IsolatePtr, "", cur->javaHandler);
@@ -1194,15 +1162,15 @@
BasicBlock* cont = createBasicBlock("verifyNullCont");
llvm::BranchInst::Create(exit, cont, test, currentBlock);
- std::vector<Value*> args;
if (currentExceptionBlock != endExceptionBlock) {
- llvm::InvokeInst::Create(module->NullPointerExceptionFunction,
- unifiedUnreachable,
- currentExceptionBlock, args.begin(),
- args.end(), "", exit);
+ Value** val = 0;
+ InvokeInst::Create(module->NullPointerExceptionFunction,
+ unifiedUnreachable,
+ currentExceptionBlock, val, val,
+ "", exit);
} else {
llvm::CallInst::Create(module->NullPointerExceptionFunction,
- args.begin(), args.end(), "", exit);
+ "", exit);
new UnreachableInst(exit);
}
@@ -1230,17 +1198,15 @@
branch(cmp, ifTrue, ifFalse, currentBlock);
- std::vector<Value*>args;
- args.push_back(obj);
- args.push_back(index);
+ Value* args[2] = { obj, index };
if (currentExceptionBlock != endExceptionBlock) {
- llvm::InvokeInst::Create(module->IndexOutOfBoundsExceptionFunction,
- unifiedUnreachable,
- currentExceptionBlock, args.begin(),
- args.end(), "", ifFalse);
+ InvokeInst::Create(module->IndexOutOfBoundsExceptionFunction,
+ unifiedUnreachable,
+ currentExceptionBlock, args, args + 2,
+ "", ifFalse);
} else {
- llvm::CallInst::Create(module->IndexOutOfBoundsExceptionFunction,
- args.begin(), args.end(), "", ifFalse);
+ CallInst::Create(module->IndexOutOfBoundsExceptionFunction,
+ args, args + 2, "", ifFalse);
new UnreachableInst(ifFalse);
}
@@ -1250,13 +1216,9 @@
Constant* zero = module->constantZero;
Value* val = new BitCastInst(obj, arrayType, "", currentBlock);
- std::vector<Value*> indexes; //[3];
- indexes.push_back(zero);
- indexes.push_back(module->JavaArrayElementsOffsetConstant);
- indexes.push_back(index);
- Value* ptr = llvm::GetElementPtrInst::Create(val, indexes.begin(),
- indexes.end(),
- "", currentBlock);
+ Value* indexes[3] = { zero, module->JavaArrayElementsOffsetConstant, index };
+ Value* ptr = GetElementPtrInst::Create(val, indexes, indexes + 3, "",
+ currentBlock);
return ptr;
@@ -1643,15 +1605,12 @@
// This makes unswitch loop very unhappy time-wise, but makes GVN happy
// number-wise. IMO, it's better to have this than Unswitch.
- std::vector<Value*> Args;
#ifdef ISOLATE_SHARING
Value* CTP = ctpCache;
- Args.push_back(module->constantOne);
- Value* Cl = GetElementPtrInst::Create(CTP, Args.begin(), Args.end(), "",
+ Value* Cl = GetElementPtrInst::Create(CTP, module->ConstantOne, "",
currentBlock);
Cl = new LoadInst(Cl, "", currentBlock);
Cl = new BitCastInst(Cl, module->JavaClassType, "", currentBlock);
- Args.clear();
#else
JavaConstantPool* ctp = compilingClass->ctpInfo;
Value* CTP = module->getConstantPool(ctp);
@@ -1660,6 +1619,7 @@
Cl = new LoadInst(Cl, "", currentBlock);
#endif
+ std::vector<Value*> Args;
Args.push_back(resolver);
Args.push_back(CTP);
Args.push_back(Cl);
@@ -1713,25 +1673,20 @@
"", currentBlock);
Value* VT = CallInst::Create(module->GetVTFromClassFunction, Cl, "",
currentBlock);
- std::vector<Value*> args;
- args.push_back(Size);
- args.push_back(VT);
- Value* val = invoke(module->JavaObjectAllocateFunction, args, "",
+
+ Value* val = invoke(module->JavaObjectAllocateFunction, Size, VT, "",
currentBlock);
// Set the class
- std::vector<Value*> gep;
- gep.push_back(module->constantZero);
- gep.push_back(module->JavaObjectClassOffsetConstant);
- Value* GEP = GetElementPtrInst::Create(val, gep.begin(), gep.end(), "",
+ Value* gep[2] = { module->constantZero,
+ module->JavaObjectClassOffsetConstant };
+ Value* GEP = GetElementPtrInst::Create(val, gep, gep + 2, "",
currentBlock);
new StoreInst(Cl, GEP, currentBlock);
- gep.clear();
- gep.push_back(module->constantZero);
- gep.push_back(module->JavaObjectLockOffsetConstant);
- Value* lockPtr = GetElementPtrInst::Create(val, gep.begin(), gep.end(), "",
+ Value* gep2[2] = { module->constantZero, module->JavaObjectLockOffsetConstant };
+ Value* lockPtr = GetElementPtrInst::Create(val, gep2, gep2 + 2, "",
currentBlock);
Value* threadId = CallInst::Create(module->llvm_frameaddress,
module->constantZero, "", currentBlock);
@@ -1746,22 +1701,18 @@
}
Value* JavaJIT::arraySize(Value* val) {
- return llvm::CallInst::Create(module->ArrayLengthFunction, val, "",
- currentBlock);
+ return CallInst::Create(module->ArrayLengthFunction, val, "", currentBlock);
}
-static llvm::Value* fieldGetter(JavaJIT* jit, const Type* type, Value* object,
- Value* offset) {
- llvm::Value* objectConvert = new BitCastInst(object, type, "",
- jit->currentBlock);
+static Value* fieldGetter(JavaJIT* jit, const Type* type, Value* object,
+ Value* offset) {
+ Value* objectConvert = new BitCastInst(object, type, "",
+ jit->currentBlock);
Constant* zero = jit->module->constantZero;
- std::vector<Value*> args; // size = 2
- args.push_back(zero);
- args.push_back(offset);
+ Value* args[2] = { zero, offset };
llvm::Value* ptr = llvm::GetElementPtrInst::Create(objectConvert,
- args.begin(),
- args.end(), "",
+ args, args + 2, "",
jit->currentBlock);
return ptr;
}
@@ -1806,11 +1757,8 @@
Value* ptr = getConstantPoolAt(index, func, returnType, 0, true);
if (!stat) {
Value* tmp = new BitCastInst(object, Pty, "", currentBlock);
- std::vector<Value*> args;
- args.push_back(zero);
- args.push_back(ptr);
- ptr = GetElementPtrInst::Create(tmp, args.begin(), args.end(), "",
- currentBlock);
+ Value* args[2] = { zero, ptr };
+ ptr = GetElementPtrInst::Create(tmp, args, args + 2, "", currentBlock);
}
return new BitCastInst(ptr, fieldTypePtr, "", currentBlock);
@@ -1938,31 +1886,27 @@
if (currentExceptionBlock != endExceptionBlock) {
BasicBlock* ifNormal = createBasicBlock("no exception block");
currentBlock = ifNormal;
- std::vector<Value*> arg;
- arg.push_back(arg1);
- return llvm::InvokeInst::Create(F, ifNormal, currentExceptionBlock,
- arg.begin(), arg.end(), Name, InsertAtEnd);
+ Value* arg[1] = { arg1 };
+ return InvokeInst::Create(F, ifNormal, currentExceptionBlock,
+ arg, arg + 1, Name, InsertAtEnd);
} else {
- return llvm::CallInst::Create(F, arg1, Name, InsertAtEnd);
+ return CallInst::Create(F, arg1, Name, InsertAtEnd);
}
}
Instruction* JavaJIT::invoke(Value *F, Value* arg1, Value* arg2,
const char* Name, BasicBlock *InsertAtEnd) {
- std::vector<Value*> args;
- args.push_back(arg1);
- args.push_back(arg2);
+ Value* args[2] = { arg1, arg2 };
// means: is there a handler for me?
if (currentExceptionBlock != endExceptionBlock) {
BasicBlock* ifNormal = createBasicBlock("no exception block");
currentBlock = ifNormal;
- return llvm::InvokeInst::Create(F, ifNormal, currentExceptionBlock,
- args.begin(), args.end(), Name,
- InsertAtEnd);
+ return InvokeInst::Create(F, ifNormal, currentExceptionBlock,
+ args, args + 2, Name, InsertAtEnd);
} else {
- return llvm::CallInst::Create(F, args.begin(), args.end(), Name, InsertAtEnd);
+ return CallInst::Create(F, args, args + 2, Name, InsertAtEnd);
}
}
@@ -1972,9 +1916,9 @@
if (currentExceptionBlock != endExceptionBlock) {
BasicBlock* ifNormal = createBasicBlock("no exception block");
currentBlock = ifNormal;
- std::vector<Value*> args;
+ Value* args[1];
return llvm::InvokeInst::Create(F, ifNormal, currentExceptionBlock,
- args.begin(), args.end(), Name,
+ args, args, Name,
InsertAtEnd);
} else {
return llvm::CallInst::Create(F, Name, InsertAtEnd);
@@ -2025,20 +1969,15 @@
module->EnveloppeType, 0, false);
#endif
- std::vector<Value*> args1;
- args1.push_back(zero);
- args1.push_back(zero);
- Value* cachePtr = GetElementPtrInst::Create(llvmEnv, args1.begin(), args1.end(),
- "", currentBlock);
+ Value* args1[2] = { zero, zero };
+ Value* cachePtr = GetElementPtrInst::Create(llvmEnv, args1, args1 + 2,
+ "", currentBlock);
Value* cache = new LoadInst(cachePtr, "", currentBlock);
Value* cl = CallInst::Create(module->GetClassFunction, args[0], "",
currentBlock);
- std::vector<Value*> args3;
- args3.push_back(zero);
- args3.push_back(one);
- Value* lastCiblePtr = GetElementPtrInst::Create(cache, args3.begin(),
- args3.end(), "",
+ Value* args3[2] = { zero, one };
+ Value* lastCiblePtr = GetElementPtrInst::Create(cache, args3, args3 + 2, "",
currentBlock);
Value* lastCible = new LoadInst(lastCiblePtr, "", currentBlock);
@@ -2067,8 +2006,8 @@
currentBlock = ifTrue;
- Value* methPtr = GetElementPtrInst::Create(cache, args1.begin(), args1.end(),
- "", currentBlock);
+ Value* methPtr = GetElementPtrInst::Create(cache, args1, args1 + 2,
+ "", currentBlock);
_meth = new LoadInst(methPtr, "", currentBlock);
meth = new BitCastInst(_meth, virtualPtrType, "", currentBlock);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp?rev=60103&r1=60102&r2=60103&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp Wed Nov 26 06:19:20 2008
@@ -142,20 +142,21 @@
}
#if JNJVM_EXECUTE > 1
{
- std::vector<llvm::Value*> args;
- args.push_back(ConstantExpr::getIntToPtr(
- ConstantInt::get(Type::Int64Ty, (int64_t)OpcodeNames[bytecodes[i]]),
- module->ptrType));
+ Value* args[3] = {
+ ConstantExpr::getIntToPtr(
+ ConstantInt::get(Type::Int64Ty, (int64_t)OpcodeNames[bytecodes[i]]),
+ module->ptrType),
- args.push_back(ConstantInt::get(Type::Int32Ty, (int64_t)i));
+ ConstantInt::get(Type::Int32Ty, (int64_t)i),
- args.push_back(ConstantExpr::getIntToPtr(
- ConstantInt::get(Type::Int64Ty, (int64_t)compilingMethod),
- module->ptrType));
+ ConstantExpr::getIntToPtr(
+ ConstantInt::get(Type::Int64Ty, (int64_t)compilingMethod),
+ module->ptrType)
+ };
- CallInst::Create(module->PrintExecutionFunction, args.begin(),
- args.end(), "", currentBlock);
+ CallInst::Create(module->PrintExecutionFunction, args, args + 3, "",
+ currentBlock);
}
#endif
@@ -1845,11 +1846,10 @@
valCl = module->getNativeClass(dcl);
valCl = new LoadInst(valCl, "", currentBlock);
#else
- std::vector<Value*> args;
- args.push_back(isolateLocal);
- args.push_back(ConstantInt::get(Type::Int32Ty, id - 4));
+ Value* args[2] = { isolateLocal,
+ ConstantInt::get(Type::Int32Ty, id - 4) };
valCl = CallInst::Create(module->GetJnjvmArrayClassFunction,
- args.begin(), args.end(), "", currentBlock);
+ args, args + 2, "", currentBlock);
#endif
LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[charId];
@@ -1875,16 +1875,15 @@
BranchInst::Create(BB1, BB2, cmp, currentBlock);
currentBlock = BB1;
- std::vector<Value*> exArgs;
- exArgs.push_back(arg1);
if (currentExceptionBlock != endExceptionBlock) {
+ Value* exArgs[1] = { arg1 };
InvokeInst::Create(module->NegativeArraySizeExceptionFunction,
unifiedUnreachable,
- currentExceptionBlock, exArgs.begin(),
- exArgs.end(), "", currentBlock);
+ currentExceptionBlock, exArgs, exArgs + 1,
+ "", currentBlock);
} else {
CallInst::Create(module->NegativeArraySizeExceptionFunction,
- exArgs.begin(), exArgs.end(), "", currentBlock);
+ arg1, "", currentBlock);
new UnreachableInst(currentBlock);
}
currentBlock = BB2;
@@ -1899,13 +1898,14 @@
BranchInst::Create(BB1, BB2, cmp, currentBlock);
currentBlock = BB1;
if (currentExceptionBlock != endExceptionBlock) {
+ Value* exArgs[1] = { arg1 };
InvokeInst::Create(module->OutOfMemoryErrorFunction,
unifiedUnreachable,
- currentExceptionBlock, exArgs.begin(),
- exArgs.end(), "", currentBlock);
+ currentExceptionBlock, exArgs, exArgs + 1,
+ "", currentBlock);
} else {
- CallInst::Create(module->OutOfMemoryErrorFunction,
- exArgs.begin(), exArgs.end(), "", currentBlock);
+ CallInst::Create(module->OutOfMemoryErrorFunction, arg1, "",
+ currentBlock);
new UnreachableInst(currentBlock);
}
currentBlock = BB2;
@@ -1915,36 +1915,29 @@
Value* size =
BinaryOperator::CreateAdd(module->JavaArraySizeConstant, mult,
"", currentBlock);
- std::vector<Value*> args;
- args.push_back(size);
- args.push_back(TheVT);
- Value* res = invoke(module->JavaObjectAllocateFunction, args, "",
+ Value* res = invoke(module->JavaObjectAllocateFunction, size, TheVT, "",
currentBlock);
Value* cast = new BitCastInst(res, module->JavaArrayType, "",
currentBlock);
// Set the size
- std::vector<Value*> gep4;
- gep4.push_back(module->constantZero);
- gep4.push_back(module->JavaArraySizeOffsetConstant);
- Value* GEP = GetElementPtrInst::Create(cast, gep4.begin(), gep4.end(),
+ Value* gep4[2] = { module->constantZero,
+ module->JavaArraySizeOffsetConstant };
+ Value* GEP = GetElementPtrInst::Create(cast, gep4, gep4 + 2,
"", currentBlock);
arg1 = new IntToPtrInst(arg1, module->ptrType, "", currentBlock);
new StoreInst(arg1, GEP, currentBlock);
// Set the class
- std::vector<Value*> gep;
- gep.push_back(module->constantZero);
- gep.push_back(module->JavaObjectClassOffsetConstant);
- GEP = GetElementPtrInst::Create(res, gep.begin(), gep.end(), "",
- currentBlock);
+ Value* gep[2] = { module->constantZero,
+ module->JavaObjectClassOffsetConstant };
+ GEP = GetElementPtrInst::Create(res, gep, gep + 2, "", currentBlock);
new StoreInst(valCl, GEP, currentBlock);
- gep.clear();
- gep.push_back(module->constantZero);
- gep.push_back(module->JavaObjectLockOffsetConstant);
- Value* lockPtr = GetElementPtrInst::Create(res, gep.begin(), gep.end(),
+ Value* gep1[2] = { module->constantZero,
+ module->JavaObjectLockOffsetConstant };
+ Value* lockPtr = GetElementPtrInst::Create(res, gep1, gep1 + 2,
"", currentBlock);
Value* threadId = CallInst::Create(module->llvm_frameaddress,
module->constantZero, "",
@@ -1973,16 +1966,15 @@
case ATHROW : {
llvm::Value* arg = pop();
- std::vector<Value*> args;
- args.push_back(arg);
if (currentExceptionBlock != endExceptionBlock) {
+ Value* args[1] = { arg };
InvokeInst::Create(module->ThrowExceptionFunction,
unifiedUnreachable,
- currentExceptionBlock, args.begin(), args.end(),
+ currentExceptionBlock, args, args + 1,
"", currentBlock);
} else {
- CallInst::Create(module->ThrowExceptionFunction, args.begin(),
- args.end(), "", currentBlock);
+ CallInst::Create(module->ThrowExceptionFunction, arg, "",
+ currentBlock);
new UnreachableInst(currentBlock);
}
break;
@@ -2004,27 +1996,20 @@
currentBlock = ifFalse;
Value* clVar = getResolvedClass(index, false);
- std::vector<Value*> args;
- args.push_back(obj);
- args.push_back(clVar);
- Value* call = CallInst::Create(module->InstanceOfFunction,
- args.begin(), args.end(),
- "", currentBlock);
+ Value* args[2] = { obj, clVar };
+ Value* call = CallInst::Create(module->InstanceOfFunction, args,
+ args + 2, "", currentBlock);
BasicBlock* ex = createBasicBlock("false checkcast");
BranchInst::Create(ifTrue, ex, call, currentBlock);
- std::vector<Value*> exArgs;
- exArgs.push_back(obj);
- exArgs.push_back(clVar);
if (currentExceptionBlock != endExceptionBlock) {
InvokeInst::Create(module->ClassCastExceptionFunction,
unifiedUnreachable,
- currentExceptionBlock, exArgs.begin(),
- exArgs.end(), "", ex);
+ currentExceptionBlock, args, args + 2, "", ex);
} else {
CallInst::Create(module->ClassCastExceptionFunction,
- exArgs.begin(), exArgs.end(), "", ex);
+ args, args + 2, "", ex);
new UnreachableInst(ex);
}
@@ -2036,12 +2021,9 @@
uint16 index = readU2(bytecodes, i);
Value* clVar = getResolvedClass(index, false);
- std::vector<Value*> args;
- args.push_back(pop());
- args.push_back(clVar);
+ Value* args[2] = { pop(), clVar };
Value* val = CallInst::Create(module->InstanceOfFunction,
- args.begin(), args.end(), "",
- currentBlock);
+ args, args + 2, "", currentBlock);
push(new ZExtInst(val, Type::Int32Ty, "", currentBlock),
false);
break;
Modified: vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp?rev=60103&r1=60102&r2=60103&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp Wed Nov 26 06:19:20 2008
@@ -65,11 +65,9 @@
#ifdef ISOLATE
static Value* getTCM(JnjvmModule* module, Value* Arg, Instruction* CI) {
- std::vector<Value*> GEP;
- GEP.push_back(module->constantZero);
- GEP.push_back(module->OffsetTaskClassMirrorInClassConstant);
- Value* TCMArray = GetElementPtrInst::Create(Arg, GEP.begin(), GEP.end(),
- "", CI);
+ Value* GEP[2] = { module->constantZero,
+ module->OffsetTaskClassMirrorInClassConstant };
+ Value* TCMArray = GetElementPtrInst::Create(Arg, GEP, GEP + 2, "", CI);
Value* threadId = CallInst::Create(module->llvm_frameaddress,
module->constantZero, "", CI);
@@ -79,16 +77,13 @@
threadId = new IntToPtrInst(threadId, module->ptr32Type, "", CI);
- GEP.clear();
- GEP.push_back(module->constantThree);
- Value* IsolateID = GetElementPtrInst::Create(threadId, GEP.begin(), GEP.end(),
+ Value* IsolateID = GetElementPtrInst::Create(threadId, module->constantThree,
"", CI);
IsolateID = new LoadInst(IsolateID, "", CI);
- GEP.clear();
- GEP.push_back(module->constantZero);
- GEP.push_back(IsolateID);
- Value* TCM = GetElementPtrInst::Create(TCMArray, GEP.begin(), GEP.end(), "",
+ Value* GEP2[2] = { module->constantZero, IsolateID };
+
+ Value* TCM = GetElementPtrInst::Create(TCMArray, GEP2, GEP2 + 2, "",
CI);
return TCM;
}
@@ -111,11 +106,10 @@
Value* val = Call.getArgument(0); // get the array
Value* array = new BitCastInst(val, module->JavaArrayType,
"", CI);
- std::vector<Value*> args; //size= 2
- args.push_back(mvm::MvmModule::constantZero);
- args.push_back(module->JavaArraySizeOffsetConstant);
- Value* ptr = GetElementPtrInst::Create(array, args.begin(), args.end(),
- "", CI);
+ Value* args[2] = { module->constantZero,
+ module->JavaArraySizeOffsetConstant };
+ Value* ptr = GetElementPtrInst::Create(array, args, args + 2,
+ "", CI);
Value* load = new LoadInst(ptr, "", CI);
load = new PtrToIntInst(load, Type::Int32Ty, "", CI);
CI->replaceAllUsesWith(load);
@@ -123,23 +117,19 @@
} else if (V == module->GetVTFunction) {
Changed = true;
Value* val = Call.getArgument(0); // get the object
- std::vector<Value*> indexes; //[3];
- indexes.push_back(mvm::MvmModule::constantZero);
- indexes.push_back(mvm::MvmModule::constantZero);
- Value* VTPtr = GetElementPtrInst::Create(val, indexes.begin(),
- indexes.end(), "", CI);
+ Value* indexes[2] = { module->constantZero, module->constantZero };
+ Value* VTPtr = GetElementPtrInst::Create(val, indexes, indexes + 2,
+ "", CI);
Value* VT = new LoadInst(VTPtr, "", CI);
CI->replaceAllUsesWith(VT);
CI->eraseFromParent();
} else if (V == module->GetClassFunction) {
Changed = true;
Value* val = Call.getArgument(0); // get the object
- std::vector<Value*> args2;
- args2.push_back(mvm::MvmModule::constantZero);
- args2.push_back(module->JavaObjectClassOffsetConstant);
- Value* classPtr = GetElementPtrInst::Create(val, args2.begin(),
- args2.end(), "",
- CI);
+ Value* args2[2] = { module->constantZero,
+ module->JavaObjectClassOffsetConstant };
+ Value* classPtr = GetElementPtrInst::Create(val, args2, args2 + 2,
+ "", CI);
Value* cl = new LoadInst(classPtr, "", CI);
CI->replaceAllUsesWith(cl);
CI->eraseFromParent();
@@ -160,11 +150,10 @@
}
Value* val = Call.getArgument(0);
- std::vector<Value*> indexes;
- indexes.push_back(mvm::MvmModule::constantZero);
- indexes.push_back(module->OffsetVTInClassConstant);
- Value* VTPtr = GetElementPtrInst::Create(val, indexes.begin(),
- indexes.end(), "", CI);
+ Value* indexes[2] = { module->constantZero,
+ module->OffsetVTInClassConstant };
+ Value* VTPtr = GetElementPtrInst::Create(val, indexes, indexes + 2,
+ "", CI);
Value* VT = new LoadInst(VTPtr, "", CI);
CI->replaceAllUsesWith(VT);
CI->eraseFromParent();
@@ -185,33 +174,30 @@
}
Value* val = Call.getArgument(0);
- std::vector<Value*> indexes;
- indexes.push_back(mvm::MvmModule::constantZero);
- indexes.push_back(module->OffsetObjectSizeInClassConstant);
- Value* SizePtr = GetElementPtrInst::Create(val, indexes.begin(),
- indexes.end(), "", CI);
+ Value* indexes[2] = { module->constantZero,
+ module->OffsetObjectSizeInClassConstant };
+ Value* SizePtr = GetElementPtrInst::Create(val, indexes, indexes + 2,
+ "", CI);
Value* Size = new LoadInst(SizePtr, "", CI);
CI->replaceAllUsesWith(Size);
CI->eraseFromParent();
} else if (V == module->GetDepthFunction) {
Changed = true;
Value* val = Call.getArgument(0);
- std::vector<Value*> indexes;
- indexes.push_back(mvm::MvmModule::constantZero);
- indexes.push_back(module->OffsetDepthInClassConstant);
- Value* DepthPtr = GetElementPtrInst::Create(val, indexes.begin(),
- indexes.end(), "", CI);
+ Value* indexes[2] = { module->constantZero,
+ module->OffsetDepthInClassConstant };
+ Value* DepthPtr = GetElementPtrInst::Create(val, indexes,
+ indexes + 2, "", CI);
Value* Depth = new LoadInst(DepthPtr, "", CI);
CI->replaceAllUsesWith(Depth);
CI->eraseFromParent();
} else if (V == module->GetDisplayFunction) {
Changed = true;
Value* val = Call.getArgument(0);
- std::vector<Value*> indexes;
- indexes.push_back(mvm::MvmModule::constantZero);
- indexes.push_back(module->OffsetDisplayInClassConstant);
- Value* DisplayPtr = GetElementPtrInst::Create(val, indexes.begin(),
- indexes.end(), "", CI);
+ Value* indexes[2] = { module->constantZero,
+ module->OffsetDisplayInClassConstant };
+ Value* DisplayPtr = GetElementPtrInst::Create(val, indexes,
+ indexes + 2, "", CI);
Value* Display = new LoadInst(DisplayPtr, "", CI);
CI->replaceAllUsesWith(Display);
CI->eraseFromParent();
@@ -244,12 +230,9 @@
"", ifFalse);
if (isInterface(cl->access)) {
- std::vector<Value*> args;
- args.push_back(objCl);
- args.push_back(CE);
+ Value* args[2] = { objCl, CE };
Value* res = CallInst::Create(module->ImplementsFunction,
- args.begin(), args.end(), "",
- ifFalse);
+ args, args + 2, "", ifFalse);
node->addIncoming(res, ifFalse);
BranchInst::Create(ifTrue, ifFalse);
} else {
@@ -259,20 +242,16 @@
node->addIncoming(ConstantInt::getTrue(), ifFalse);
if (cl->status < classRead) {
- std::vector<Value*> args;
- args.push_back(objCl);
- args.push_back(CE);
+ Value* args[2] = { objCl, CE };
cmp = CallInst::Create(module->IsAssignableFromFunction,
- args.begin(), args.end(), "", notEquals);
+ args, args + 2, "", notEquals);
node->addIncoming(cmp, notEquals);
BranchInst::Create(ifTrue, notEquals);
} else if (cl->isArray()) {
- std::vector<Value*> args;
- args.push_back(objCl);
- args.push_back(CE);
+ Value* args[2] = { objCl, CE };
Value* res =
CallInst::Create(module->InstantiationOfArrayFunction,
- args.begin(), args.end(), "", notEquals);
+ args, args + 2, "", notEquals);
node->addIncoming(res, notEquals);
BranchInst::Create(ifTrue, notEquals);
} else {
@@ -297,12 +276,10 @@
CallInst::Create(module->GetDisplayFunction, objCl,
"", supDepth);
- std::vector<Value*> args;
- args.push_back(inDisplay);
- args.push_back(depthCl);
+ Value* args[2] = { inDisplay, depthCl };
Value* clInDisplay =
CallInst::Create(module->GetClassInDisplayFunction,
- args.begin(), args.end(), "", supDepth);
+ args, args + 2, "", supDepth);
cmp = new ICmpInst(ICmpInst::ICMP_EQ, clInDisplay, CE, "",
supDepth);
@@ -331,11 +308,9 @@
#elif defined(ISOLATE)
Value* TCM = getTCM(module, Call.getArgument(0), CI);
- std::vector<Value*> GEP;
- GEP.push_back(module->constantZero);
- GEP.push_back(module->OffsetStaticInstanceInTaskClassMirrorConstant);
- Value* Replace = GetElementPtrInst::Create(TCM, GEP.begin(),
- GEP.end(), "", CI);
+ Constant* C = module->OffsetStaticInstanceInTaskClassMirrorConstant;
+ Value* GEP[2] = { module->constantZero, C };
+ Value* Replace = GetElementPtrInst::Create(TCM, GEP, GEP + 2, "", CI);
Replace = new LoadInst(Replace, "", CI);
CI->replaceAllUsesWith(Replace);
CI->eraseFromParent();
@@ -358,19 +333,17 @@
Value* Cl = Call.getArgument(0);
#if !defined(ISOLATE)
- std::vector<Value*> indexes;
- indexes.push_back(mvm::MvmModule::constantZero);
- indexes.push_back(module->OffsetStatusInClassConstant);
- Value* StatusPtr = GetElementPtrInst::Create(Cl, indexes.begin(),
- indexes.end(), "", CI);
+ Value* indexes[2] = { module->constantZero,
+ module->OffsetStatusInClassConstant };
+ Value* StatusPtr = GetElementPtrInst::Create(Cl, indexes,
+ indexes + 2, "", CI);
#else
Value* TCM = getTCM(module, Call.getArgument(0), CI);
- std::vector<Value*> GEP;
- GEP.push_back(module->constantZero);
- GEP.push_back(module->OffsetStatusInTaskClassMirrorConstant);
- Value* StatusPtr = GetElementPtrInst::Create(TCM, GEP.begin(),
- GEP.end(), "", CI);
+ Value* GEP[2] = { module->constantZero,
+ module->OffsetStatusInTaskClassMirrorConstant };
+ Value* StatusPtr = GetElementPtrInst::Create(TCM, GEP, GEP + 2, "",
+ CI);
#endif
Value* Status = new LoadInst(StatusPtr, "", CI);
@@ -385,15 +358,14 @@
node->addIncoming(Cl, CI->getParent());
BranchInst::Create(trueCl, falseCl, test, CI);
- std::vector<Value*> Args;
- Args.push_back(Cl);
Value* res = 0;
if (InvokeInst* Invoke = dyn_cast<InvokeInst>(CI)) {
+ Value* Args[1] = { Cl };
BasicBlock* UI = Invoke->getUnwindDest();
res = InvokeInst::Create(module->InitialiseClassFunction,
- trueCl, UI, Args.begin(),
- Args.end(), "", falseCl);
+ trueCl, UI, Args, Args + 1,
+ "", falseCl);
// For some reason, an LLVM pass may add PHI nodes to the
// exception destination.
@@ -416,8 +388,7 @@
}
} else {
res = CallInst::Create(module->InitialiseClassFunction,
- Args.begin(), Args.end(), "",
- falseCl);
+ Cl, "", falseCl);
BranchInst::Create(trueCl, falseCl);
}
@@ -445,17 +416,15 @@
NBB = Invoke->getNormalDest();
}
- std::vector<Value*> indexes; //[3];
#ifdef ISOLATE_SHARING
ConstantInt* Cons = dyn_cast<ConstantInt>(Index);
assert(CI && "Wrong use of GetConstantPoolAt");
uint64 val = Cons->getZExtValue();
- indexes.push_back(ConstantInt::get(Type::Int32Ty, val + 1));
+ Value* indexes = ConstantInt::get(Type::Int32Ty, val + 1);
#else
- indexes.push_back(Index);
+ Value* indexes = Index;
#endif
- Value* arg1 = GetElementPtrInst::Create(CTP, indexes.begin(),
- indexes.end(), "", CI);
+ Value* arg1 = GetElementPtrInst::Create(CTP, indexes, "", CI);
arg1 = new LoadInst(arg1, "", false, CI);
Value* test = new ICmpInst(ICmpInst::ICMP_EQ, arg1,
mvm::MvmModule::constantPtrNull, "", CI);
@@ -571,22 +540,19 @@
else if (V == module->GetCtpClassFunction) {
Changed = true;
Value* val = Call.getArgument(0);
- std::vector<Value*> indexes;
- indexes.push_back(mvm::MvmModule::constantZero);
- indexes.push_back(module->OffsetCtpInClassConstant);
- Value* VTPtr = GetElementPtrInst::Create(val, indexes.begin(),
- indexes.end(), "", CI);
+ Value* indexes[2] = { module->constantZero,
+ module->OffsetCtpInClassConstant };
+ Value* VTPtr = GetElementPtrInst::Create(val, indexes,
+ indexes + 2, "", CI);
Value* VT = new LoadInst(VTPtr, "", CI);
CI->replaceAllUsesWith(VT);
CI->eraseFromParent();
} else if (V == module->GetCtpCacheNodeFunction) {
Changed = true;
Value* val = Call.getArgument(0);
- std::vector<Value*> indexes;
- indexes.push_back(mvm::MvmModule::constantZero);
- indexes.push_back(mvm::MvmModule::constantFour);
- Value* VTPtr = GetElementPtrInst::Create(val, indexes.begin(),
- indexes.end(), "", CI);
+ Value* indexes[2] = { module->constantZero, module->constantFour };
+ Value* VTPtr = GetElementPtrInst::Create(val, indexes,
+ indexes + 2, "", CI);
Value* VT = new LoadInst(VTPtr, "", CI);
CI->replaceAllUsesWith(VT);
CI->eraseFromParent();
@@ -594,23 +560,19 @@
Changed = true;
Value* val = Call.getArgument(0);
Value* index = Call.getArgument(1);
- std::vector<Value*> indexes;
- indexes.push_back(mvm::MvmModule::constantZero);
- indexes.push_back(mvm::MvmModule::constantTwo);
- indexes.push_back(index);
- Value* VTPtr = GetElementPtrInst::Create(val, indexes.begin(),
- indexes.end(), "", CI);
+ Value* indexes[3] = { module->constantZero, module->constantTwo,
+ index };
+ Value* VTPtr = GetElementPtrInst::Create(val, indexes, indexes + 3,
+ "", CI);
Value* VT = new LoadInst(VTPtr, "", CI);
CI->replaceAllUsesWith(VT);
CI->eraseFromParent();
} else if (V == module->GetJnjvmExceptionClassFunction) {
Changed = true;
Value* val = Call.getArgument(0);
- std::vector<Value*> indexes;
- indexes.push_back(mvm::MvmModule::constantZero);
- indexes.push_back(mvm::MvmModule::constantOne);
- Value* VTPtr = GetElementPtrInst::Create(val, indexes.begin(),
- indexes.end(), "", CI);
+ Value* indexes[2] = { module->constantZero, module->constantOne };
+ Value* VTPtr = GetElementPtrInst::Create(val, indexes, indexes + 2,
+ "", CI);
Value* VT = new LoadInst(VTPtr, "", CI);
CI->replaceAllUsesWith(VT);
CI->eraseFromParent();
More information about the vmkit-commits
mailing list