[vmkit-commits] [vmkit] r96749 - in /vmkit/trunk: include/j3/J3Intrinsics.h include/mvm/JIT.h lib/J3/Compiler/ExceptionsCheck.inc lib/J3/Compiler/J3Intrinsics.cpp lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/Compiler/LLVMInfo.cpp lib/J3/Compiler/LowerConstantCalls.cpp lib/Mvm/Compiler/JIT.cpp lib/N3/Mono/MonoString.cpp lib/N3/VMCore/CLIJitMeta.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sun Feb 21 11:32:50 PST 2010
Author: geoffray
Date: Sun Feb 21 13:32:50 2010
New Revision: 96749
URL: http://llvm.org/viewvc/llvm-project?rev=96749&view=rev
Log:
Remove static types, and make them local to intrinsics.
Modified:
vmkit/trunk/include/j3/J3Intrinsics.h
vmkit/trunk/include/mvm/JIT.h
vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc
vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp
vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp
vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp
vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp
vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
vmkit/trunk/lib/N3/Mono/MonoString.cpp
vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp
Modified: vmkit/trunk/include/j3/J3Intrinsics.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/J3Intrinsics.h?rev=96749&r1=96748&r2=96749&view=diff
==============================================================================
--- vmkit/trunk/include/j3/J3Intrinsics.h (original)
+++ vmkit/trunk/include/j3/J3Intrinsics.h Sun Feb 21 13:32:50 2010
@@ -17,35 +17,35 @@
class J3Intrinsics : public mvm::BaseIntrinsics {
public:
- static const llvm::Type* JavaArrayUInt8Type;
- static const llvm::Type* JavaArraySInt8Type;
- static const llvm::Type* JavaArrayUInt16Type;
- static const llvm::Type* JavaArraySInt16Type;
- static const llvm::Type* JavaArrayUInt32Type;
- static const llvm::Type* JavaArraySInt32Type;
- static const llvm::Type* JavaArrayLongType;
- static const llvm::Type* JavaArrayFloatType;
- static const llvm::Type* JavaArrayDoubleType;
- static const llvm::Type* JavaArrayObjectType;
-
- static const llvm::Type* VTType;
- static const llvm::Type* JavaObjectType;
- static const llvm::Type* JavaArrayType;
- static const llvm::Type* JavaCommonClassType;
- static const llvm::Type* JavaClassType;
- static const llvm::Type* JavaClassArrayType;
- static const llvm::Type* JavaClassPrimitiveType;
- static const llvm::Type* ConstantPoolType;
- static const llvm::Type* CodeLineInfoType;
- static const llvm::Type* UTF8Type;
- static const llvm::Type* JavaMethodType;
- static const llvm::Type* JavaFieldType;
- static const llvm::Type* AttributType;
- static const llvm::Type* JavaThreadType;
- static const llvm::Type* MutatorThreadType;
+ const llvm::Type* JavaArrayUInt8Type;
+ const llvm::Type* JavaArraySInt8Type;
+ const llvm::Type* JavaArrayUInt16Type;
+ const llvm::Type* JavaArraySInt16Type;
+ const llvm::Type* JavaArrayUInt32Type;
+ const llvm::Type* JavaArraySInt32Type;
+ const llvm::Type* JavaArrayLongType;
+ const llvm::Type* JavaArrayFloatType;
+ const llvm::Type* JavaArrayDoubleType;
+ const llvm::Type* JavaArrayObjectType;
+
+ const llvm::Type* VTType;
+ const llvm::Type* JavaObjectType;
+ const llvm::Type* JavaArrayType;
+ const llvm::Type* JavaCommonClassType;
+ const llvm::Type* JavaClassType;
+ const llvm::Type* JavaClassArrayType;
+ const llvm::Type* JavaClassPrimitiveType;
+ const llvm::Type* ConstantPoolType;
+ const llvm::Type* CodeLineInfoType;
+ const llvm::Type* UTF8Type;
+ const llvm::Type* JavaMethodType;
+ const llvm::Type* JavaFieldType;
+ const llvm::Type* AttributType;
+ const llvm::Type* JavaThreadType;
+ const llvm::Type* MutatorThreadType;
#ifdef ISOLATE_SHARING
- static const llvm::Type* JnjvmType;
+ const llvm::Type* JnjvmType;
#endif
llvm::Function* EmptyTracerFunction;
Modified: vmkit/trunk/include/mvm/JIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/JIT.h?rev=96749&r1=96748&r2=96749&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/JIT.h (original)
+++ vmkit/trunk/include/mvm/JIT.h Sun Feb 21 13:32:50 2010
@@ -122,56 +122,56 @@
llvm::Function* AllocateUnresolvedFunction;
llvm::Function* AddFinalizationCandidate;
- llvm::Constant* constantInt8Zero;
- llvm::Constant* constantZero;
- llvm::Constant* constantOne;
- llvm::Constant* constantTwo;
- llvm::Constant* constantThree;
- llvm::Constant* constantFour;
- llvm::Constant* constantFive;
- llvm::Constant* constantSix;
- llvm::Constant* constantSeven;
- llvm::Constant* constantEight;
- llvm::Constant* constantMinusOne;
- llvm::Constant* constantLongMinusOne;
- llvm::Constant* constantLongZero;
- llvm::Constant* constantLongOne;
- llvm::Constant* constantMinInt;
- llvm::Constant* constantMaxInt;
- llvm::Constant* constantMinLong;
- llvm::Constant* constantMaxLong;
- llvm::Constant* constantFloatZero;
- llvm::Constant* constantFloatOne;
- llvm::Constant* constantFloatTwo;
- llvm::Constant* constantDoubleZero;
- llvm::Constant* constantDoubleOne;
- llvm::Constant* constantMaxIntFloat;
- llvm::Constant* constantMinIntFloat;
- llvm::Constant* constantMinLongFloat;
- llvm::Constant* constantMinLongDouble;
- llvm::Constant* constantMaxLongFloat;
- llvm::Constant* constantMaxIntDouble;
- llvm::Constant* constantMinIntDouble;
- llvm::Constant* constantMaxLongDouble;
- llvm::Constant* constantDoubleInfinity;
- llvm::Constant* constantDoubleMinusInfinity;
- llvm::Constant* constantFloatInfinity;
- llvm::Constant* constantFloatMinusInfinity;
- llvm::Constant* constantFloatMinusZero;
- llvm::Constant* constantDoubleMinusZero;
- llvm::Constant* constantPtrNull;
- llvm::Constant* constantPtrLogSize;
- llvm::Constant* constantThreadIDMask;
- llvm::Constant* constantStackOverflowMask;
- llvm::Constant* constantFatMask;
- llvm::Constant* constantPtrOne;
- llvm::Constant* constantPtrZero;
+ llvm::Constant* constantInt8Zero;
+ llvm::Constant* constantZero;
+ llvm::Constant* constantOne;
+ llvm::Constant* constantTwo;
+ llvm::Constant* constantThree;
+ llvm::Constant* constantFour;
+ llvm::Constant* constantFive;
+ llvm::Constant* constantSix;
+ llvm::Constant* constantSeven;
+ llvm::Constant* constantEight;
+ llvm::Constant* constantMinusOne;
+ llvm::Constant* constantLongMinusOne;
+ llvm::Constant* constantLongZero;
+ llvm::Constant* constantLongOne;
+ llvm::Constant* constantMinInt;
+ llvm::Constant* constantMaxInt;
+ llvm::Constant* constantMinLong;
+ llvm::Constant* constantMaxLong;
+ llvm::Constant* constantFloatZero;
+ llvm::Constant* constantFloatOne;
+ llvm::Constant* constantFloatTwo;
+ llvm::Constant* constantDoubleZero;
+ llvm::Constant* constantDoubleOne;
+ llvm::Constant* constantMaxIntFloat;
+ llvm::Constant* constantMinIntFloat;
+ llvm::Constant* constantMinLongFloat;
+ llvm::Constant* constantMinLongDouble;
+ llvm::Constant* constantMaxLongFloat;
+ llvm::Constant* constantMaxIntDouble;
+ llvm::Constant* constantMinIntDouble;
+ llvm::Constant* constantMaxLongDouble;
+ llvm::Constant* constantDoubleInfinity;
+ llvm::Constant* constantDoubleMinusInfinity;
+ llvm::Constant* constantFloatInfinity;
+ llvm::Constant* constantFloatMinusInfinity;
+ llvm::Constant* constantFloatMinusZero;
+ llvm::Constant* constantDoubleMinusZero;
+ llvm::Constant* constantPtrNull;
+ llvm::Constant* constantPtrLogSize;
+ llvm::Constant* constantThreadIDMask;
+ llvm::Constant* constantStackOverflowMask;
+ llvm::Constant* constantFatMask;
+ llvm::Constant* constantPtrOne;
+ llvm::Constant* constantPtrZero;
- static const llvm::PointerType* ptrType;
- static const llvm::PointerType* ptr32Type;
- static const llvm::PointerType* ptrPtrType;
- static const llvm::Type* arrayPtrType;
- static const llvm::Type* pointerSizeType;
+ const llvm::PointerType* ptrType;
+ const llvm::PointerType* ptr32Type;
+ const llvm::PointerType* ptrPtrType;
+ const llvm::Type* arrayPtrType;
+ const llvm::Type* pointerSizeType;
};
Modified: vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc?rev=96749&r1=96748&r2=96749&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc (original)
+++ vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc Sun Feb 21 13:32:50 2010
@@ -343,7 +343,7 @@
ex->tester = createBasicBlock("testException");
// PHI Node for the exception object
- PHINode::Create(J3Intrinsics::JavaObjectType, "", ex->tester);
+ PHINode::Create(intrinsics->JavaObjectType, "", ex->tester);
// Set the unwind destination of the instructions in the range of this
// handler to the test block of the handler. If an instruction already has
@@ -365,7 +365,7 @@
opcodeInfos[ex->handlerpc].handler = true;
if (ex->javaHandler->empty()) {
- PHINode::Create(J3Intrinsics::JavaObjectType, "", ex->javaHandler);
+ PHINode::Create(intrinsics->JavaObjectType, "", ex->javaHandler);
}
}
Modified: vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp?rev=96749&r1=96748&r2=96749&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp Sun Feb 21 13:32:50 2010
@@ -17,6 +17,7 @@
#include "JavaAccess.h"
#include "JavaArray.h"
#include "JavaClass.h"
+#include "JavaTypes.h"
#include "j3/J3Intrinsics.h"
#include "j3/LLVMInfo.h"
@@ -24,120 +25,85 @@
using namespace j3;
using namespace llvm;
-const llvm::Type* J3Intrinsics::JavaObjectType = 0;
-const llvm::Type* J3Intrinsics::JavaArrayType = 0;
-const llvm::Type* J3Intrinsics::JavaArrayUInt8Type = 0;
-const llvm::Type* J3Intrinsics::JavaArraySInt8Type = 0;
-const llvm::Type* J3Intrinsics::JavaArrayUInt16Type = 0;
-const llvm::Type* J3Intrinsics::JavaArraySInt16Type = 0;
-const llvm::Type* J3Intrinsics::JavaArrayUInt32Type = 0;
-const llvm::Type* J3Intrinsics::JavaArraySInt32Type = 0;
-const llvm::Type* J3Intrinsics::JavaArrayFloatType = 0;
-const llvm::Type* J3Intrinsics::JavaArrayDoubleType = 0;
-const llvm::Type* J3Intrinsics::JavaArrayLongType = 0;
-const llvm::Type* J3Intrinsics::JavaArrayObjectType = 0;
-const llvm::Type* J3Intrinsics::CodeLineInfoType = 0;
-const llvm::Type* J3Intrinsics::ConstantPoolType = 0;
-const llvm::Type* J3Intrinsics::UTF8Type = 0;
-const llvm::Type* J3Intrinsics::JavaFieldType = 0;
-const llvm::Type* J3Intrinsics::JavaMethodType = 0;
-const llvm::Type* J3Intrinsics::AttributType = 0;
-const llvm::Type* J3Intrinsics::JavaThreadType = 0;
-const llvm::Type* J3Intrinsics::MutatorThreadType = 0;
-
-#ifdef ISOLATE_SHARING
-const llvm::Type* J3Intrinsics::JnjvmType = 0;
-#endif
-
-const llvm::Type* J3Intrinsics::JavaClassType;
-const llvm::Type* J3Intrinsics::JavaClassPrimitiveType;
-const llvm::Type* J3Intrinsics::JavaClassArrayType;
-const llvm::Type* J3Intrinsics::JavaCommonClassType;
-const llvm::Type* J3Intrinsics::VTType;
-
-
namespace j3 {
namespace llvm_runtime {
#include "LLVMRuntime.inc"
}
}
-void J3Intrinsics::initialise() {
- Module* module = mvm::MvmModule::globalModule;
+J3Intrinsics::J3Intrinsics(llvm::Module* module) :
+ BaseIntrinsics(module) {
- if (!module->getTypeByName("JavaThread"))
- j3::llvm_runtime::makeLLVMModuleContents(module);
+ llvm::Module* globalModule = mvm::MvmModule::globalModule;
- VTType = PointerType::getUnqual(module->getTypeByName("VT"));
+ if (!globalModule->getTypeByName("JavaThread")) {
+ j3::llvm_runtime::makeLLVMModuleContents(globalModule);
+ mvm::MvmModule::copyDefinitions(module, mvm::MvmModule::globalModule);
+ }
+
+ if (!(LLVMAssessorInfo::AssessorInfo[I_VOID].llvmType)) {
+ LLVMAssessorInfo::initialise();
+ }
+
+ VTType = PointerType::getUnqual(globalModule->getTypeByName("VT"));
#ifdef ISOLATE_SHARING
JnjvmType =
- PointerType::getUnqual(module->getTypeByName("Jnjvm"));
+ PointerType::getUnqual(globalModule->getTypeByName("Jnjvm"));
#endif
ConstantPoolType = ptrPtrType;
JavaObjectType =
- PointerType::getUnqual(module->getTypeByName("JavaObject"));
+ PointerType::getUnqual(globalModule->getTypeByName("JavaObject"));
JavaArrayType =
- PointerType::getUnqual(module->getTypeByName("JavaArray"));
+ PointerType::getUnqual(globalModule->getTypeByName("JavaArray"));
JavaCommonClassType =
- PointerType::getUnqual(module->getTypeByName("JavaCommonClass"));
+ PointerType::getUnqual(globalModule->getTypeByName("JavaCommonClass"));
JavaClassPrimitiveType =
- PointerType::getUnqual(module->getTypeByName("JavaClassPrimitive"));
+ PointerType::getUnqual(globalModule->getTypeByName("JavaClassPrimitive"));
JavaClassArrayType =
- PointerType::getUnqual(module->getTypeByName("JavaClassArray"));
+ PointerType::getUnqual(globalModule->getTypeByName("JavaClassArray"));
JavaClassType =
- PointerType::getUnqual(module->getTypeByName("JavaClass"));
+ PointerType::getUnqual(globalModule->getTypeByName("JavaClass"));
JavaArrayUInt8Type =
- PointerType::getUnqual(module->getTypeByName("ArrayUInt8"));
+ PointerType::getUnqual(globalModule->getTypeByName("ArrayUInt8"));
JavaArraySInt8Type =
- PointerType::getUnqual(module->getTypeByName("ArraySInt8"));
+ PointerType::getUnqual(globalModule->getTypeByName("ArraySInt8"));
JavaArrayUInt16Type =
- PointerType::getUnqual(module->getTypeByName("ArrayUInt16"));
+ PointerType::getUnqual(globalModule->getTypeByName("ArrayUInt16"));
JavaArraySInt16Type =
- PointerType::getUnqual(module->getTypeByName("ArraySInt16"));
+ PointerType::getUnqual(globalModule->getTypeByName("ArraySInt16"));
JavaArrayUInt32Type =
- PointerType::getUnqual(module->getTypeByName("ArrayUInt32"));
+ PointerType::getUnqual(globalModule->getTypeByName("ArrayUInt32"));
JavaArraySInt32Type =
- PointerType::getUnqual(module->getTypeByName("ArraySInt32"));
+ PointerType::getUnqual(globalModule->getTypeByName("ArraySInt32"));
JavaArrayLongType =
- PointerType::getUnqual(module->getTypeByName("ArrayLong"));
+ PointerType::getUnqual(globalModule->getTypeByName("ArrayLong"));
JavaArrayFloatType =
- PointerType::getUnqual(module->getTypeByName("ArrayFloat"));
+ PointerType::getUnqual(globalModule->getTypeByName("ArrayFloat"));
JavaArrayDoubleType =
- PointerType::getUnqual(module->getTypeByName("ArrayDouble"));
+ PointerType::getUnqual(globalModule->getTypeByName("ArrayDouble"));
JavaArrayObjectType =
- PointerType::getUnqual(module->getTypeByName("ArrayObject"));
+ PointerType::getUnqual(globalModule->getTypeByName("ArrayObject"));
JavaFieldType =
- PointerType::getUnqual(module->getTypeByName("JavaField"));
+ PointerType::getUnqual(globalModule->getTypeByName("JavaField"));
JavaMethodType =
- PointerType::getUnqual(module->getTypeByName("JavaMethod"));
+ PointerType::getUnqual(globalModule->getTypeByName("JavaMethod"));
UTF8Type =
- PointerType::getUnqual(module->getTypeByName("UTF8"));
+ PointerType::getUnqual(globalModule->getTypeByName("UTF8"));
AttributType =
- PointerType::getUnqual(module->getTypeByName("Attribut"));
+ PointerType::getUnqual(globalModule->getTypeByName("Attribut"));
JavaThreadType =
- PointerType::getUnqual(module->getTypeByName("JavaThread"));
+ PointerType::getUnqual(globalModule->getTypeByName("JavaThread"));
MutatorThreadType =
- PointerType::getUnqual(module->getTypeByName("MutatorThread"));
+ PointerType::getUnqual(globalModule->getTypeByName("MutatorThread"));
CodeLineInfoType =
- PointerType::getUnqual(module->getTypeByName("CodeLineInfo"));
-
- LLVMAssessorInfo::initialise();
-}
-
-J3Intrinsics::J3Intrinsics(llvm::Module* module) :
- BaseIntrinsics(module) {
-
- if (!VTType) {
- initialise();
- mvm::MvmModule::copyDefinitions(module, mvm::MvmModule::globalModule);
- }
+ PointerType::getUnqual(globalModule->getTypeByName("CodeLineInfo"));
JavaObjectNullConstant =
Constant::getNullValue(J3Intrinsics::JavaObjectType);
@@ -193,122 +159,122 @@
ClassReadyConstant =
ConstantInt::get(Type::getInt8Ty(getGlobalContext()), ready);
- module->addTypeName("JavaObject", JavaObjectType->getContainedType(0));
- module->addTypeName("JavaArray", JavaArrayType->getContainedType(0));
- module->addTypeName("JavaCommonClass",
+ globalModule->addTypeName("JavaObject", JavaObjectType->getContainedType(0));
+ globalModule->addTypeName("JavaArray", JavaArrayType->getContainedType(0));
+ globalModule->addTypeName("JavaCommonClass",
JavaCommonClassType->getContainedType(0));
- module->addTypeName("JavaClass", JavaClassType->getContainedType(0));
- module->addTypeName("JavaClassPrimitive",
+ globalModule->addTypeName("JavaClass", JavaClassType->getContainedType(0));
+ globalModule->addTypeName("JavaClassPrimitive",
JavaClassPrimitiveType->getContainedType(0));
- module->addTypeName("JavaClassArray",
+ globalModule->addTypeName("JavaClassArray",
JavaClassArrayType->getContainedType(0));
- module->addTypeName("ArrayUInt8", JavaArrayUInt8Type->getContainedType(0));
- module->addTypeName("ArraySInt8", JavaArraySInt8Type->getContainedType(0));
- module->addTypeName("ArrayUInt16", JavaArrayUInt16Type->getContainedType(0));
- module->addTypeName("ArraySInt16", JavaArraySInt16Type->getContainedType(0));
- module->addTypeName("ArraySInt32", JavaArraySInt32Type->getContainedType(0));
- module->addTypeName("ArrayLong", JavaArrayLongType->getContainedType(0));
- module->addTypeName("ArrayFloat", JavaArrayFloatType->getContainedType(0));
- module->addTypeName("ArrayDouble", JavaArrayDoubleType->getContainedType(0));
- module->addTypeName("ArrayObject", JavaArrayObjectType->getContainedType(0));
+ globalModule->addTypeName("ArrayUInt8", JavaArrayUInt8Type->getContainedType(0));
+ globalModule->addTypeName("ArraySInt8", JavaArraySInt8Type->getContainedType(0));
+ globalModule->addTypeName("ArrayUInt16", JavaArrayUInt16Type->getContainedType(0));
+ globalModule->addTypeName("ArraySInt16", JavaArraySInt16Type->getContainedType(0));
+ globalModule->addTypeName("ArraySInt32", JavaArraySInt32Type->getContainedType(0));
+ globalModule->addTypeName("ArrayLong", JavaArrayLongType->getContainedType(0));
+ globalModule->addTypeName("ArrayFloat", JavaArrayFloatType->getContainedType(0));
+ globalModule->addTypeName("ArrayDouble", JavaArrayDoubleType->getContainedType(0));
+ globalModule->addTypeName("ArrayObject", JavaArrayObjectType->getContainedType(0));
- InterfaceLookupFunction = module->getFunction("j3InterfaceLookup");
- MultiCallNewFunction = module->getFunction("j3MultiCallNew");
- ForceLoadedCheckFunction = module->getFunction("forceLoadedCheck");
- InitialisationCheckFunction = module->getFunction("initialisationCheck");
+ InterfaceLookupFunction = globalModule->getFunction("j3InterfaceLookup");
+ MultiCallNewFunction = globalModule->getFunction("j3MultiCallNew");
+ ForceLoadedCheckFunction = globalModule->getFunction("forceLoadedCheck");
+ InitialisationCheckFunction = globalModule->getFunction("initialisationCheck");
ForceInitialisationCheckFunction =
- module->getFunction("forceInitialisationCheck");
- InitialiseClassFunction = module->getFunction("j3RuntimeInitialiseClass");
+ globalModule->getFunction("forceInitialisationCheck");
+ InitialiseClassFunction = globalModule->getFunction("j3RuntimeInitialiseClass");
- GetConstantPoolAtFunction = module->getFunction("getConstantPoolAt");
- ArrayLengthFunction = module->getFunction("arrayLength");
- GetVTFunction = module->getFunction("getVT");
- GetIMTFunction = module->getFunction("getIMT");
- GetClassFunction = module->getFunction("getClass");
- ClassLookupFunction = module->getFunction("j3ClassLookup");
- GetVTFromClassFunction = module->getFunction("getVTFromClass");
- GetVTFromClassArrayFunction = module->getFunction("getVTFromClassArray");
- GetVTFromCommonClassFunction = module->getFunction("getVTFromCommonClass");
- GetBaseClassVTFromVTFunction = module->getFunction("getBaseClassVTFromVT");
+ GetConstantPoolAtFunction = globalModule->getFunction("getConstantPoolAt");
+ ArrayLengthFunction = globalModule->getFunction("arrayLength");
+ GetVTFunction = globalModule->getFunction("getVT");
+ GetIMTFunction = globalModule->getFunction("getIMT");
+ GetClassFunction = globalModule->getFunction("getClass");
+ ClassLookupFunction = globalModule->getFunction("j3ClassLookup");
+ GetVTFromClassFunction = globalModule->getFunction("getVTFromClass");
+ GetVTFromClassArrayFunction = globalModule->getFunction("getVTFromClassArray");
+ GetVTFromCommonClassFunction = globalModule->getFunction("getVTFromCommonClass");
+ GetBaseClassVTFromVTFunction = globalModule->getFunction("getBaseClassVTFromVT");
GetObjectSizeFromClassFunction =
- module->getFunction("getObjectSizeFromClass");
+ globalModule->getFunction("getObjectSizeFromClass");
- GetClassDelegateeFunction = module->getFunction("getClassDelegatee");
- RuntimeDelegateeFunction = module->getFunction("j3RuntimeDelegatee");
- IsAssignableFromFunction = module->getFunction("isAssignableFrom");
- IsSecondaryClassFunction = module->getFunction("isSecondaryClass");
- GetDepthFunction = module->getFunction("getDepth");
- GetStaticInstanceFunction = module->getFunction("getStaticInstance");
- GetDisplayFunction = module->getFunction("getDisplay");
- GetVTInDisplayFunction = module->getFunction("getVTInDisplay");
- AquireObjectFunction = module->getFunction("j3JavaObjectAquire");
- ReleaseObjectFunction = module->getFunction("j3JavaObjectRelease");
- OverflowThinLockFunction = module->getFunction("j3OverflowThinLock");
-
- VirtualFieldLookupFunction = module->getFunction("j3VirtualFieldLookup");
- StaticFieldLookupFunction = module->getFunction("j3StaticFieldLookup");
- StringLookupFunction = module->getFunction("j3StringLookup");
- StartJNIFunction = module->getFunction("j3StartJNI");
- EndJNIFunction = module->getFunction("j3EndJNI");
-
- ResolveVirtualStubFunction = module->getFunction("j3ResolveVirtualStub");
- ResolveStaticStubFunction = module->getFunction("j3ResolveStaticStub");
- ResolveSpecialStubFunction = module->getFunction("j3ResolveSpecialStub");
+ GetClassDelegateeFunction = globalModule->getFunction("getClassDelegatee");
+ RuntimeDelegateeFunction = globalModule->getFunction("j3RuntimeDelegatee");
+ IsAssignableFromFunction = globalModule->getFunction("isAssignableFrom");
+ IsSecondaryClassFunction = globalModule->getFunction("isSecondaryClass");
+ GetDepthFunction = globalModule->getFunction("getDepth");
+ GetStaticInstanceFunction = globalModule->getFunction("getStaticInstance");
+ GetDisplayFunction = globalModule->getFunction("getDisplay");
+ GetVTInDisplayFunction = globalModule->getFunction("getVTInDisplay");
+ AquireObjectFunction = globalModule->getFunction("j3JavaObjectAquire");
+ ReleaseObjectFunction = globalModule->getFunction("j3JavaObjectRelease");
+ OverflowThinLockFunction = globalModule->getFunction("j3OverflowThinLock");
+
+ VirtualFieldLookupFunction = globalModule->getFunction("j3VirtualFieldLookup");
+ StaticFieldLookupFunction = globalModule->getFunction("j3StaticFieldLookup");
+ StringLookupFunction = globalModule->getFunction("j3StringLookup");
+ StartJNIFunction = globalModule->getFunction("j3StartJNI");
+ EndJNIFunction = globalModule->getFunction("j3EndJNI");
+
+ ResolveVirtualStubFunction = globalModule->getFunction("j3ResolveVirtualStub");
+ ResolveStaticStubFunction = globalModule->getFunction("j3ResolveStaticStub");
+ ResolveSpecialStubFunction = globalModule->getFunction("j3ResolveSpecialStub");
NullPointerExceptionFunction =
- module->getFunction("j3NullPointerException");
- ClassCastExceptionFunction = module->getFunction("j3ClassCastException");
+ globalModule->getFunction("j3NullPointerException");
+ ClassCastExceptionFunction = globalModule->getFunction("j3ClassCastException");
IndexOutOfBoundsExceptionFunction =
- module->getFunction("j3IndexOutOfBoundsException");
+ globalModule->getFunction("j3IndexOutOfBoundsException");
NegativeArraySizeExceptionFunction =
- module->getFunction("j3NegativeArraySizeException");
- OutOfMemoryErrorFunction = module->getFunction("j3OutOfMemoryError");
- StackOverflowErrorFunction = module->getFunction("j3StackOverflowError");
- ArrayStoreExceptionFunction = module->getFunction("j3ArrayStoreException");
- ArithmeticExceptionFunction = module->getFunction("j3ArithmeticException");
-
- PrintExecutionFunction = module->getFunction("j3PrintExecution");
- PrintMethodStartFunction = module->getFunction("j3PrintMethodStart");
- PrintMethodEndFunction = module->getFunction("j3PrintMethodEnd");
+ globalModule->getFunction("j3NegativeArraySizeException");
+ OutOfMemoryErrorFunction = globalModule->getFunction("j3OutOfMemoryError");
+ StackOverflowErrorFunction = globalModule->getFunction("j3StackOverflowError");
+ ArrayStoreExceptionFunction = globalModule->getFunction("j3ArrayStoreException");
+ ArithmeticExceptionFunction = globalModule->getFunction("j3ArithmeticException");
+
+ PrintExecutionFunction = globalModule->getFunction("j3PrintExecution");
+ PrintMethodStartFunction = globalModule->getFunction("j3PrintMethodStart");
+ PrintMethodEndFunction = globalModule->getFunction("j3PrintMethodEnd");
- ThrowExceptionFunction = module->getFunction("j3ThrowException");
+ ThrowExceptionFunction = globalModule->getFunction("j3ThrowException");
- GetArrayClassFunction = module->getFunction("j3GetArrayClass");
+ GetArrayClassFunction = globalModule->getFunction("j3GetArrayClass");
- GetFinalInt8FieldFunction = module->getFunction("getFinalInt8Field");
- GetFinalInt16FieldFunction = module->getFunction("getFinalInt16Field");
- GetFinalInt32FieldFunction = module->getFunction("getFinalInt32Field");
- GetFinalLongFieldFunction = module->getFunction("getFinalLongField");
- GetFinalFloatFieldFunction = module->getFunction("getFinalFloatField");
- GetFinalDoubleFieldFunction = module->getFunction("getFinalDoubleField");
- GetFinalObjectFieldFunction = module->getFunction("getFinalObjectField");
+ GetFinalInt8FieldFunction = globalModule->getFunction("getFinalInt8Field");
+ GetFinalInt16FieldFunction = globalModule->getFunction("getFinalInt16Field");
+ GetFinalInt32FieldFunction = globalModule->getFunction("getFinalInt32Field");
+ GetFinalLongFieldFunction = globalModule->getFunction("getFinalLongField");
+ GetFinalFloatFieldFunction = globalModule->getFunction("getFinalFloatField");
+ GetFinalDoubleFieldFunction = globalModule->getFunction("getFinalDoubleField");
+ GetFinalObjectFieldFunction = globalModule->getFunction("getFinalObjectField");
#ifdef ISOLATE_SHARING
- GetCtpClassFunction = module->getFunction("getCtpClass");
+ GetCtpClassFunction = globalModule->getFunction("getCtpClass");
GetJnjvmExceptionClassFunction =
- module->getFunction("getJnjvmExceptionClass");
- GetJnjvmArrayClassFunction = module->getFunction("getJnjvmArrayClass");
- StaticCtpLookupFunction = module->getFunction("j3StaticCtpLookup");
- SpecialCtpLookupFunction = module->getFunction("j3SpecialCtpLookup");
+ globalModule->getFunction("getJnjvmExceptionClass");
+ GetJnjvmArrayClassFunction = globalModule->getFunction("getJnjvmArrayClass");
+ StaticCtpLookupFunction = globalModule->getFunction("j3StaticCtpLookup");
+ SpecialCtpLookupFunction = globalModule->getFunction("j3SpecialCtpLookup");
#endif
#ifdef SERVICE
- ServiceCallStartFunction = module->getFunction("j3ServiceCallStart");
- ServiceCallStopFunction = module->getFunction("j3ServiceCallStop");
+ ServiceCallStartFunction = globalModule->getFunction("j3ServiceCallStart");
+ ServiceCallStopFunction = globalModule->getFunction("j3ServiceCallStop");
#endif
- JavaObjectTracerFunction = module->getFunction("JavaObjectTracer");
- EmptyTracerFunction = module->getFunction("EmptyTracer");
- JavaArrayTracerFunction = module->getFunction("JavaArrayTracer");
- ArrayObjectTracerFunction = module->getFunction("ArrayObjectTracer");
- RegularObjectTracerFunction = module->getFunction("RegularObjectTracer");
+ JavaObjectTracerFunction = globalModule->getFunction("JavaObjectTracer");
+ EmptyTracerFunction = globalModule->getFunction("EmptyTracer");
+ JavaArrayTracerFunction = globalModule->getFunction("JavaArrayTracer");
+ ArrayObjectTracerFunction = globalModule->getFunction("ArrayObjectTracer");
+ RegularObjectTracerFunction = globalModule->getFunction("RegularObjectTracer");
#ifndef WITHOUT_VTABLE
- VirtualLookupFunction = module->getFunction("j3VirtualTableLookup");
+ VirtualLookupFunction = globalModule->getFunction("j3VirtualTableLookup");
#endif
- GetLockFunction = module->getFunction("getLock");
+ GetLockFunction = globalModule->getFunction("getLock");
ThrowExceptionFromJITFunction =
- module->getFunction("j3ThrowExceptionFromJIT");
+ globalModule->getFunction("j3ThrowExceptionFromJIT");
}
Modified: vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=96749&r1=96748&r2=96749&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp Sun Feb 21 13:32:50 2010
@@ -60,11 +60,11 @@
const llvm::Type* Ty = 0;
if (classDef->isArray()) {
- Ty = J3Intrinsics::JavaClassArrayType->getContainedType(0);
+ Ty = JavaIntrinsics.JavaClassArrayType->getContainedType(0);
} else if (classDef->isPrimitive()) {
- Ty = J3Intrinsics::JavaClassPrimitiveType->getContainedType(0);
+ Ty = JavaIntrinsics.JavaClassPrimitiveType->getContainedType(0);
} else {
- Ty = J3Intrinsics::JavaClassType->getContainedType(0);
+ Ty = JavaIntrinsics.JavaClassType->getContainedType(0);
}
GlobalVariable* varGV =
@@ -95,7 +95,7 @@
array_class_iterator End = arrayClasses.end();
array_class_iterator I = arrayClasses.find(classDef->asArrayClass());
if (I == End) {
- const llvm::Type* Ty = J3Intrinsics::JavaClassArrayType;
+ const llvm::Type* Ty = JavaIntrinsics.JavaClassArrayType;
Module& Mod = *getLLVMModule();
GlobalVariable* varGV =
@@ -119,7 +119,7 @@
constant_pool_iterator End = constantPools.end();
constant_pool_iterator I = constantPools.find(ctp);
if (I == End) {
- const Type* Ty = J3Intrinsics::ConstantPoolType->getContainedType(0);
+ const Type* Ty = JavaIntrinsics.ConstantPoolType->getContainedType(0);
Module& Mod = *getLLVMModule();
varGV = new GlobalVariable(Mod, Ty, false,
@@ -154,7 +154,7 @@
name += "_VirtualMethods";
Module& Mod = *getLLVMModule();
const Type* ATy =
- ArrayType::get(J3Intrinsics::JavaMethodType->getContainedType(0),
+ ArrayType::get(JavaIntrinsics.JavaMethodType->getContainedType(0),
cl->nbVirtualMethods + cl->nbStaticMethods);
Array = new GlobalVariable(Mod, ATy, false, GlobalValue::ExternalLinkage,
@@ -180,7 +180,7 @@
new GlobalVariable(Mod, Ty->getContainedType(0), false,
GlobalValue::InternalLinkage, 0, "");
Constant* res = ConstantExpr::getCast(Instruction::BitCast, varGV,
- J3Intrinsics::JavaObjectType);
+ JavaIntrinsics.JavaObjectType);
strings.insert(std::make_pair(str, res));
Constant* C = CreateConstantFromJavaString(str);
varGV->setInitializer(C);
@@ -211,7 +211,7 @@
GlobalValue::InternalLinkage, 0, "");
Constant* res = ConstantExpr::getCast(Instruction::BitCast, varGV,
- J3Intrinsics::JavaObjectType);
+ JavaIntrinsics.JavaObjectType);
javaClasses.insert(std::make_pair(cl, res));
varGV->setInitializer(CreateConstantFromJavaClass(cl));
@@ -233,7 +233,7 @@
getJavaClass(cl);
Constant* Cl = getNativeClass(cl);
- Cl = ConstantExpr::getBitCast(Cl, J3Intrinsics::JavaCommonClassType);
+ Cl = ConstantExpr::getBitCast(Cl, JavaIntrinsics.JavaCommonClassType);
Constant* GEP[2] = { getIntrinsics()->constantZero,
getIntrinsics()->constantZero };
@@ -274,14 +274,14 @@
intptr_t* realObj = (intptr_t*)obj;
intptr_t size = realObj[0];
- const ArrayType* ATy = ArrayType::get(J3Intrinsics::JavaObjectType,
+ const ArrayType* ATy = ArrayType::get(JavaIntrinsics.JavaObjectType,
size + 1);
std::vector<Constant*> Vals;
for (sint32 i = 0; i < size + 1; ++i) {
Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
uint64_t(realObj[i]));
- CI = ConstantExpr::getIntToPtr(CI, J3Intrinsics::JavaObjectType);
+ CI = ConstantExpr::getIntToPtr(CI, JavaIntrinsics.JavaObjectType);
Vals.push_back(CI);
}
@@ -292,12 +292,12 @@
GlobalValue::InternalLinkage,
CA, "");
- return ConstantExpr::getBitCast(varGV, J3Intrinsics::JavaObjectType);
+ return ConstantExpr::getBitCast(varGV, JavaIntrinsics.JavaObjectType);
} else {
Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
uint64_t(obj));
- CI = ConstantExpr::getIntToPtr(CI, J3Intrinsics::JavaObjectType);
+ CI = ConstantExpr::getIntToPtr(CI, JavaIntrinsics.JavaObjectType);
return CI;
}
}
@@ -337,13 +337,13 @@
abort();
}
} else {
- Ty = J3Intrinsics::JavaObjectType;
+ Ty = JavaIntrinsics.JavaObjectType;
}
std::vector<const Type*> Elemts;
const ArrayType* ATy = ArrayType::get(Ty, ((JavaArray*)obj)->size);
- Elemts.push_back(J3Intrinsics::JavaObjectType->getContainedType(0));
- Elemts.push_back(J3Intrinsics::pointerSizeType);
+ Elemts.push_back(JavaIntrinsics.JavaObjectType->getContainedType(0));
+ Elemts.push_back(JavaIntrinsics.pointerSizeType);
Elemts.push_back(ATy);
Ty = StructType::get(getLLVMModule()->getContext(), Elemts);
@@ -357,7 +357,7 @@
0, "");
Constant* C = ConstantExpr::getBitCast(varGV,
- J3Intrinsics::JavaObjectType);
+ JavaIntrinsics.JavaObjectType);
finalObjects.insert(std::make_pair(obj, C));
reverseFinalObjects.insert(std::make_pair(C, obj));
@@ -459,7 +459,7 @@
const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[idx]);
JavaString* obj = ctpInfo->resolveString(utf8, idx);
Constant* C = getString(obj);
- C = ConstantExpr::getBitCast(C, J3Intrinsics::JavaObjectType);
+ C = ConstantExpr::getBitCast(C, JavaIntrinsics.JavaObjectType);
Elts.push_back(C);
} else {
fprintf(stderr, "Implement me");
@@ -491,7 +491,7 @@
0, name);
Constant* res = ConstantExpr::getCast(Instruction::BitCast, varGV,
- J3Intrinsics::ptrType);
+ JavaIntrinsics.ptrType);
staticInstances.insert(std::make_pair(classDef, res));
if (isCompiling(classDef)) {
@@ -521,7 +521,7 @@
if (I == End) {
const ArrayType* ATy =
- dyn_cast<ArrayType>(J3Intrinsics::VTType->getContainedType(0));
+ dyn_cast<ArrayType>(JavaIntrinsics.VTType->getContainedType(0));
const PointerType* PTy = dyn_cast<PointerType>(ATy->getContainedType(0));
ATy = ArrayType::get(PTy, size);
std::string name(UTF8Buffer(classDef->name).toCompileName()->cString());
@@ -534,7 +534,7 @@
0, name);
res = ConstantExpr::getCast(Instruction::BitCast, varGV,
- J3Intrinsics::VTType);
+ JavaIntrinsics.VTType);
virtualTables.insert(std::make_pair(VT, res));
if (isCompiling(classDef) || assumeCompiled) {
@@ -571,7 +571,7 @@
Constant* JavaAOTCompiler::CreateConstantForBaseObject(CommonClass* cl) {
const StructType* STy =
- dyn_cast<StructType>(J3Intrinsics::JavaObjectType->getContainedType(0));
+ dyn_cast<StructType>(JavaIntrinsics.JavaObjectType->getContainedType(0));
std::vector<Constant*> Elmts;
@@ -580,7 +580,7 @@
// lock
Constant* L = ConstantInt::get(Type::getInt64Ty(getGlobalContext()), 0);
- Elmts.push_back(ConstantExpr::getIntToPtr(L, J3Intrinsics::ptrType));
+ Elmts.push_back(ConstantExpr::getIntToPtr(L, JavaIntrinsics.ptrType));
return ConstantStruct::get(STy, Elmts);
}
@@ -597,19 +597,19 @@
Elmts.push_back(CreateConstantForBaseObject(javaClass));
// signers
- Elmts.push_back(Constant::getNullValue(J3Intrinsics::JavaObjectType));
+ Elmts.push_back(Constant::getNullValue(JavaIntrinsics.JavaObjectType));
// pd
- Elmts.push_back(Constant::getNullValue(J3Intrinsics::JavaObjectType));
+ Elmts.push_back(Constant::getNullValue(JavaIntrinsics.JavaObjectType));
// vmdata
Constant* Cl = getNativeClass(cl);
Cl = ConstantExpr::getCast(Instruction::BitCast, Cl,
- J3Intrinsics::JavaObjectType);
+ JavaIntrinsics.JavaObjectType);
Elmts.push_back(Cl);
// constructor
- Elmts.push_back(Constant::getNullValue(J3Intrinsics::JavaObjectType));
+ Elmts.push_back(Constant::getNullValue(JavaIntrinsics.JavaObjectType));
return ConstantStruct::get(STy, Elmts);
}
@@ -707,7 +707,7 @@
Constant* C = getFinalObject(val, FieldCl);
TempElts.push_back(C);
} else {
- const llvm::Type* Ty = J3Intrinsics::JavaObjectType;
+ const llvm::Type* Ty = JavaIntrinsics.JavaObjectType;
TempElts.push_back(Constant::getNullValue(Ty));
}
}
@@ -738,7 +738,7 @@
GlobalValue::InternalLinkage,
Array, "");
- Array = ConstantExpr::getBitCast(varGV, J3Intrinsics::JavaObjectType);
+ Array = ConstantExpr::getBitCast(varGV, JavaIntrinsics.JavaObjectType);
Elmts.push_back(Array);
Elmts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()),
@@ -754,7 +754,7 @@
Constant* JavaAOTCompiler::CreateConstantFromAttribut(Attribut& attribut) {
const StructType* STy =
- dyn_cast<StructType>(J3Intrinsics::AttributType->getContainedType(0));
+ dyn_cast<StructType>(JavaIntrinsics.AttributType->getContainedType(0));
std::vector<Constant*> Elmts;
@@ -773,7 +773,7 @@
Constant* JavaAOTCompiler::CreateConstantFromCommonClass(CommonClass* cl) {
const StructType* STy =
- dyn_cast<StructType>(J3Intrinsics::JavaCommonClassType->getContainedType(0));
+ dyn_cast<StructType>(JavaIntrinsics.JavaCommonClassType->getContainedType(0));
Module& Mod = *getLLVMModule();
const llvm::Type* TempTy = 0;
@@ -797,17 +797,17 @@
TempElmts.push_back(getNativeClass(cl->interfaces[i]));
}
- ATy = ArrayType::get(J3Intrinsics::JavaClassType, cl->nbInterfaces);
+ ATy = ArrayType::get(JavaIntrinsics.JavaClassType, cl->nbInterfaces);
Constant* interfaces = ConstantArray::get(ATy, TempElmts);
interfaces = new GlobalVariable(Mod, ATy, true,
GlobalValue::InternalLinkage,
interfaces, "");
interfaces = ConstantExpr::getCast(Instruction::BitCast, interfaces,
- PointerType::getUnqual(J3Intrinsics::JavaClassType));
+ PointerType::getUnqual(JavaIntrinsics.JavaClassType));
CommonClassElts.push_back(interfaces);
} else {
- const Type* Ty = PointerType::getUnqual(J3Intrinsics::JavaClassType);
+ const Type* Ty = PointerType::getUnqual(JavaIntrinsics.JavaClassType);
CommonClassElts.push_back(Constant::getNullValue(Ty));
}
@@ -821,21 +821,21 @@
if (cl->super) {
CommonClassElts.push_back(getNativeClass(cl->super));
} else {
- TempTy = J3Intrinsics::JavaClassType;
+ TempTy = JavaIntrinsics.JavaClassType;
CommonClassElts.push_back(Constant::getNullValue(TempTy));
}
// classLoader: store the static initializer, it will be overriden once
// the class is loaded.
Constant* loader = ConstantExpr::getBitCast(StaticInitializer,
- J3Intrinsics::ptrType);
+ JavaIntrinsics.ptrType);
CommonClassElts.push_back(loader);
// virtualTable
if (cl->virtualVT) {
CommonClassElts.push_back(getVirtualTable(cl->virtualVT));
} else {
- TempTy = J3Intrinsics::VTType;
+ TempTy = JavaIntrinsics.VTType;
CommonClassElts.push_back(Constant::getNullValue(TempTy));
}
return ConstantStruct::get(STy, CommonClassElts);
@@ -843,13 +843,13 @@
Constant* JavaAOTCompiler::CreateConstantFromJavaField(JavaField& field) {
const StructType* STy =
- dyn_cast<StructType>(J3Intrinsics::JavaFieldType->getContainedType(0));
+ dyn_cast<StructType>(JavaIntrinsics.JavaFieldType->getContainedType(0));
std::vector<Constant*> FieldElts;
std::vector<Constant*> TempElts;
// signature
- FieldElts.push_back(Constant::getNullValue(J3Intrinsics::ptrType));
+ FieldElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
// access
FieldElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), field.access));
@@ -862,7 +862,7 @@
// attributs
if (field.nbAttributs) {
- const llvm::Type* AttrTy = J3Intrinsics::AttributType->getContainedType(0);
+ const llvm::Type* AttrTy = JavaIntrinsics.AttributType->getContainedType(0);
const ArrayType* ATy = ArrayType::get(AttrTy, field.nbAttributs);
for (uint32 i = 0; i < field.nbAttributs; ++i) {
TempElts.push_back(CreateConstantFromAttribut(field.attributs[i]));
@@ -874,11 +874,11 @@
GlobalValue::InternalLinkage,
attributs, "");
attributs = ConstantExpr::getCast(Instruction::BitCast, attributs,
- J3Intrinsics::AttributType);
+ JavaIntrinsics.AttributType);
FieldElts.push_back(attributs);
} else {
- FieldElts.push_back(Constant::getNullValue(J3Intrinsics::AttributType));
+ FieldElts.push_back(Constant::getNullValue(JavaIntrinsics.AttributType));
}
// nbAttributs
@@ -894,28 +894,28 @@
FieldElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), field.num));
//JInfo
- FieldElts.push_back(Constant::getNullValue(J3Intrinsics::ptrType));
+ FieldElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
return ConstantStruct::get(STy, FieldElts);
}
Constant* JavaAOTCompiler::CreateConstantFromJavaMethod(JavaMethod& method) {
const StructType* STy =
- dyn_cast<StructType>(J3Intrinsics::JavaMethodType->getContainedType(0));
+ dyn_cast<StructType>(JavaIntrinsics.JavaMethodType->getContainedType(0));
Module& Mod = *getLLVMModule();
std::vector<Constant*> MethodElts;
std::vector<Constant*> TempElts;
// signature
- MethodElts.push_back(Constant::getNullValue(J3Intrinsics::ptrType));
+ MethodElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
// access
MethodElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), method.access));
// attributs
if (method.nbAttributs) {
- const llvm::Type* AttrTy = J3Intrinsics::AttributType->getContainedType(0);
+ const llvm::Type* AttrTy = JavaIntrinsics.AttributType->getContainedType(0);
const ArrayType* ATy = ArrayType::get(AttrTy, method.nbAttributs);
for (uint32 i = 0; i < method.nbAttributs; ++i) {
TempElts.push_back(CreateConstantFromAttribut(method.attributs[i]));
@@ -927,11 +927,11 @@
GlobalValue::InternalLinkage,
attributs, "");
attributs = ConstantExpr::getCast(Instruction::BitCast, attributs,
- J3Intrinsics::AttributType);
+ JavaIntrinsics.AttributType);
MethodElts.push_back(attributs);
} else {
- MethodElts.push_back(Constant::getNullValue(J3Intrinsics::AttributType));
+ MethodElts.push_back(Constant::getNullValue(JavaIntrinsics.AttributType));
}
// nbAttributs
@@ -951,16 +951,16 @@
// code
if (isAbstract(method.access)) {
- MethodElts.push_back(Constant::getNullValue(J3Intrinsics::ptrType));
+ MethodElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
} else {
LLVMMethodInfo* LMI = getMethodInfo(&method);
Function* func = LMI->getMethod();
MethodElts.push_back(ConstantExpr::getCast(Instruction::BitCast, func,
- J3Intrinsics::ptrType));
+ JavaIntrinsics.ptrType));
}
// codeInfo
- MethodElts.push_back(Constant::getNullValue(J3Intrinsics::CodeLineInfoType));
+ MethodElts.push_back(Constant::getNullValue(JavaIntrinsics.CodeLineInfoType));
// codeInfoLength
MethodElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), 0));
@@ -969,14 +969,14 @@
MethodElts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), method.offset));
// JInfo
- MethodElts.push_back(Constant::getNullValue(J3Intrinsics::ptrType));
+ MethodElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
return ConstantStruct::get(STy, MethodElts);
}
Constant* JavaAOTCompiler::CreateConstantFromClassPrimitive(ClassPrimitive* cl) {
const llvm::Type* JCPTy =
- J3Intrinsics::JavaClassPrimitiveType->getContainedType(0);
+ JavaIntrinsics.JavaClassPrimitiveType->getContainedType(0);
const StructType* STy = dyn_cast<StructType>(JCPTy);
std::vector<Constant*> ClassElts;
@@ -992,7 +992,7 @@
Constant* JavaAOTCompiler::CreateConstantFromClassArray(ClassArray* cl) {
const StructType* STy =
- dyn_cast<StructType>(J3Intrinsics::JavaClassArrayType->getContainedType(0));
+ dyn_cast<StructType>(JavaIntrinsics.JavaClassArrayType->getContainedType(0));
std::vector<Constant*> ClassElts;
Constant* ClGEPs[2] = { getIntrinsics()->constantZero,
@@ -1003,7 +1003,7 @@
// baseClass
Constant* Cl = getNativeClass(cl->baseClass());
- if (Cl->getType() != J3Intrinsics::JavaCommonClassType)
+ if (Cl->getType() != JavaIntrinsics.JavaCommonClassType)
Cl = ConstantExpr::getGetElementPtr(Cl, ClGEPs, 2);
ClassElts.push_back(Cl);
@@ -1013,7 +1013,7 @@
Constant* JavaAOTCompiler::CreateConstantFromClass(Class* cl) {
const StructType* STy =
- dyn_cast<StructType>(J3Intrinsics::JavaClassType->getContainedType(0));
+ dyn_cast<StructType>(JavaIntrinsics.JavaClassType->getContainedType(0));
Module& Mod = *getLLVMModule();
std::vector<Constant*> ClassElts;
@@ -1048,10 +1048,10 @@
ClassElts.push_back(ConstantArray::get(ATy, CStr, 1));
// thinlock
- ClassElts.push_back(Constant::getNullValue(J3Intrinsics::ptrType));
+ ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
if (cl->nbVirtualFields + cl->nbStaticFields) {
- ATy = ArrayType::get(J3Intrinsics::JavaFieldType->getContainedType(0),
+ ATy = ArrayType::get(JavaIntrinsics.JavaFieldType->getContainedType(0),
cl->nbVirtualFields + cl->nbStaticFields);
}
@@ -1082,9 +1082,9 @@
GlobalValue::InternalLinkage,
fields, "");
fields = ConstantExpr::getCast(Instruction::BitCast, fields,
- J3Intrinsics::JavaFieldType);
+ JavaIntrinsics.JavaFieldType);
} else {
- fields = Constant::getNullValue(J3Intrinsics::JavaFieldType);
+ fields = Constant::getNullValue(JavaIntrinsics.JavaFieldType);
}
// virtualFields
@@ -1098,14 +1098,14 @@
// staticFields
// Output null, getLLVMModule() will be set in the initializer. Otherwise, the
// assembly emitter of LLVM will try to align the data.
- ClassElts.push_back(Constant::getNullValue(J3Intrinsics::JavaFieldType));
+ ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.JavaFieldType));
// nbStaticFields
ClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), cl->nbStaticFields));
// virtualMethods
if (cl->nbVirtualMethods + cl->nbStaticMethods) {
- ATy = ArrayType::get(J3Intrinsics::JavaMethodType->getContainedType(0),
+ ATy = ArrayType::get(JavaIntrinsics.JavaMethodType->getContainedType(0),
cl->nbVirtualMethods + cl->nbStaticMethods);
}
@@ -1132,9 +1132,9 @@
methods, name);
virtualMethods.insert(std::make_pair(cl, GV));
methods = ConstantExpr::getCast(Instruction::BitCast, GV,
- J3Intrinsics::JavaMethodType);
+ JavaIntrinsics.JavaMethodType);
} else {
- methods = Constant::getNullValue(J3Intrinsics::JavaMethodType);
+ methods = Constant::getNullValue(JavaIntrinsics.JavaMethodType);
}
// virtualMethods
@@ -1147,23 +1147,23 @@
// staticMethods
// Output null, getLLVMModule() will be set in the initializer.
- ClassElts.push_back(Constant::getNullValue(J3Intrinsics::JavaMethodType));
+ ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.JavaMethodType));
// nbStaticMethods
ClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), cl->nbStaticMethods));
// ownerClass
- ClassElts.push_back(Constant::getNullValue(J3Intrinsics::ptrType));
+ ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
// bytes
- ClassElts.push_back(Constant::getNullValue(J3Intrinsics::JavaArrayUInt8Type));
+ ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.JavaArrayUInt8Type));
// ctpInfo
- ClassElts.push_back(Constant::getNullValue(J3Intrinsics::ptrType));
+ ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
// attributs
if (cl->nbAttributs) {
- ATy = ArrayType::get(J3Intrinsics::AttributType->getContainedType(0),
+ ATy = ArrayType::get(JavaIntrinsics.AttributType->getContainedType(0),
cl->nbAttributs);
for (uint32 i = 0; i < cl->nbAttributs; ++i) {
@@ -1176,10 +1176,10 @@
GlobalValue::InternalLinkage,
attributs, "");
attributs = ConstantExpr::getCast(Instruction::BitCast, attributs,
- J3Intrinsics::AttributType);
+ JavaIntrinsics.AttributType);
ClassElts.push_back(attributs);
} else {
- ClassElts.push_back(Constant::getNullValue(J3Intrinsics::AttributType));
+ ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.AttributType));
}
// nbAttributs
@@ -1191,7 +1191,7 @@
TempElts.push_back(getNativeClass(cl->innerClasses[i]));
}
- const llvm::Type* TempTy = J3Intrinsics::JavaClassType;
+ const llvm::Type* TempTy = JavaIntrinsics.JavaClassType;
ATy = ArrayType::get(TempTy, cl->nbInnerClasses);
Constant* innerClasses = ConstantArray::get(ATy, TempElts);
innerClasses = new GlobalVariable(*getLLVMModule(), ATy, true,
@@ -1202,7 +1202,7 @@
ClassElts.push_back(innerClasses);
} else {
- const Type* Ty = PointerType::getUnqual(J3Intrinsics::JavaClassType);
+ const Type* Ty = PointerType::getUnqual(JavaIntrinsics.JavaClassType);
ClassElts.push_back(Constant::getNullValue(Ty));
}
@@ -1213,7 +1213,7 @@
if (cl->outerClass) {
ClassElts.push_back(getNativeClass(cl->outerClass));
} else {
- ClassElts.push_back(Constant::getNullValue(J3Intrinsics::JavaClassType));
+ ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.JavaClassType));
}
// innerAccess
@@ -1232,7 +1232,7 @@
ClassElts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), cl->staticSize));
// JInfo
- ClassElts.push_back(Constant::getNullValue(J3Intrinsics::ptrType));
+ ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
return ConstantStruct::get(STy, ClassElts);
}
@@ -1241,8 +1241,8 @@
Constant* JavaAOTCompiler::CreateConstantFromIntArray(const T* val, const Type* Ty) {
std::vector<const Type*> Elemts;
const ArrayType* ATy = ArrayType::get(Ty, val->size);
- Elemts.push_back(J3Intrinsics::JavaObjectType->getContainedType(0));
- Elemts.push_back(J3Intrinsics::pointerSizeType);
+ Elemts.push_back(JavaIntrinsics.JavaObjectType->getContainedType(0));
+ Elemts.push_back(JavaIntrinsics.pointerSizeType);
Elemts.push_back(ATy);
@@ -1251,7 +1251,7 @@
std::vector<Constant*> Cts;
Cts.push_back(CreateConstantForBaseObject(val->getClass()));
- Cts.push_back(ConstantInt::get(J3Intrinsics::pointerSizeType, val->size));
+ Cts.push_back(ConstantInt::get(JavaIntrinsics.pointerSizeType, val->size));
std::vector<Constant*> Vals;
for (sint32 i = 0; i < val->size; ++i) {
@@ -1267,8 +1267,8 @@
Constant* JavaAOTCompiler::CreateConstantFromFPArray(const T* val, const Type* Ty) {
std::vector<const Type*> Elemts;
const ArrayType* ATy = ArrayType::get(Ty, val->size);
- Elemts.push_back(J3Intrinsics::JavaObjectType->getContainedType(0));
- Elemts.push_back(J3Intrinsics::pointerSizeType);
+ Elemts.push_back(JavaIntrinsics.JavaObjectType->getContainedType(0));
+ Elemts.push_back(JavaIntrinsics.pointerSizeType);
Elemts.push_back(ATy);
@@ -1277,7 +1277,7 @@
std::vector<Constant*> Cts;
Cts.push_back(CreateConstantForBaseObject(val->getClass()));
- Cts.push_back(ConstantInt::get(J3Intrinsics::pointerSizeType, val->size));
+ Cts.push_back(ConstantInt::get(JavaIntrinsics.pointerSizeType, val->size));
std::vector<Constant*> Vals;
for (sint32 i = 0; i < val->size; ++i) {
@@ -1291,10 +1291,10 @@
Constant* JavaAOTCompiler::CreateConstantFromObjectArray(const ArrayObject* val) {
std::vector<const Type*> Elemts;
- const llvm::Type* Ty = J3Intrinsics::JavaObjectType;
+ const llvm::Type* Ty = JavaIntrinsics.JavaObjectType;
const ArrayType* ATy = ArrayType::get(Ty, val->size);
- Elemts.push_back(J3Intrinsics::JavaObjectType->getContainedType(0));
- Elemts.push_back(J3Intrinsics::pointerSizeType);
+ Elemts.push_back(JavaIntrinsics.JavaObjectType->getContainedType(0));
+ Elemts.push_back(JavaIntrinsics.pointerSizeType);
Elemts.push_back(ATy);
@@ -1303,7 +1303,7 @@
std::vector<Constant*> Cts;
Cts.push_back(CreateConstantForBaseObject(val->getClass()));
- Cts.push_back(ConstantInt::get(J3Intrinsics::pointerSizeType, val->size));
+ Cts.push_back(ConstantInt::get(JavaIntrinsics.pointerSizeType, val->size));
std::vector<Constant*> Vals;
for (sint32 i = 0; i < val->size; ++i) {
@@ -1311,7 +1311,7 @@
Vals.push_back(getFinalObject(val->elements[i],
val->getClass()->asArrayClass()->baseClass()));
} else {
- Vals.push_back(Constant::getNullValue(J3Intrinsics::JavaObjectType));
+ Vals.push_back(Constant::getNullValue(JavaIntrinsics.JavaObjectType));
}
}
@@ -1323,7 +1323,7 @@
Constant* JavaAOTCompiler::CreateConstantFromUTF8(const UTF8* val) {
std::vector<const Type*> Elemts;
const ArrayType* ATy = ArrayType::get(Type::getInt16Ty(getGlobalContext()), val->size);
- Elemts.push_back(J3Intrinsics::pointerSizeType);
+ Elemts.push_back(JavaIntrinsics.pointerSizeType);
Elemts.push_back(ATy);
@@ -1331,7 +1331,7 @@
Elemts);
std::vector<Constant*> Cts;
- Cts.push_back(ConstantInt::get(J3Intrinsics::pointerSizeType, val->size));
+ Cts.push_back(ConstantInt::get(JavaIntrinsics.pointerSizeType, val->size));
std::vector<Constant*> Vals;
for (sint32 i = 0; i < val->size; ++i) {
@@ -1355,7 +1355,7 @@
C, "");
Constant* res = ConstantExpr::getCast(Instruction::BitCast, varGV,
- J3Intrinsics::UTF8Type);
+ JavaIntrinsics.UTF8Type);
utf8s.insert(std::make_pair(val, res));
return res;
@@ -1372,7 +1372,7 @@
VT : ClassArray::SuperArray->virtualVT;
const ArrayType* ATy =
- dyn_cast<ArrayType>(J3Intrinsics::VTType->getContainedType(0));
+ dyn_cast<ArrayType>(JavaIntrinsics.VTType->getContainedType(0));
const PointerType* PTy = dyn_cast<PointerType>(ATy->getContainedType(0));
ATy = ArrayType::get(PTy, size);
@@ -1439,7 +1439,7 @@
ConstantInt::get(Type::getInt64Ty(getGlobalContext()), VT->nbSecondaryTypes), PTy));
// secondaryTypes
- const ArrayType* DTy = ArrayType::get(J3Intrinsics::VTType,
+ const ArrayType* DTy = ArrayType::get(JavaIntrinsics.VTType,
VT->nbSecondaryTypes);
std::vector<Constant*> TempElmts;
@@ -1479,7 +1479,7 @@
const ArrayType* ATy =
- dyn_cast<ArrayType>(J3Intrinsics::VTType->getContainedType(0));
+ dyn_cast<ArrayType>(JavaIntrinsics.VTType->getContainedType(0));
const PointerType* PTy = dyn_cast<PointerType>(ATy->getContainedType(0));
ATy = ArrayType::get(PTy, InterfaceMethodTable::NumIndexes);
@@ -1525,7 +1525,7 @@
uint32_t length = 2 * size;
const ArrayType* ATy =
- dyn_cast<ArrayType>(J3Intrinsics::VTType->getContainedType(0));
+ dyn_cast<ArrayType>(JavaIntrinsics.VTType->getContainedType(0));
ATy = ArrayType::get(PTy, length);
std::vector<Constant*> InternalElemts;
@@ -1600,7 +1600,7 @@
compileRT = false;
std::vector<const llvm::Type*> llvmArgs;
- llvmArgs.push_back(J3Intrinsics::ptrType); // class loader.
+ llvmArgs.push_back(JavaIntrinsics.ptrType); // class loader.
const FunctionType* FTy = FunctionType::get(Type::getVoidTy(getGlobalContext()), llvmArgs, false);
StaticInitializer = Function::Create(FTy, GlobalValue::InternalLinkage,
@@ -1612,9 +1612,9 @@
"staticCallback", getLLVMModule());
llvmArgs.clear();
- llvmArgs.push_back(J3Intrinsics::JavaMethodType);
+ llvmArgs.push_back(JavaIntrinsics.JavaMethodType);
- FTy = FunctionType::get(J3Intrinsics::ptrType, llvmArgs, false);
+ FTy = FunctionType::get(JavaIntrinsics.ptrType, llvmArgs, false);
NativeLoader = Function::Create(FTy, GlobalValue::ExternalLinkage,
"vmjcNativeLoader", getLLVMModule());
@@ -1691,8 +1691,8 @@
void JavaAOTCompiler::CreateStaticInitializer() {
std::vector<const llvm::Type*> llvmArgs;
- llvmArgs.push_back(J3Intrinsics::ptrType); // class loader
- llvmArgs.push_back(J3Intrinsics::JavaCommonClassType); // cl
+ llvmArgs.push_back(JavaIntrinsics.ptrType); // class loader
+ llvmArgs.push_back(JavaIntrinsics.JavaCommonClassType); // cl
const FunctionType* FTy =
FunctionType::get(Type::getVoidTy(getGlobalContext()), llvmArgs, false);
@@ -1702,11 +1702,11 @@
llvmArgs.clear();
// class loader
- llvmArgs.push_back(J3Intrinsics::ptrType);
+ llvmArgs.push_back(JavaIntrinsics.ptrType);
// array ptr
- llvmArgs.push_back(PointerType::getUnqual(J3Intrinsics::JavaClassArrayType));
+ llvmArgs.push_back(PointerType::getUnqual(JavaIntrinsics.JavaClassArrayType));
// name
- llvmArgs.push_back(J3Intrinsics::UTF8Type);
+ llvmArgs.push_back(JavaIntrinsics.UTF8Type);
FTy = FunctionType::get(Type::getVoidTy(getGlobalContext()), llvmArgs, false);
Function* GetClassArray = Function::Create(FTy, GlobalValue::ExternalLinkage,
@@ -1720,7 +1720,7 @@
// If we have defined some strings.
if (strings.begin() != strings.end()) {
llvmArgs.clear();
- llvmArgs.push_back(J3Intrinsics::ptrType); // class loader
+ llvmArgs.push_back(JavaIntrinsics.ptrType); // class loader
llvmArgs.push_back(strings.begin()->second->getType()); // val
FTy = FunctionType::get(Type::getVoidTy(getGlobalContext()), llvmArgs, false);
@@ -1741,7 +1741,7 @@
// If we have defined some UTF8s.
if (utf8s.begin() != utf8s.end()) {
llvmArgs.clear();
- llvmArgs.push_back(J3Intrinsics::ptrType); // class loader
+ llvmArgs.push_back(JavaIntrinsics.ptrType); // class loader
llvmArgs.push_back(utf8s.begin()->second->getType()); // val
FTy = FunctionType::get(Type::getVoidTy(getGlobalContext()), llvmArgs, false);
@@ -1763,7 +1763,7 @@
if (isCompiling(i->first)) {
Args[0] = loader;
Args[1] = ConstantExpr::getBitCast(i->second,
- J3Intrinsics::JavaCommonClassType);
+ JavaIntrinsics.JavaCommonClassType);
CallInst::Create(AddClass, Args, Args + 2, "", currentBlock);
}
}
Modified: vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp?rev=96749&r1=96748&r2=96749&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp Sun Feb 21 13:32:50 2010
@@ -127,8 +127,8 @@
static JavaJITListener* JITListener = 0;
Constant* JavaJITCompiler::getNativeClass(CommonClass* classDef) {
- const llvm::Type* Ty = classDef->isClass() ? J3Intrinsics::JavaClassType :
- J3Intrinsics::JavaCommonClassType;
+ const llvm::Type* Ty = classDef->isClass() ? JavaIntrinsics.JavaClassType :
+ JavaIntrinsics.JavaCommonClassType;
ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
uint64_t(classDef));
@@ -140,25 +140,25 @@
assert(ptr && "No constant pool found");
ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
uint64_t(ptr));
- return ConstantExpr::getIntToPtr(CI, J3Intrinsics::ConstantPoolType);
+ return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.ConstantPoolType);
}
Constant* JavaJITCompiler::getMethodInClass(JavaMethod* meth) {
ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
(int64_t)meth);
- return ConstantExpr::getIntToPtr(CI, J3Intrinsics::JavaMethodType);
+ return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.JavaMethodType);
}
Constant* JavaJITCompiler::getString(JavaString* str) {
assert(str && "No string given");
ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
uint64(str));
- return ConstantExpr::getIntToPtr(CI, J3Intrinsics::JavaObjectType);
+ return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.JavaObjectType);
}
Constant* JavaJITCompiler::getStringPtr(JavaString** str) {
assert(str && "No string given");
- const llvm::Type* Ty = PointerType::getUnqual(J3Intrinsics::JavaObjectType);
+ const llvm::Type* Ty = PointerType::getUnqual(JavaIntrinsics.JavaObjectType);
ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
uint64(str));
return ConstantExpr::getIntToPtr(CI, Ty);
@@ -169,7 +169,7 @@
assert(obj && "Delegatee not created");
Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
uint64(obj));
- return ConstantExpr::getIntToPtr(CI, J3Intrinsics::JavaObjectType);
+ return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.JavaObjectType);
}
Constant* JavaJITCompiler::getJavaClassPtr(CommonClass* cl) {
@@ -178,7 +178,7 @@
assert(obj && "Delegatee not created");
Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
uint64(obj));
- const Type* Ty = PointerType::getUnqual(J3Intrinsics::JavaObjectType);
+ const Type* Ty = PointerType::getUnqual(JavaIntrinsics.JavaObjectType);
return ConstantExpr::getIntToPtr(CI, Ty);
}
@@ -194,7 +194,7 @@
Constant* JavaJITCompiler::getFinalObject(JavaObject* obj, CommonClass* cl) {
Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
uint64(obj));
- return ConstantExpr::getIntToPtr(CI, J3Intrinsics::JavaObjectType);
+ return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.JavaObjectType);
}
Constant* JavaJITCompiler::getStaticInstance(Class* classDef) {
@@ -214,7 +214,7 @@
}
Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
(uint64_t(obj)));
- return ConstantExpr::getIntToPtr(CI, J3Intrinsics::ptrType);
+ return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.ptrType);
}
Constant* JavaJITCompiler::getVirtualTable(JavaVirtualTable* VT) {
@@ -225,7 +225,7 @@
ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
uint64_t(VT));
- return ConstantExpr::getIntToPtr(CI, J3Intrinsics::VTType);
+ return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.VTType);
}
Constant* JavaJITCompiler::getNativeFunction(JavaMethod* meth, void* ptr) {
@@ -264,7 +264,7 @@
Value* JavaJITCompiler::getIsolate(Jnjvm* isolate, Value* Where) {
ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
uint64_t(isolate));
- return ConstantExpr::getIntToPtr(CI, J3Intrinsics::ptrType);
+ return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.ptrType);
}
#endif
Modified: vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp?rev=96749&r1=96748&r2=96749&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp Sun Feb 21 13:32:50 2010
@@ -65,7 +65,8 @@
sl = targetData->getStructLayout(structType);
} else {
- virtualType = J3Intrinsics::JavaObjectType;
+ virtualType = Mod->getIntrinsics()->JavaObjectType;
+ assert(virtualType && "intrinsics not iniitalized");
structType = dyn_cast<const StructType>(virtualType->getContainedType(0));
sl = targetData->getStructLayout(structType);
@@ -240,8 +241,10 @@
std::vector<const llvm::Type*> llvmArgs;
uint32 size = signature->nbArguments;
Typedef* const* arguments = signature->getArgumentsType();
+ JavaLLVMCompiler* Mod =
+ (JavaLLVMCompiler*)signature->initialLoader->getCompiler();
- llvmArgs.push_back(J3Intrinsics::JavaObjectType);
+ llvmArgs.push_back(Mod->getIntrinsics()->JavaObjectType);
for (uint32 i = 0; i < size; ++i) {
Typedef* type = arguments[i];
@@ -276,7 +279,8 @@
}
#if defined(ISOLATE_SHARING)
- llvmArgs.push_back(J3Intrinsics::ConstantPoolType); // cached constant pool
+ // cached constant pool
+ llvmArgs.push_back(Mod->getIntrinsics()->ConstantPoolType);
#endif
LLVMAssessorInfo& LAI =
@@ -294,17 +298,20 @@
std::vector<const llvm::Type*> llvmArgs;
uint32 size = signature->nbArguments;
Typedef* const* arguments = signature->getArgumentsType();
+ JavaLLVMCompiler* Mod =
+ (JavaLLVMCompiler*)signature->initialLoader->getCompiler();
- const llvm::Type* Ty = PointerType::getUnqual(J3Intrinsics::JavaObjectType);
+ const llvm::Type* Ty =
+ PointerType::getUnqual(Mod->getIntrinsics()->JavaObjectType);
- llvmArgs.push_back(J3Intrinsics::ptrType); // JNIEnv
+ llvmArgs.push_back(Mod->getIntrinsics()->ptrType); // JNIEnv
llvmArgs.push_back(Ty); // Class
for (uint32 i = 0; i < size; ++i) {
Typedef* type = arguments[i];
LLVMAssessorInfo& LAI = JavaLLVMCompiler::getTypedefInfo(type);
const llvm::Type* Ty = LAI.llvmType;
- if (Ty == J3Intrinsics::JavaObjectType) {
+ if (Ty == Mod->getIntrinsics()->JavaObjectType) {
llvmArgs.push_back(LAI.llvmTypePtr);
} else {
llvmArgs.push_back(LAI.llvmType);
@@ -312,13 +319,15 @@
}
#if defined(ISOLATE_SHARING)
- llvmArgs.push_back(J3Intrinsics::ConstantPoolType); // cached constant pool
+ // cached constant pool
+ llvmArgs.push_back(Mod->getIntrinsics()->ConstantPoolType);
#endif
LLVMAssessorInfo& LAI =
JavaLLVMCompiler::getTypedefInfo(signature->getReturnType());
- const llvm::Type* RetType = LAI.llvmType == J3Intrinsics::JavaObjectType ?
- LAI.llvmTypePtr : LAI.llvmType;
+ const llvm::Type* RetType =
+ LAI.llvmType == Mod->getIntrinsics()->JavaObjectType ?
+ LAI.llvmTypePtr : LAI.llvmType;
nativeType = FunctionType::get(RetType, llvmArgs, false);
mvm::MvmModule::unprotectIR();
}
@@ -607,9 +616,11 @@
// Lock here because we are called by arbitrary code
mvm::MvmModule::protectIR();
std::vector<const llvm::Type*> Args;
- Args.push_back(J3Intrinsics::ConstantPoolType); // ctp
+ JavaLLVMCompiler* Mod =
+ (JavaLLVMCompiler*)signature->initialLoader->getCompiler();
+ Args.push_back(Mod->getIntrinsics()->ConstantPoolType); // ctp
Args.push_back(getVirtualPtrType());
- Args.push_back(J3Intrinsics::JavaObjectType);
+ Args.push_back(Mod->getIntrinsics()->JavaObjectType);
Args.push_back(LLVMAssessorInfo::AssessorInfo[I_LONG].llvmTypePtr);
LLVMAssessorInfo& LAI =
JavaLLVMCompiler::getTypedefInfo(signature->getReturnType());
@@ -623,8 +634,10 @@
if (!staticBufType) {
// Lock here because we are called by arbitrary code
mvm::MvmModule::protectIR();
+ JavaLLVMCompiler* Mod =
+ (JavaLLVMCompiler*)signature->initialLoader->getCompiler();
std::vector<const llvm::Type*> Args;
- Args.push_back(J3Intrinsics::ConstantPoolType); // ctp
+ Args.push_back(Mod->getIntrinsics()->ConstantPoolType); // ctp
Args.push_back(getStaticPtrType());
Args.push_back(LLVMAssessorInfo::AssessorInfo[I_LONG].llvmTypePtr);
LLVMAssessorInfo& LAI =
@@ -799,14 +812,14 @@
PointerType::getUnqual(Type::getDoubleTy(getGlobalContext()));
AssessorInfo[I_DOUBLE].logSizeInBytesConstant = 3;
- AssessorInfo[I_TAB].llvmType = J3Intrinsics::JavaObjectType;
+ AssessorInfo[I_TAB].llvmType = PointerType::getUnqual(
+ mvm::MvmModule::globalModule->getTypeByName("JavaObject"));
AssessorInfo[I_TAB].llvmTypePtr =
- PointerType::getUnqual(J3Intrinsics::JavaObjectType);
+ PointerType::getUnqual(AssessorInfo[I_TAB].llvmType);
AssessorInfo[I_TAB].logSizeInBytesConstant = sizeof(JavaObject*) == 8 ? 3 : 2;
- AssessorInfo[I_REF].llvmType = J3Intrinsics::JavaObjectType;
- AssessorInfo[I_REF].llvmTypePtr =
- PointerType::getUnqual(J3Intrinsics::JavaObjectType);
+ AssessorInfo[I_REF].llvmType = AssessorInfo[I_TAB].llvmType;
+ AssessorInfo[I_REF].llvmTypePtr = AssessorInfo[I_TAB].llvmTypePtr;
AssessorInfo[I_REF].logSizeInBytesConstant = sizeof(JavaObject*) == 8 ? 3 : 2;
}
Modified: vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp?rev=96749&r1=96748&r2=96749&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp Sun Feb 21 13:32:50 2010
@@ -402,7 +402,7 @@
BasicBlock* trueCl = BasicBlock::Create(*Context, "Initialized", &F);
BasicBlock* falseCl = BasicBlock::Create(*Context, "Uninitialized", &F);
- PHINode* node = llvm::PHINode::Create(J3Intrinsics::JavaClassType, "", trueCl);
+ PHINode* node = llvm::PHINode::Create(intrinsics->JavaClassType, "", trueCl);
node->addIncoming(Cl, CI->getParent());
BranchInst::Create(trueCl, falseCl, test, CI);
Modified: vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/JIT.cpp?rev=96749&r1=96748&r2=96749&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Sun Feb 21 13:32:50 2010
@@ -325,14 +325,12 @@
module->setTargetTriple(MvmModule::globalModule->getTargetTriple());
LLVMContext& Context = module->getContext();
- if (!ptrType) {
- // Type declaration
- ptrType = PointerType::getUnqual(Type::getInt8Ty(Context));
- ptr32Type = PointerType::getUnqual(Type::getInt32Ty(Context));
- ptrPtrType = PointerType::getUnqual(ptrType);
- pointerSizeType = module->getPointerSize() == Module::Pointer32 ?
- Type::getInt32Ty(Context) : Type::getInt64Ty(Context);
- }
+ // Type declaration
+ ptrType = PointerType::getUnqual(Type::getInt8Ty(Context));
+ ptr32Type = PointerType::getUnqual(Type::getInt32Ty(Context));
+ ptrPtrType = PointerType::getUnqual(ptrType);
+ pointerSizeType = module->getPointerSize() == Module::Pointer32 ?
+ Type::getInt32Ty(Context) : Type::getInt64Ty(Context);
// Constant declaration
constantLongMinusOne = ConstantInt::get(Type::getInt64Ty(Context), (uint64_t)-1);
@@ -457,13 +455,6 @@
assert(AddFinalizationCandidate && "No addFinalizationCandidate function");
}
-
-const llvm::PointerType* BaseIntrinsics::ptrType;
-const llvm::PointerType* BaseIntrinsics::ptr32Type;
-const llvm::PointerType* BaseIntrinsics::ptrPtrType;
-const llvm::Type* BaseIntrinsics::pointerSizeType;
-const llvm::Type* BaseIntrinsics::arrayPtrType;
-
const llvm::TargetData* MvmModule::TheTargetData;
llvm::GCStrategy* MvmModule::TheGCStrategy;
llvm::Module *MvmModule::globalModule;
Modified: vmkit/trunk/lib/N3/Mono/MonoString.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Mono/MonoString.cpp?rev=96749&r1=96748&r2=96749&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/Mono/MonoString.cpp (original)
+++ vmkit/trunk/lib/N3/Mono/MonoString.cpp Sun Feb 21 13:32:50 2010
@@ -44,7 +44,7 @@
if (!str->_llvmVar) {
N3* vm = VMThread::get()->getVM();
if (!str->_llvmVar) {
- const Type* pty = mvm::BaseIntrinsics::ptrType;
+ const Type* pty = PointerType::getUnqual(Type::getInt8Ty(getGlobalContext()));
Module* Mod = vm->getLLVMModule();
Constant* cons =
ConstantExpr::getIntToPtr(ConstantInt::get(Type::getInt64Ty(getGlobalContext()), uint64_t (self)),
Modified: vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp?rev=96749&r1=96748&r2=96749&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJitMeta.cpp Sun Feb 21 13:32:50 2010
@@ -264,7 +264,7 @@
aquire();
if (!_llvmVar) {
Module* Mod = vm->getLLVMModule();
- const Type* pty = mvm::BaseIntrinsics::ptrType;
+ const Type* pty = PointerType::getUnqual(Type::getInt8Ty(getGlobalContext()));
Constant* cons =
ConstantExpr::getIntToPtr(ConstantInt::get(Type::getInt64Ty(getGlobalContext()), uint64_t (this)),
pty);
@@ -283,7 +283,7 @@
if (!_llvmVar) {
classDef->aquire();
if (!_llvmVar) {
- const Type* pty = mvm::BaseIntrinsics::ptrType;
+ const Type* pty = PointerType::getUnqual(Type::getInt8Ty(getGlobalContext()));
Module* Mod = classDef->vm->getLLVMModule();
Constant* cons =
ConstantExpr::getIntToPtr(ConstantInt::get(Type::getInt64Ty(getGlobalContext()), uint64_t (this)),
@@ -303,7 +303,7 @@
classDef->aquire();
if (!_llvmVar) {
Module* Mod = classDef->vm->getLLVMModule();
- const Type* pty = mvm::BaseIntrinsics::ptrType;
+ const Type* pty = PointerType::getUnqual(Type::getInt8Ty(getGlobalContext()));
Constant* cons =
ConstantExpr::getIntToPtr(ConstantInt::get(Type::getInt64Ty(getGlobalContext()), uint64_t (this)),
pty);
More information about the vmkit-commits
mailing list