[vmkit-commits] [vmkit] r96804 - in /vmkit/trunk: include/j3/JavaLLVMCompiler.h include/j3/LLVMInfo.h lib/J3/Compiler/J3Intrinsics.cpp lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/Compiler/JavaJIT.cpp lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/Compiler/JavaJITOpcodes.cpp lib/J3/Compiler/JavaLLVMCompiler.cpp lib/J3/Compiler/LLVMInfo.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Mon Feb 22 13:39:15 PST 2010


Author: geoffray
Date: Mon Feb 22 15:39:15 2010
New Revision: 96804

URL: http://llvm.org/viewvc/llvm-project?rev=96804&view=rev
Log:
Start getting rid of getGlobalContext.


Modified:
    vmkit/trunk/include/j3/JavaLLVMCompiler.h
    vmkit/trunk/include/j3/LLVMInfo.h
    vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp
    vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp
    vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
    vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
    vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
    vmkit/trunk/lib/J3/Compiler/JavaLLVMCompiler.cpp
    vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp

Modified: vmkit/trunk/include/j3/JavaLLVMCompiler.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/JavaLLVMCompiler.h?rev=96804&r1=96803&r2=96804&view=diff
==============================================================================
--- vmkit/trunk/include/j3/JavaLLVMCompiler.h (original)
+++ vmkit/trunk/include/j3/JavaLLVMCompiler.h Mon Feb 22 15:39:15 2010
@@ -14,6 +14,9 @@
 #include "j3/J3Intrinsics.h"
 #include "j3/LLVMInfo.h"
 
+#include "llvm/LLVMContext.h"
+#include "llvm/Module.h"
+
 namespace llvm {
   class BasicBlock;
   class DIFactory;
@@ -72,6 +75,10 @@
   llvm::Module* getLLVMModule() {
     return TheModule;
   }
+  
+  llvm::LLVMContext& getLLVMContext() {
+    return TheModule->getContext();
+  }
 
   J3Intrinsics* getIntrinsics() {
     return &JavaIntrinsics;
@@ -104,11 +111,14 @@
   void resolveStaticClass(Class* cl);
   static llvm::Function* getMethod(JavaMethod* meth);
 
+  void initialiseAssessorInfo();
+  std::map<const char, LLVMAssessorInfo> AssessorInfo;
+  LLVMAssessorInfo& getTypedefInfo(const Typedef* type);
+
   static LLVMSignatureInfo* getSignatureInfo(Signdef* sign);
   static LLVMClassInfo* getClassInfo(Class* cl);
   static LLVMFieldInfo* getFieldInfo(JavaField* field);
   static LLVMMethodInfo* getMethodInfo(JavaMethod* method);
-  static LLVMAssessorInfo& getTypedefInfo(const Typedef* type);
   
   virtual llvm::Constant* getFinalObject(JavaObject* obj, CommonClass* cl) = 0;
   virtual JavaObject* getFinalObject(llvm::Value* C) = 0;

Modified: vmkit/trunk/include/j3/LLVMInfo.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/LLVMInfo.h?rev=96804&r1=96803&r2=96804&view=diff
==============================================================================
--- vmkit/trunk/include/j3/LLVMInfo.h (original)
+++ vmkit/trunk/include/j3/LLVMInfo.h Mon Feb 22 15:39:15 2010
@@ -33,10 +33,6 @@
   const llvm::Type* llvmType;
   const llvm::Type* llvmTypePtr;
   uint8_t logSizeInBytesConstant;
-  
-  static void initialise();
-  static std::map<const char, LLVMAssessorInfo> AssessorInfo;
-
 };
 
 class LLVMClassInfo : public mvm::JITInfo {

Modified: vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp?rev=96804&r1=96803&r2=96804&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp Mon Feb 22 15:39:15 2010
@@ -41,12 +41,8 @@
     mvm::MvmModule::copyDefinitions(module, globalModule);   
   }
   
-
-  if (!(LLVMAssessorInfo::AssessorInfo[I_VOID].llvmType)) {
-    LLVMAssessorInfo::initialise();
-  }
-  
   VTType = PointerType::getUnqual(globalModule->getTypeByName("VT"));
+  LLVMContext& Context = module->getContext();
 
 #ifdef ISOLATE_SHARING
   JnjvmType = 
@@ -108,9 +104,9 @@
   
   JavaObjectNullConstant =
     Constant::getNullValue(J3Intrinsics::JavaObjectType);
-  MaxArraySizeConstant = ConstantInt::get(Type::getInt32Ty(getGlobalContext()),
+  MaxArraySizeConstant = ConstantInt::get(Type::getInt32Ty(Context),
                                           JavaArray::MaxArraySize);
-  JavaArraySizeConstant = ConstantInt::get(Type::getInt32Ty(getGlobalContext()),
+  JavaArraySizeConstant = ConstantInt::get(Type::getInt32Ty(Context),
                                           sizeof(JavaObject) + sizeof(ssize_t));
   
   
@@ -122,43 +118,39 @@
   OffsetDepthInVTConstant = constantFour;
   OffsetDisplayInVTConstant = constantSeven;
   OffsetBaseClassVTInVTConstant =
-    ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 17);
-  OffsetIMTInVTConstant =
-    ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 18);
+    ConstantInt::get(Type::getInt32Ty(Context), 17);
+  OffsetIMTInVTConstant = ConstantInt::get(Type::getInt32Ty(Context), 18);
   
   OffsetAccessInCommonClassConstant = constantOne;
-  IsArrayConstant = ConstantInt::get(Type::getInt16Ty(getGlobalContext()),
+  IsArrayConstant = ConstantInt::get(Type::getInt16Ty(Context),
                                      JNJVM_ARRAY);
   
-  IsPrimitiveConstant = ConstantInt::get(Type::getInt16Ty(getGlobalContext()),
+  IsPrimitiveConstant = ConstantInt::get(Type::getInt16Ty(Context),
                                          JNJVM_PRIMITIVE);
  
   OffsetBaseClassInArrayClassConstant = constantOne;
   OffsetLogSizeInPrimitiveClassConstant = constantOne;
 
   OffsetObjectSizeInClassConstant = constantOne;
-  OffsetVTInClassConstant =
-    ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 7);
+  OffsetVTInClassConstant = ConstantInt::get(Type::getInt32Ty(Context), 7);
   OffsetTaskClassMirrorInClassConstant = constantThree;
   OffsetVirtualMethodsInClassConstant =
-    ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 9);
+    ConstantInt::get(Type::getInt32Ty(Context), 9);
   OffsetStaticInstanceInTaskClassMirrorConstant = constantThree;
   OffsetStatusInTaskClassMirrorConstant = constantZero;
   OffsetInitializedInTaskClassMirrorConstant = constantOne;
   
   OffsetIsolateInThreadConstant =
-    ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 3);
+    ConstantInt::get(Type::getInt32Ty(Context), 3);
   OffsetDoYieldInThreadConstant =
-    ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 6);
-  OffsetJNIInThreadConstant =
-    ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 1);
+    ConstantInt::get(Type::getInt32Ty(Context), 6);
+  OffsetJNIInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 1);
   OffsetJavaExceptionInThreadConstant =
-    ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 2);
+    ConstantInt::get(Type::getInt32Ty(Context), 2);
   OffsetCXXExceptionInThreadConstant =
-    ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 3);
+    ConstantInt::get(Type::getInt32Ty(Context), 3);
   
-  ClassReadyConstant =
-    ConstantInt::get(Type::getInt8Ty(getGlobalContext()), ready);
+  ClassReadyConstant = ConstantInt::get(Type::getInt8Ty(Context), ready);
   
   globalModule->addTypeName("JavaObject", JavaObjectType->getContainedType(0));
   globalModule->addTypeName("JavaArray", JavaArrayType->getContainedType(0));

Modified: vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=96804&r1=96803&r2=96804&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp Mon Feb 22 15:39:15 2010
@@ -139,7 +139,7 @@
 
   for (uint32 i = 0; i < cl->nbVirtualMethods + cl->nbStaticMethods; ++i) {
     if (&cl->virtualMethods[i] == meth) {
-      MOffset = ConstantInt::get(Type::getInt32Ty(getGlobalContext()), i);
+      MOffset = ConstantInt::get(Type::getInt32Ty(getLLVMContext()), i);
       break;
     }
   }
@@ -279,7 +279,7 @@
   
     std::vector<Constant*> Vals;
     for (sint32 i = 0; i < size + 1; ++i) {
-      Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+      Constant* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                       uint64_t(realObj[i]));
       CI = ConstantExpr::getIntToPtr(CI, JavaIntrinsics.JavaObjectType);
       Vals.push_back(CI);
@@ -295,7 +295,7 @@
     return ConstantExpr::getBitCast(varGV, JavaIntrinsics.JavaObjectType);
 
   } else {
-    Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+    Constant* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                     uint64_t(obj));
     CI = ConstantExpr::getIntToPtr(CI, JavaIntrinsics.JavaObjectType);
     return CI;
@@ -318,21 +318,21 @@
         CommonClass* subClass = cl->asArrayClass()->baseClass();
         if (subClass->isPrimitive()) {
           if (subClass == upcalls->OfBool) {
-            Ty = Type::getInt8Ty(getGlobalContext());
+            Ty = Type::getInt8Ty(getLLVMContext());
           } else if (subClass == upcalls->OfByte) {
-            Ty = Type::getInt8Ty(getGlobalContext());
+            Ty = Type::getInt8Ty(getLLVMContext());
           } else if (subClass == upcalls->OfShort) {
-            Ty = Type::getInt16Ty(getGlobalContext());
+            Ty = Type::getInt16Ty(getLLVMContext());
           } else if (subClass == upcalls->OfChar) {
-            Ty = Type::getInt16Ty(getGlobalContext());
+            Ty = Type::getInt16Ty(getLLVMContext());
           } else if (subClass == upcalls->OfInt) {
-            Ty = Type::getInt32Ty(getGlobalContext());
+            Ty = Type::getInt32Ty(getLLVMContext());
           } else if (subClass == upcalls->OfFloat) {
-            Ty = Type::getFloatTy(getGlobalContext());
+            Ty = Type::getFloatTy(getLLVMContext());
           } else if (subClass == upcalls->OfLong) {
-            Ty = Type::getInt64Ty(getGlobalContext());
+            Ty = Type::getInt64Ty(getLLVMContext());
           } else if (subClass == upcalls->OfDouble) {
-            Ty = Type::getDoubleTy(getGlobalContext());
+            Ty = Type::getDoubleTy(getLLVMContext());
           } else {
             abort();
           }
@@ -396,32 +396,32 @@
           const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
           if (prim->isBool() || prim->isByte()) {
             ConstantInt* CI = ConstantInt::get(
-                Type::getInt8Ty(getGlobalContext()),
+                Type::getInt8Ty(getLLVMContext()),
                 field.getInt8Field(obj));
             Elts.push_back(CI);
           } else if (prim->isShort() || prim->isChar()) {
             ConstantInt* CI = ConstantInt::get(
-                Type::getInt16Ty(getGlobalContext()),
+                Type::getInt16Ty(getLLVMContext()),
                 field.getInt16Field(obj));
             Elts.push_back(CI);
           } else if (prim->isInt()) {
             ConstantInt* CI = ConstantInt::get(
-                Type::getInt32Ty(getGlobalContext()),
+                Type::getInt32Ty(getLLVMContext()),
                 field.getInt32Field(obj));
             Elts.push_back(CI);
           } else if (prim->isLong()) {
             ConstantInt* CI = ConstantInt::get(
-                Type::getInt64Ty(getGlobalContext()),
+                Type::getInt64Ty(getLLVMContext()),
                 field.getLongField(obj));
             Elts.push_back(CI);
           } else if (prim->isFloat()) {
             Constant* CF = ConstantFP::get(
-                Type::getFloatTy(getGlobalContext()),
+                Type::getFloatTy(getLLVMContext()),
                 field.getFloatField(obj));
             Elts.push_back(CF);
           } else if (prim->isDouble()) {
             Constant* CF = ConstantFP::get(
-                Type::getDoubleTy(getGlobalContext()),
+                Type::getDoubleTy(getLLVMContext()),
                 field.getDoubleField(obj));
             Elts.push_back(CF);
           } else {
@@ -446,11 +446,11 @@
       JavaConstantPool * ctpInfo = cl->ctpInfo;
       uint16 idx = reader.readU2();
       if (type->isPrimitive()) {
-        if (Ty == Type::getInt64Ty(getGlobalContext())) {
+        if (Ty == Type::getInt64Ty(getLLVMContext())) {
           Elts.push_back(ConstantInt::get(Ty, (uint64)ctpInfo->LongAt(idx)));
-        } else if (Ty == Type::getDoubleTy(getGlobalContext())) {
+        } else if (Ty == Type::getDoubleTy(getLLVMContext())) {
           Elts.push_back(ConstantFP::get(Ty, ctpInfo->DoubleAt(idx)));
-        } else if (Ty == Type::getFloatTy(getGlobalContext())) {
+        } else if (Ty == Type::getFloatTy(getLLVMContext())) {
           Elts.push_back(ConstantFP::get(Ty, ctpInfo->FloatAt(idx)));
         } else {
           Elts.push_back(ConstantInt::get(Ty, (uint64)ctpInfo->IntegerAt(idx)));
@@ -579,7 +579,7 @@
   Elmts.push_back(getVirtualTable(cl->virtualVT));
   
   // lock
-  Constant* L = ConstantInt::get(Type::getInt64Ty(getGlobalContext()), 0);
+  Constant* L = ConstantInt::get(Type::getInt64Ty(getLLVMContext()), 0);
   Elmts.push_back(ConstantExpr::getIntToPtr(L, JavaIntrinsics.ptrType));
 
   return ConstantStruct::get(STy, Elmts);
@@ -623,28 +623,28 @@
     if (subClass->isPrimitive()) {
       if (subClass == upcalls->OfBool) {
         return CreateConstantFromIntArray<ArrayUInt8>((ArrayUInt8*)obj,
-                                        Type::getInt8Ty(getGlobalContext()));
+                                        Type::getInt8Ty(getLLVMContext()));
       } else if (subClass == upcalls->OfByte) {
         return CreateConstantFromIntArray<ArraySInt8>((ArraySInt8*)obj,
-                                        Type::getInt8Ty(getGlobalContext()));
+                                        Type::getInt8Ty(getLLVMContext()));
       } else if (subClass == upcalls->OfShort) {
         return CreateConstantFromIntArray<ArraySInt16>((ArraySInt16*)obj,
-                                        Type::getInt16Ty(getGlobalContext()));
+                                        Type::getInt16Ty(getLLVMContext()));
       } else if (subClass == upcalls->OfChar) {
         return CreateConstantFromIntArray<ArrayUInt16>((ArrayUInt16*)obj,
-                                        Type::getInt16Ty(getGlobalContext()));
+                                        Type::getInt16Ty(getLLVMContext()));
       } else if (subClass == upcalls->OfInt) {
         return CreateConstantFromIntArray<ArraySInt32>((ArraySInt32*)obj,
-                                        Type::getInt32Ty(getGlobalContext()));
+                                        Type::getInt32Ty(getLLVMContext()));
       } else if (subClass == upcalls->OfFloat) {
         return CreateConstantFromFPArray<ArrayFloat>((ArrayFloat*)obj,
-                                        Type::getFloatTy(getGlobalContext()));
+                                        Type::getFloatTy(getLLVMContext()));
       } else if (subClass == upcalls->OfLong) {
         return CreateConstantFromIntArray<ArrayLong>((ArrayLong*)obj,
-                                        Type::getInt64Ty(getGlobalContext()));
+                                        Type::getInt64Ty(getLLVMContext()));
       } else if (subClass == upcalls->OfDouble) {
         return CreateConstantFromFPArray<ArrayDouble>((ArrayDouble*)obj,
-                                        Type::getDoubleTy(getGlobalContext()));
+                                        Type::getDoubleTy(getLLVMContext()));
       } else {
         abort();
       }
@@ -673,27 +673,27 @@
         if (type->isPrimitive()) {
           const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
           if (prim->isBool() || prim->isByte()) {
-            ConstantInt* CI = ConstantInt::get(Type::getInt8Ty(getGlobalContext()),
+            ConstantInt* CI = ConstantInt::get(Type::getInt8Ty(getLLVMContext()),
                                                field.getInt8Field(obj));
             TempElts.push_back(CI);
           } else if (prim->isShort() || prim->isChar()) {
-            ConstantInt* CI = ConstantInt::get(Type::getInt16Ty(getGlobalContext()),
+            ConstantInt* CI = ConstantInt::get(Type::getInt16Ty(getLLVMContext()),
                                                field.getInt16Field(obj));
             TempElts.push_back(CI);
           } else if (prim->isInt()) {
-            ConstantInt* CI = ConstantInt::get(Type::getInt32Ty(getGlobalContext()),
+            ConstantInt* CI = ConstantInt::get(Type::getInt32Ty(getLLVMContext()),
                                                field.getInt32Field(obj));
             TempElts.push_back(CI);
           } else if (prim->isLong()) {
-            ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+            ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                                field.getLongField(obj));
             TempElts.push_back(CI);
           } else if (prim->isFloat()) {
-            Constant* CF = ConstantFP::get(Type::getFloatTy(getGlobalContext()),
+            Constant* CF = ConstantFP::get(Type::getFloatTy(getLLVMContext()),
                                            field.getFloatField(obj));
             TempElts.push_back(CF);
           } else if (prim->isDouble()) {
-            Constant* CF = ConstantFP::get(Type::getDoubleTy(getGlobalContext()),
+            Constant* CF = ConstantFP::get(Type::getDoubleTy(getLLVMContext()),
                                            field.getDoubleField(obj));
             TempElts.push_back(CF);
           } else {
@@ -730,7 +730,7 @@
   Elmts.push_back(CreateConstantForBaseObject(cl));
 
   Constant* Array = CreateConstantFromIntArray<ArrayUInt16>(str->value,
-                                        Type::getInt16Ty(getGlobalContext()));
+                                        Type::getInt16Ty(getLLVMContext()));
   
 
   Module& Mod = *getLLVMModule();
@@ -741,11 +741,11 @@
 	Array = ConstantExpr::getBitCast(varGV, JavaIntrinsics.JavaObjectType);
 
   Elmts.push_back(Array);
-  Elmts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()),
+  Elmts.push_back(ConstantInt::get(Type::getInt32Ty(getLLVMContext()),
                                    str->count));
-  Elmts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()),
+  Elmts.push_back(ConstantInt::get(Type::getInt32Ty(getLLVMContext()),
                                    str->cachedHashCode));
-  Elmts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()),
+  Elmts.push_back(ConstantInt::get(Type::getInt32Ty(getLLVMContext()),
                                    str->offset));
  
   return ConstantStruct::get(STy, Elmts);
@@ -763,10 +763,10 @@
   Elmts.push_back(getUTF8(attribut.name));
 
   // start
-  Elmts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), attribut.start));
+  Elmts.push_back(ConstantInt::get(Type::getInt32Ty(getLLVMContext()), attribut.start));
 
   // nbb
-  Elmts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), attribut.nbb));
+  Elmts.push_back(ConstantInt::get(Type::getInt32Ty(getLLVMContext()), attribut.nbb));
   
   return ConstantStruct::get(STy, Elmts);
 }
@@ -789,7 +789,7 @@
   CommonClassElts.push_back(ConstantArray::get(ATy, TCM, 1));
   
   // access
-  CommonClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), cl->access));
+  CommonClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), cl->access));
  
   // interfaces
   if (cl->nbInterfaces) {
@@ -812,7 +812,7 @@
   }
 
   // nbInterfaces
-  CommonClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), cl->nbInterfaces));
+  CommonClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), cl->nbInterfaces));
 
   // name
   CommonClassElts.push_back(getUTF8(cl->name));
@@ -852,7 +852,7 @@
   FieldElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
   
   // access
-  FieldElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), field.access));
+  FieldElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), field.access));
 
   // name
   FieldElts.push_back(getUTF8(field.name));
@@ -882,16 +882,16 @@
   }
   
   // nbAttributs
-  FieldElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), field.nbAttributs));
+  FieldElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), field.nbAttributs));
 
   // classDef
   FieldElts.push_back(getNativeClass(field.classDef));
 
   // ptrOffset
-  FieldElts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), field.ptrOffset));
+  FieldElts.push_back(ConstantInt::get(Type::getInt32Ty(getLLVMContext()), field.ptrOffset));
 
   // num
-  FieldElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), field.num));
+  FieldElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), field.num));
 
   //JInfo
   FieldElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
@@ -911,7 +911,7 @@
   MethodElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
   
   // access
-  MethodElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), method.access));
+  MethodElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), method.access));
  
   // attributs
   if (method.nbAttributs) {
@@ -935,7 +935,7 @@
   }
   
   // nbAttributs
-  MethodElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), method.nbAttributs));
+  MethodElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), method.nbAttributs));
   
   // classDef
   MethodElts.push_back(getNativeClass(method.classDef));
@@ -947,7 +947,7 @@
   MethodElts.push_back(getUTF8(method.type));
   
   // canBeInlined
-  MethodElts.push_back(ConstantInt::get(Type::getInt8Ty(getGlobalContext()), method.canBeInlined));
+  MethodElts.push_back(ConstantInt::get(Type::getInt8Ty(getLLVMContext()), method.canBeInlined));
 
   // code
   if (isAbstract(method.access)) {
@@ -963,10 +963,10 @@
   MethodElts.push_back(Constant::getNullValue(JavaIntrinsics.CodeLineInfoType));
   
   // codeInfoLength
-  MethodElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), 0));
+  MethodElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), 0));
 
   // offset
-  MethodElts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), method.offset));
+  MethodElts.push_back(ConstantInt::get(Type::getInt32Ty(getLLVMContext()), method.offset));
 
   // JInfo
   MethodElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
@@ -985,7 +985,7 @@
   ClassElts.push_back(CreateConstantFromCommonClass(cl));
 
   // primSize
-  ClassElts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), cl->logSize));
+  ClassElts.push_back(ConstantInt::get(Type::getInt32Ty(getLLVMContext()), cl->logSize));
 
   return ConstantStruct::get(STy, ClassElts);
 }
@@ -1023,11 +1023,11 @@
   ClassElts.push_back(CreateConstantFromCommonClass(cl));
 
   // virtualSize
-  ClassElts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()),
+  ClassElts.push_back(ConstantInt::get(Type::getInt32Ty(getLLVMContext()),
                                        cl->virtualSize));
   
   // alginment
-  ClassElts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()),
+  ClassElts.push_back(ConstantInt::get(Type::getInt32Ty(getLLVMContext()),
                                        cl->alignment));
 
   // IsolateInfo
@@ -1038,9 +1038,9 @@
   assert(TCMTy && "Malformed type");
 
   uint32 status = cl->needsInitialisationCheck() ? vmjc : ready;
-  TempElts.push_back(ConstantInt::get(Type::getInt8Ty(getGlobalContext()),
+  TempElts.push_back(ConstantInt::get(Type::getInt8Ty(getLLVMContext()),
                                       status));
-  TempElts.push_back(ConstantInt::get(Type::getInt1Ty(getGlobalContext()),
+  TempElts.push_back(ConstantInt::get(Type::getInt1Ty(getLLVMContext()),
                                       status == ready ? 1 : 0));
   TempElts.push_back(getStaticInstance(cl));
   Constant* CStr[1] = { ConstantStruct::get(TCMTy, TempElts) };
@@ -1091,7 +1091,7 @@
   ClassElts.push_back(fields);
 
   ConstantInt* nbVirtualFields = 
-    ConstantInt::get(Type::getInt16Ty(getGlobalContext()), cl->nbVirtualFields);
+    ConstantInt::get(Type::getInt16Ty(getLLVMContext()), cl->nbVirtualFields);
   // nbVirtualFields
   ClassElts.push_back(nbVirtualFields);
   
@@ -1101,7 +1101,7 @@
   ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.JavaFieldType));
 
   // nbStaticFields
-  ClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), cl->nbStaticFields));
+  ClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), cl->nbStaticFields));
   
   // virtualMethods
   if (cl->nbVirtualMethods + cl->nbStaticMethods) {
@@ -1141,7 +1141,7 @@
   ClassElts.push_back(methods);
 
   ConstantInt* nbVirtualMethods = 
-    ConstantInt::get(Type::getInt16Ty(getGlobalContext()), cl->nbVirtualMethods);
+    ConstantInt::get(Type::getInt16Ty(getLLVMContext()), cl->nbVirtualMethods);
   // nbVirtualMethods
   ClassElts.push_back(nbVirtualMethods);
   
@@ -1150,7 +1150,7 @@
   ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.JavaMethodType));
 
   // nbStaticMethods
-  ClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), cl->nbStaticMethods));
+  ClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), cl->nbStaticMethods));
 
   // ownerClass
   ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
@@ -1183,7 +1183,7 @@
   }
   
   // nbAttributs
-  ClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), cl->nbAttributs));
+  ClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), cl->nbAttributs));
   
   // innerClasses
   if (cl->nbInnerClasses) {
@@ -1207,7 +1207,7 @@
   }
 
   // nbInnerClasses
-  ClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), cl->nbInnerClasses));
+  ClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), cl->nbInnerClasses));
 
   // outerClass
   if (cl->outerClass) {
@@ -1217,19 +1217,19 @@
   }
 
   // innerAccess
-  ClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), cl->innerAccess));
+  ClassElts.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), cl->innerAccess));
   
   // innerOuterResolved
-  ClassElts.push_back(ConstantInt::get(Type::getInt8Ty(getGlobalContext()), cl->innerOuterResolved));
+  ClassElts.push_back(ConstantInt::get(Type::getInt8Ty(getLLVMContext()), cl->innerOuterResolved));
   
   // isAnonymous
-  ClassElts.push_back(ConstantInt::get(Type::getInt8Ty(getGlobalContext()), cl->isAnonymous));
+  ClassElts.push_back(ConstantInt::get(Type::getInt8Ty(getLLVMContext()), cl->isAnonymous));
   
   // virtualTableSize
-  ClassElts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), cl->virtualTableSize));
+  ClassElts.push_back(ConstantInt::get(Type::getInt32Ty(getLLVMContext()), cl->virtualTableSize));
   
   // staticSize
-  ClassElts.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), cl->staticSize));
+  ClassElts.push_back(ConstantInt::get(Type::getInt32Ty(getLLVMContext()), cl->staticSize));
 
   // JInfo
   ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType));
@@ -1322,7 +1322,7 @@
 
 Constant* JavaAOTCompiler::CreateConstantFromUTF8(const UTF8* val) {
   std::vector<const Type*> Elemts;
-  const ArrayType* ATy = ArrayType::get(Type::getInt16Ty(getGlobalContext()), val->size);
+  const ArrayType* ATy = ArrayType::get(Type::getInt16Ty(getLLVMContext()), val->size);
   Elemts.push_back(JavaIntrinsics.pointerSizeType);
 
   Elemts.push_back(ATy);
@@ -1335,7 +1335,7 @@
   
   std::vector<Constant*> Vals;
   for (sint32 i = 0; i < val->size; ++i) {
-    Vals.push_back(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), val->elements[i]));
+    Vals.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), val->elements[i]));
   }
 
   Cts.push_back(ConstantArray::get(ATy, Vals));
@@ -1414,11 +1414,11 @@
 
   // depth
   Elemts.push_back(ConstantExpr::getIntToPtr(
-        ConstantInt::get(Type::getInt64Ty(getGlobalContext()), VT->depth), PTy));
+        ConstantInt::get(Type::getInt64Ty(getLLVMContext()), VT->depth), PTy));
   
   // offset
   Elemts.push_back(ConstantExpr::getIntToPtr(
-        ConstantInt::get(Type::getInt64Ty(getGlobalContext()), VT->offset), PTy));
+        ConstantInt::get(Type::getInt64Ty(getLLVMContext()), VT->offset), PTy));
   
   // cache
   Elemts.push_back(N);
@@ -1436,7 +1436,7 @@
   
   // nbSecondaryTypes
   Elemts.push_back(ConstantExpr::getIntToPtr(
-        ConstantInt::get(Type::getInt64Ty(getGlobalContext()), VT->nbSecondaryTypes), PTy));
+        ConstantInt::get(Type::getInt64Ty(getLLVMContext()), VT->nbSecondaryTypes), PTy));
   
   // secondaryTypes
   const ArrayType* DTy = ArrayType::get(JavaIntrinsics.VTType,
@@ -1550,7 +1550,7 @@
                                                   Array, "");
      
           Constant* CI =
-            ConstantExpr::getPtrToInt(GV, Type::getInt32Ty(getGlobalContext()));
+            ConstantExpr::getPtrToInt(GV, Type::getInt32Ty(getLLVMContext()));
           CI = ConstantExpr::getAdd(CI, JavaIntrinsics.constantOne);
           CI = ConstantExpr::getIntToPtr(CI, PTy);
           IElemts.push_back(CI);
@@ -1601,13 +1601,13 @@
 
   std::vector<const llvm::Type*> llvmArgs;
   llvmArgs.push_back(JavaIntrinsics.ptrType); // class loader.
-  const FunctionType* FTy = FunctionType::get(Type::getVoidTy(getGlobalContext()), llvmArgs, false);
+  const FunctionType* FTy = FunctionType::get(Type::getVoidTy(getLLVMContext()), llvmArgs, false);
 
   StaticInitializer = Function::Create(FTy, GlobalValue::InternalLinkage,
                                        "Init", getLLVMModule());
   
   llvmArgs.clear();
-  FTy = FunctionType::get(Type::getVoidTy(getGlobalContext()), llvmArgs, false);
+  FTy = FunctionType::get(Type::getVoidTy(getLLVMContext()), llvmArgs, false);
   Callback = Function::Create(FTy, GlobalValue::ExternalLinkage,
                               "staticCallback", getLLVMModule());
 
@@ -1620,7 +1620,7 @@
                                   "vmjcNativeLoader", getLLVMModule());
   
   llvmArgs.clear();
-  FTy = FunctionType::get(Type::getVoidTy(getGlobalContext()), llvmArgs, false);
+  FTy = FunctionType::get(Type::getVoidTy(getLLVMContext()), llvmArgs, false);
   ObjectPrinter = Function::Create(FTy, GlobalValue::ExternalLinkage,
                                    "printJavaObject", getLLVMModule());
 
@@ -1666,7 +1666,7 @@
   
     
     Constant* cons = 
-      ConstantExpr::getIntToPtr(ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+      ConstantExpr::getIntToPtr(ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                                  uint64_t(isolate)),
                                 ptrType);
 
@@ -1694,7 +1694,7 @@
   llvmArgs.push_back(JavaIntrinsics.ptrType); // class loader
   llvmArgs.push_back(JavaIntrinsics.JavaCommonClassType); // cl
   const FunctionType* FTy =
-    FunctionType::get(Type::getVoidTy(getGlobalContext()), llvmArgs, false);
+    FunctionType::get(Type::getVoidTy(getLLVMContext()), llvmArgs, false);
 
   Function* AddClass = Function::Create(FTy, GlobalValue::ExternalLinkage,
                                         "vmjcAddPreCompiledClass",
@@ -1707,12 +1707,12 @@
   llvmArgs.push_back(PointerType::getUnqual(JavaIntrinsics.JavaClassArrayType));
   // name
   llvmArgs.push_back(JavaIntrinsics.UTF8Type);
-  FTy = FunctionType::get(Type::getVoidTy(getGlobalContext()), llvmArgs, false);
+  FTy = FunctionType::get(Type::getVoidTy(getLLVMContext()), llvmArgs, false);
   
   Function* GetClassArray = Function::Create(FTy, GlobalValue::ExternalLinkage,
                                              "vmjcGetClassArray", getLLVMModule());
   
-  BasicBlock* currentBlock = BasicBlock::Create(getGlobalContext(), "enter",
+  BasicBlock* currentBlock = BasicBlock::Create(getLLVMContext(), "enter",
                                                 StaticInitializer);
   Function::arg_iterator loader = StaticInitializer->arg_begin();
   
@@ -1722,7 +1722,7 @@
     llvmArgs.clear();
     llvmArgs.push_back(JavaIntrinsics.ptrType); // class loader
     llvmArgs.push_back(strings.begin()->second->getType()); // val
-    FTy = FunctionType::get(Type::getVoidTy(getGlobalContext()), llvmArgs, false);
+    FTy = FunctionType::get(Type::getVoidTy(getLLVMContext()), llvmArgs, false);
   
     Function* AddString = Function::Create(FTy, GlobalValue::ExternalLinkage,
                                            "vmjcAddString", getLLVMModule());
@@ -1743,7 +1743,7 @@
     llvmArgs.clear();
     llvmArgs.push_back(JavaIntrinsics.ptrType); // class loader
     llvmArgs.push_back(utf8s.begin()->second->getType()); // val
-    FTy = FunctionType::get(Type::getVoidTy(getGlobalContext()), llvmArgs, false);
+    FTy = FunctionType::get(Type::getVoidTy(getLLVMContext()), llvmArgs, false);
   
     Function* AddUTF8 = Function::Create(FTy, GlobalValue::ExternalLinkage,
                                          "vmjcAddUTF8", getLLVMModule());
@@ -1777,7 +1777,7 @@
   }
   
 
-  ReturnInst::Create(getGlobalContext(), currentBlock);
+  ReturnInst::Create(getLLVMContext(), currentBlock);
 }
 
 void JavaAOTCompiler::setNoInline(Class* cl) {
@@ -2124,24 +2124,24 @@
 
   // Type Definitions
   std::vector<const Type*> FuncArgs;
-  FuncArgs.push_back(Type::getInt32Ty(getGlobalContext()));
+  FuncArgs.push_back(Type::getInt32Ty(getLLVMContext()));
   FuncArgs.push_back(PointerType::getUnqual(JavaIntrinsics.ptrType));
   
-  FunctionType* FuncTy = FunctionType::get(Type::getInt32Ty(getGlobalContext()),
+  FunctionType* FuncTy = FunctionType::get(Type::getInt32Ty(getLLVMContext()),
                                            FuncArgs, false);
 
   Function* MainFunc = Function::Create(FuncTy, GlobalValue::ExternalLinkage,
                                         "main", TheModule);
-  BasicBlock* currentBlock = BasicBlock::Create(getGlobalContext(), "enter",
+  BasicBlock* currentBlock = BasicBlock::Create(getLLVMContext(), "enter",
                                                 MainFunc);
  
   GlobalVariable* GvarArrayStr = new GlobalVariable(
-    *TheModule, ArrayType::get(Type::getInt8Ty(getGlobalContext()),
+    *TheModule, ArrayType::get(Type::getInt8Ty(getLLVMContext()),
                                strlen(name) + 1),
     true, GlobalValue::InternalLinkage, 0, "mainClass");
 
 
-  Constant* NameArray = ConstantArray::get(getGlobalContext(), name, true);
+  Constant* NameArray = ConstantArray::get(getLLVMContext(), name, true);
   GvarArrayStr->setInitializer(NameArray);
   Value* Indices[2] = { JavaIntrinsics.constantZero,
                         JavaIntrinsics.constantZero };
@@ -2154,7 +2154,7 @@
 
   FuncArgs.push_back(Args[2]->getType());
 
-  FuncTy = FunctionType::get(Type::getInt32Ty(getGlobalContext()), FuncArgs, false);
+  FuncTy = FunctionType::get(Type::getInt32Ty(getLLVMContext()), FuncArgs, false);
 
   Function* CalledFunc = 
     Function::Create(FuncTy, GlobalValue::ExternalLinkage,
@@ -2162,7 +2162,7 @@
                      TheModule);
 
   Value* res = CallInst::Create(CalledFunc, Args, Args + 3, "", currentBlock);
-  ReturnInst::Create(getGlobalContext(), res, currentBlock);
+  ReturnInst::Create(getLLVMContext(), res, currentBlock);
 
 }
 

Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=96804&r1=96803&r2=96804&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Mon Feb 22 15:39:15 2010
@@ -160,7 +160,7 @@
         res = invoke(func, args, "", currentBlock);
       }
       BranchInst::Create(endBlock, currentBlock);
-      if (retType != Type::getVoidTy(getGlobalContext())) {
+      if (retType != Type::getVoidTy(*llvmContext)) {
         node = PHINode::Create(virtualType->getReturnType(), "", endBlock);
         node->addIncoming(res, currentBlock);
       }
@@ -246,13 +246,13 @@
     }
   }
 
-  if (retType != Type::getVoidTy(getGlobalContext())) {
+  if (retType != Type::getVoidTy(*llvmContext)) {
     if (retType == intrinsics->JavaObjectType) {
       JnjvmClassLoader* JCL = compilingClass->classLoader;
       push(val, false, signature->getReturnType()->findAssocClass(JCL));
     } else {
       push(val, retTypedef->isUnsigned());
-      if (retType == Type::getDoubleTy(getGlobalContext()) || retType == Type::getInt64Ty(getGlobalContext())) {
+      if (retType == Type::getDoubleTy(*llvmContext) || retType == Type::getInt64Ty(*llvmContext)) {
         push(intrinsics->constantZero, false);
       }
     }
@@ -307,7 +307,7 @@
   if (!natPtr && !TheCompiler->isStaticCompiling()) {
     currentBlock = createBasicBlock("start");
     CallInst::Create(intrinsics->ThrowExceptionFromJITFunction, "", currentBlock);
-    if (returnType != Type::getVoidTy(getGlobalContext()))
+    if (returnType != Type::getVoidTy(*llvmContext))
       ReturnInst::Create(*llvmContext, Constant::getNullValue(returnType), currentBlock);
     else
       ReturnInst::Create(*llvmContext, currentBlock);
@@ -332,21 +332,21 @@
   currentBlock = createBasicBlock("start");
   endBlock = createBasicBlock("end block");
   
-  if (returnType != Type::getVoidTy(getGlobalContext())) {
+  if (returnType != Type::getVoidTy(*llvmContext)) {
     endNode = PHINode::Create(returnType, "", endBlock);
   }
   
   // Allocate currentLocalIndexNumber pointer
-  Value* temp = new AllocaInst(Type::getInt32Ty(getGlobalContext()), "",
+  Value* temp = new AllocaInst(Type::getInt32Ty(*llvmContext), "",
                                currentBlock);
   new StoreInst(intrinsics->constantZero, temp, false, currentBlock);
   
   // Allocate oldCurrentLocalIndexNumber pointer
-  Value* oldCLIN = new AllocaInst(PointerType::getUnqual(Type::getInt32Ty(getGlobalContext())), "",
+  Value* oldCLIN = new AllocaInst(PointerType::getUnqual(Type::getInt32Ty(*llvmContext)), "",
                                   currentBlock);
   
-  Constant* sizeF = ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 2 * sizeof(void*));
-  Value* Frame = new AllocaInst(Type::getInt8Ty(getGlobalContext()), sizeF, "", currentBlock);
+  Constant* sizeF = ConstantInt::get(Type::getInt32Ty(*llvmContext), 2 * sizeof(void*));
+  Value* Frame = new AllocaInst(Type::getInt8Ty(*llvmContext), sizeF, "", currentBlock);
   
   // Synchronize before saying we're entering native
   if (isSynchro(compilingMethod->access))
@@ -497,7 +497,7 @@
     new StoreInst(result, ResultObject, "", currentBlock);
     endNode->addIncoming(result, currentBlock);
 
-  } else if (returnType != Type::getVoidTy(getGlobalContext())) {
+  } else if (returnType != Type::getVoidTy(*llvmContext)) {
     endNode->addIncoming(result, currentBlock);
   }
   
@@ -514,7 +514,7 @@
   if (isSynchro(compilingMethod->access))
     endSynchronize();
   
-  if (returnType != Type::getVoidTy(getGlobalContext()))
+  if (returnType != Type::getVoidTy(*llvmContext))
     ReturnInst::Create(*llvmContext, endNode, currentBlock);
   else
     ReturnInst::Create(*llvmContext, currentBlock);
@@ -819,14 +819,14 @@
     Instruction* firstInstruction = firstBB->begin();
 
     for (int i = 0; i < maxLocals; i++) {
-      intLocals.push_back(new AllocaInst(Type::getInt32Ty(getGlobalContext()), "", firstInstruction));
+      intLocals.push_back(new AllocaInst(Type::getInt32Ty(*llvmContext), "", firstInstruction));
       new StoreInst(Constant::getNullValue(Type::getInt32Ty(*llvmContext)), intLocals.back(), false, firstInstruction);
-      doubleLocals.push_back(new AllocaInst(Type::getDoubleTy(getGlobalContext()), "",
+      doubleLocals.push_back(new AllocaInst(Type::getDoubleTy(*llvmContext), "",
                                             firstInstruction));
       new StoreInst(Constant::getNullValue(Type::getDoubleTy(*llvmContext)), doubleLocals.back(), false, firstInstruction);
-      longLocals.push_back(new AllocaInst(Type::getInt64Ty(getGlobalContext()), "", firstInstruction));
+      longLocals.push_back(new AllocaInst(Type::getInt64Ty(*llvmContext), "", firstInstruction));
       new StoreInst(Constant::getNullValue(Type::getInt64Ty(*llvmContext)), longLocals.back(), false, firstInstruction);
-      floatLocals.push_back(new AllocaInst(Type::getFloatTy(getGlobalContext()), "", firstInstruction));
+      floatLocals.push_back(new AllocaInst(Type::getFloatTy(*llvmContext), "", firstInstruction));
       new StoreInst(Constant::getNullValue(Type::getFloatTy(*llvmContext)), floatLocals.back(), false, firstInstruction);
       objectLocals.push_back(new AllocaInst(intrinsics->JavaObjectType, "",
                                           firstInstruction));
@@ -839,22 +839,22 @@
       objectStack.push_back(new AllocaInst(intrinsics->JavaObjectType, "",
                                            firstInstruction));
       addHighLevelType(objectStack.back(), upcalls->OfObject);
-      intStack.push_back(new AllocaInst(Type::getInt32Ty(getGlobalContext()), "", firstInstruction));
-      doubleStack.push_back(new AllocaInst(Type::getDoubleTy(getGlobalContext()), "",
+      intStack.push_back(new AllocaInst(Type::getInt32Ty(*llvmContext), "", firstInstruction));
+      doubleStack.push_back(new AllocaInst(Type::getDoubleTy(*llvmContext), "",
                                            firstInstruction));
-      longStack.push_back(new AllocaInst(Type::getInt64Ty(getGlobalContext()), "", firstInstruction));
-      floatStack.push_back(new AllocaInst(Type::getFloatTy(getGlobalContext()), "", firstInstruction));
+      longStack.push_back(new AllocaInst(Type::getInt64Ty(*llvmContext), "", firstInstruction));
+      floatStack.push_back(new AllocaInst(Type::getFloatTy(*llvmContext), "", firstInstruction));
     }
 
   } else {
     for (int i = 0; i < maxLocals; i++) {
-      intLocals.push_back(new AllocaInst(Type::getInt32Ty(getGlobalContext()), "", firstBB));
+      intLocals.push_back(new AllocaInst(Type::getInt32Ty(*llvmContext), "", firstBB));
       new StoreInst(Constant::getNullValue(Type::getInt32Ty(*llvmContext)), intLocals.back(), false, firstBB);
-      doubleLocals.push_back(new AllocaInst(Type::getDoubleTy(getGlobalContext()), "", firstBB));
+      doubleLocals.push_back(new AllocaInst(Type::getDoubleTy(*llvmContext), "", firstBB));
       new StoreInst(Constant::getNullValue(Type::getDoubleTy(*llvmContext)), doubleLocals.back(), false, firstBB);
-      longLocals.push_back(new AllocaInst(Type::getInt64Ty(getGlobalContext()), "", firstBB));
+      longLocals.push_back(new AllocaInst(Type::getInt64Ty(*llvmContext), "", firstBB));
       new StoreInst(Constant::getNullValue(Type::getInt64Ty(*llvmContext)), longLocals.back(), false, firstBB);
-      floatLocals.push_back(new AllocaInst(Type::getFloatTy(getGlobalContext()), "", firstBB));
+      floatLocals.push_back(new AllocaInst(Type::getFloatTy(*llvmContext), "", firstBB));
       new StoreInst(Constant::getNullValue(Type::getFloatTy(*llvmContext)), floatLocals.back(), false, firstBB);
       objectLocals.push_back(new AllocaInst(intrinsics->JavaObjectType, "",
                                             firstBB));
@@ -867,10 +867,10 @@
       objectStack.push_back(new AllocaInst(intrinsics->JavaObjectType, "",
                                            firstBB));
       addHighLevelType(objectStack.back(), upcalls->OfObject);
-      intStack.push_back(new AllocaInst(Type::getInt32Ty(getGlobalContext()), "", firstBB));
-      doubleStack.push_back(new AllocaInst(Type::getDoubleTy(getGlobalContext()), "", firstBB));
-      longStack.push_back(new AllocaInst(Type::getInt64Ty(getGlobalContext()), "", firstBB));
-      floatStack.push_back(new AllocaInst(Type::getFloatTy(getGlobalContext()), "", firstBB));
+      intStack.push_back(new AllocaInst(Type::getInt32Ty(*llvmContext), "", firstBB));
+      doubleStack.push_back(new AllocaInst(Type::getDoubleTy(*llvmContext), "", firstBB));
+      longStack.push_back(new AllocaInst(Type::getInt64Ty(*llvmContext), "", firstBB));
+      floatStack.push_back(new AllocaInst(Type::getFloatTy(*llvmContext), "", firstBB));
     }
   }
       
@@ -901,21 +901,21 @@
     const Typedef* cur = arguments[type];
     const Type* curType = (*i)->getType();
 
-    if (curType == Type::getInt64Ty(getGlobalContext())){
+    if (curType == Type::getInt64Ty(*llvmContext)){
       new StoreInst(*i, longLocals[index], false, currentBlock);
       ++index;
     } else if (cur->isUnsigned()) {
-      new StoreInst(new ZExtInst(*i, Type::getInt32Ty(getGlobalContext()), "", currentBlock),
+      new StoreInst(new ZExtInst(*i, Type::getInt32Ty(*llvmContext), "", currentBlock),
                     intLocals[index], false, currentBlock);
-    } else if (curType == Type::getInt8Ty(getGlobalContext()) || curType == Type::getInt16Ty(getGlobalContext())) {
-      new StoreInst(new SExtInst(*i, Type::getInt32Ty(getGlobalContext()), "", currentBlock),
+    } else if (curType == Type::getInt8Ty(*llvmContext) || curType == Type::getInt16Ty(*llvmContext)) {
+      new StoreInst(new SExtInst(*i, Type::getInt32Ty(*llvmContext), "", currentBlock),
                     intLocals[index], false, currentBlock);
-    } else if (curType == Type::getInt32Ty(getGlobalContext())) {
+    } else if (curType == Type::getInt32Ty(*llvmContext)) {
       new StoreInst(*i, intLocals[index], false, currentBlock);
-    } else if (curType == Type::getDoubleTy(getGlobalContext())) {
+    } else if (curType == Type::getDoubleTy(*llvmContext)) {
       new StoreInst(*i, doubleLocals[index], false, currentBlock);
       ++index;
-    } else if (curType == Type::getFloatTy(getGlobalContext())) {
+    } else if (curType == Type::getFloatTy(*llvmContext)) {
       new StoreInst(*i, floatLocals[index], false, currentBlock);
     } else {
       Instruction* V = new StoreInst(*i, objectLocals[index], false, currentBlock);
@@ -944,7 +944,7 @@
    
   exploreOpcodes(&compilingClass->bytes->elements[start], codeLen);
 
-  if (returnType != Type::getVoidTy(getGlobalContext())) {
+  if (returnType != Type::getVoidTy(*llvmContext)) {
     endNode = PHINode::Create(returnType, "", endBlock);
   }
 
@@ -1028,13 +1028,13 @@
   
 
   for (int i = 0; i < maxLocals; i++) {
-    intLocals.push_back(new AllocaInst(Type::getInt32Ty(getGlobalContext()), "", currentBlock));
+    intLocals.push_back(new AllocaInst(Type::getInt32Ty(*llvmContext), "", currentBlock));
     new StoreInst(Constant::getNullValue(Type::getInt32Ty(*llvmContext)), intLocals.back(), false, currentBlock);
-    doubleLocals.push_back(new AllocaInst(Type::getDoubleTy(getGlobalContext()), "", currentBlock));
+    doubleLocals.push_back(new AllocaInst(Type::getDoubleTy(*llvmContext), "", currentBlock));
     new StoreInst(Constant::getNullValue(Type::getDoubleTy(*llvmContext)), doubleLocals.back(), false, currentBlock);
-    longLocals.push_back(new AllocaInst(Type::getInt64Ty(getGlobalContext()), "", currentBlock));
+    longLocals.push_back(new AllocaInst(Type::getInt64Ty(*llvmContext), "", currentBlock));
     new StoreInst(Constant::getNullValue(Type::getInt64Ty(*llvmContext)), longLocals.back(), false, currentBlock);
-    floatLocals.push_back(new AllocaInst(Type::getFloatTy(getGlobalContext()), "", currentBlock));
+    floatLocals.push_back(new AllocaInst(Type::getFloatTy(*llvmContext), "", currentBlock));
     new StoreInst(Constant::getNullValue(Type::getFloatTy(*llvmContext)), floatLocals.back(), false, currentBlock);
     objectLocals.push_back(new AllocaInst(intrinsics->JavaObjectType, "",
                                           currentBlock));
@@ -1047,10 +1047,10 @@
     objectStack.push_back(new AllocaInst(intrinsics->JavaObjectType, "",
                                          currentBlock));
     addHighLevelType(objectStack.back(), upcalls->OfObject);
-    intStack.push_back(new AllocaInst(Type::getInt32Ty(getGlobalContext()), "", currentBlock));
-    doubleStack.push_back(new AllocaInst(Type::getDoubleTy(getGlobalContext()), "", currentBlock));
-    longStack.push_back(new AllocaInst(Type::getInt64Ty(getGlobalContext()), "", currentBlock));
-    floatStack.push_back(new AllocaInst(Type::getFloatTy(getGlobalContext()), "", currentBlock));
+    intStack.push_back(new AllocaInst(Type::getInt32Ty(*llvmContext), "", currentBlock));
+    doubleStack.push_back(new AllocaInst(Type::getDoubleTy(*llvmContext), "", currentBlock));
+    longStack.push_back(new AllocaInst(Type::getInt64Ty(*llvmContext), "", currentBlock));
+    floatStack.push_back(new AllocaInst(Type::getFloatTy(*llvmContext), "", currentBlock));
   }
   
   uint32 index = 0;
@@ -1078,21 +1078,21 @@
     const Typedef* cur = arguments[type];
     const llvm::Type* curType = i->getType();
 
-    if (curType == Type::getInt64Ty(getGlobalContext())){
+    if (curType == Type::getInt64Ty(*llvmContext)){
       new StoreInst(i, longLocals[index], false, currentBlock);
       ++index;
     } else if (cur->isUnsigned()) {
-      new StoreInst(new ZExtInst(i, Type::getInt32Ty(getGlobalContext()), "", currentBlock),
+      new StoreInst(new ZExtInst(i, Type::getInt32Ty(*llvmContext), "", currentBlock),
                     intLocals[index], false, currentBlock);
-    } else if (curType == Type::getInt8Ty(getGlobalContext()) || curType == Type::getInt16Ty(getGlobalContext())) {
-      new StoreInst(new SExtInst(i, Type::getInt32Ty(getGlobalContext()), "", currentBlock),
+    } else if (curType == Type::getInt8Ty(*llvmContext) || curType == Type::getInt16Ty(*llvmContext)) {
+      new StoreInst(new SExtInst(i, Type::getInt32Ty(*llvmContext), "", currentBlock),
                     intLocals[index], false, currentBlock);
-    } else if (curType == Type::getInt32Ty(getGlobalContext())) {
+    } else if (curType == Type::getInt32Ty(*llvmContext)) {
       new StoreInst(i, intLocals[index], false, currentBlock);
-    } else if (curType == Type::getDoubleTy(getGlobalContext())) {
+    } else if (curType == Type::getDoubleTy(*llvmContext)) {
       new StoreInst(i, doubleLocals[index], false, currentBlock);
       ++index;
-    } else if (curType == Type::getFloatTy(getGlobalContext())) {
+    } else if (curType == Type::getFloatTy(*llvmContext)) {
       new StoreInst(i, floatLocals[index], false, currentBlock);
     } else {
       Instruction* V = new StoreInst(i, objectLocals[index], false, currentBlock);
@@ -1181,7 +1181,7 @@
  
   endBlock = createBasicBlock("end");
 
-  if (returnType != Type::getVoidTy(getGlobalContext())) {
+  if (returnType != Type::getVoidTy(*llvmContext)) {
     endNode = llvm::PHINode::Create(returnType, "", endBlock);
   }
   
@@ -1240,7 +1240,7 @@
   // not return.
   pred_iterator PI = pred_begin(endBlock);
   pred_iterator PE = pred_end(endBlock);
-  if (PI == PE && returnType != Type::getVoidTy(getGlobalContext())) {
+  if (PI == PE && returnType != Type::getVoidTy(*llvmContext)) {
     Instruction* I = currentBlock->getTerminator();
     
     if (isa<UnreachableInst>(I)) {
@@ -1294,7 +1294,7 @@
   if (PI == PE) {
     currentBlock->eraseFromParent();
   } else {
-    if (returnType != Type::getVoidTy(getGlobalContext()))
+    if (returnType != Type::getVoidTy(*llvmContext))
       ReturnInst::Create(*llvmContext, endNode, currentBlock);
     else
       ReturnInst::Create(*llvmContext, currentBlock);
@@ -1396,16 +1396,16 @@
     }
 #endif   
   } else if (type == JavaConstantPool::ConstantLong) {
-    push(ConstantInt::get(Type::getInt64Ty(getGlobalContext()), ctpInfo->LongAt(index)),
+    push(ConstantInt::get(Type::getInt64Ty(*llvmContext), ctpInfo->LongAt(index)),
          false);
   } else if (type == JavaConstantPool::ConstantDouble) {
-    push(ConstantFP::get(Type::getDoubleTy(getGlobalContext()), ctpInfo->DoubleAt(index)),
+    push(ConstantFP::get(Type::getDoubleTy(*llvmContext), ctpInfo->DoubleAt(index)),
          false);
   } else if (type == JavaConstantPool::ConstantInteger) {
-    push(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), ctpInfo->IntegerAt(index)),
+    push(ConstantInt::get(Type::getInt32Ty(*llvmContext), ctpInfo->IntegerAt(index)),
          false);
   } else if (type == JavaConstantPool::ConstantFloat) {
-    push(ConstantFP::get(Type::getFloatTy(getGlobalContext()), ctpInfo->FloatAt(index)),
+    push(ConstantFP::get(Type::getFloatTy(*llvmContext), ctpInfo->FloatAt(index)),
          false);
   } else if (type == JavaConstantPool::ConstantClass) {
     UserCommonClass* cl = 0;
@@ -1444,8 +1444,8 @@
                                     const Type* arrayType, bool verif) {
   JITVerifyNull(obj);
   
-  if (index->getType() != Type::getInt32Ty(getGlobalContext())) {
-    index = new SExtInst(index, Type::getInt32Ty(getGlobalContext()), "", currentBlock);
+  if (index->getType() != Type::getInt32Ty(*llvmContext)) {
+    index = new SExtInst(index, Type::getInt32Ty(*llvmContext), "", currentBlock);
   }
   
   if (TheCompiler->hasExceptionsEnabled()) {
@@ -1493,7 +1493,7 @@
 #endif
   for (sint32 i = start; i >= 0; --i) {
     it--;
-    if (it->get() == Type::getInt64Ty(getGlobalContext()) || it->get() == Type::getDoubleTy(getGlobalContext())) {
+    if (it->get() == Type::getInt64Ty(*llvmContext) || it->get() == Type::getDoubleTy(*llvmContext)) {
       pop();
     }
     Value* tmp = pop();
@@ -1517,7 +1517,7 @@
   JnjvmBootstrapLoader* loader = compilingClass->classLoader->bootstrapLoader;
   if (name->equals(loader->abs)) {
     const Type* Ty = args[0]->getType();
-    if (Ty == Type::getInt32Ty(getGlobalContext())) {
+    if (Ty == Type::getInt32Ty(*llvmContext)) {
       Constant* const_int32_9 = intrinsics->constantZero;
       Constant* const_int32_10 = intrinsics->constantMinusOne;
       BinaryOperator* int32_tmpneg = 
@@ -1528,7 +1528,7 @@
                      "abscond");
       return llvm::SelectInst::Create(int1_abscond, args[0], int32_tmpneg,
                                       "abs", currentBlock);
-    } else if (Ty == Type::getInt64Ty(getGlobalContext())) {
+    } else if (Ty == Type::getInt64Ty(*llvmContext)) {
       Constant* const_int64_9 = intrinsics->constantLongZero;
       Constant* const_int64_10 = intrinsics->constantLongMinusOne;
       
@@ -1541,10 +1541,10 @@
       
       return llvm::SelectInst::Create(int1_abscond, args[0], int64_tmpneg,
                                       "abs", currentBlock);
-    } else if (Ty == Type::getFloatTy(getGlobalContext())) {
+    } else if (Ty == Type::getFloatTy(*llvmContext)) {
       return llvm::CallInst::Create(intrinsics->func_llvm_fabs_f32, args[0],
                                     "tmp1", currentBlock);
-    } else if (Ty == Type::getDoubleTy(getGlobalContext())) {
+    } else if (Ty == Type::getDoubleTy(*llvmContext)) {
       return llvm::CallInst::Create(intrinsics->func_llvm_fabs_f64, args[0],
                                     "tmp1", currentBlock);
     }
@@ -1676,7 +1676,7 @@
   BranchInst::Create(falseCl, trueCl, test, currentBlock);
   std::vector<Value*> Args;
   Args.push_back(ctpCache);
-  Args.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), index));
+  Args.push_back(ConstantInt::get(Type::getInt32Ty(*llvmContext), index));
   Args.push_back(GV);
   res = CallInst::Create(intrinsics->SpecialCtpLookupFunction, Args.begin(),
                          Args.end(), "", falseCl);
@@ -1711,14 +1711,14 @@
   }
   
   const llvm::Type* retType = virtualType->getReturnType();
-  if (retType != Type::getVoidTy(getGlobalContext())) {
+  if (retType != Type::getVoidTy(*llvmContext)) {
     if (retType == intrinsics->JavaObjectType) {
       JnjvmClassLoader* JCL = compilingClass->classLoader;
       push(val, false, signature->getReturnType()->findAssocClass(JCL));
     } else {
       push(val, signature->getReturnType()->isUnsigned());
-      if (retType == Type::getDoubleTy(getGlobalContext()) ||
-          retType == Type::getInt64Ty(getGlobalContext())) {
+      if (retType == Type::getDoubleTy(*llvmContext) ||
+          retType == Type::getInt64Ty(*llvmContext)) {
         push(intrinsics->constantZero, false);
       }
     }
@@ -1792,14 +1792,14 @@
   }
 
   const llvm::Type* retType = staticType->getReturnType();
-  if (retType != Type::getVoidTy(getGlobalContext())) {
+  if (retType != Type::getVoidTy(*llvmContext)) {
     if (retType == intrinsics->JavaObjectType) {
       JnjvmClassLoader* JCL = compilingClass->classLoader;
       push(val, false, signature->getReturnType()->findAssocClass(JCL));
     } else {
       push(val, signature->getReturnType()->isUnsigned());
-      if (retType == Type::getDoubleTy(getGlobalContext()) ||
-          retType == Type::getInt64Ty(getGlobalContext())) {
+      if (retType == Type::getDoubleTy(*llvmContext) ||
+          retType == Type::getInt64Ty(*llvmContext)) {
         push(intrinsics->constantZero, false);
       }
     }
@@ -1827,7 +1827,7 @@
   Args.push_back(resolver);
   Args.push_back(CTP);
   Args.push_back(Cl);
-  Args.push_back(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), index));
+  Args.push_back(ConstantInt::get(Type::getInt32Ty(*llvmContext), index));
   if (additionalArg) Args.push_back(additionalArg);
 
   Value* res = 0;
@@ -1841,8 +1841,8 @@
   
   const Type* realType = 
     intrinsics->GetConstantPoolAtFunction->getReturnType();
-  if (returnType == Type::getInt32Ty(getGlobalContext())) {
-    return new PtrToIntInst(res, Type::getInt32Ty(getGlobalContext()), "", currentBlock);
+  if (returnType == Type::getInt32Ty(*llvmContext)) {
+    return new PtrToIntInst(res, Type::getInt32Ty(*llvmContext), "", currentBlock);
   } else if (returnType != realType) {
     return new BitCastInst(res, returnType, "", currentBlock);
   } 
@@ -1999,7 +1999,7 @@
   if (stat)
     returnType = intrinsics->ptrType;
   else
-    returnType = Type::getInt32Ty(getGlobalContext());
+    returnType = Type::getInt32Ty(*llvmContext);
 
   Value* ptr = getConstantPoolAt(index, func, returnType, 0, true);
   if (!stat) {
@@ -2045,7 +2045,7 @@
   LLVMAssessorInfo& LAI = TheCompiler->getTypedefInfo(sign);
   const Type* type = LAI.llvmType;
   
-  if (type == Type::getInt64Ty(getGlobalContext()) || type == Type::getDoubleTy(getGlobalContext())) {
+  if (type == Type::getInt64Ty(*llvmContext) || type == Type::getDoubleTy(*llvmContext)) {
     val = pop();
   }
   
@@ -2077,28 +2077,28 @@
         const PrimitiveTypedef* prim = (PrimitiveTypedef*)sign;
         if (prim->isInt()) {
           sint32 val = field->getInt32Field(Obj);
-          push(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), val), false);
+          push(ConstantInt::get(Type::getInt32Ty(*llvmContext), val), false);
         } else if (prim->isByte()) {
           sint8 val = (sint8)field->getInt8Field(Obj);
-          push(ConstantInt::get(Type::getInt8Ty(getGlobalContext()), val), false);
+          push(ConstantInt::get(Type::getInt8Ty(*llvmContext), val), false);
         } else if (prim->isBool()) {
           uint8 val = (uint8)field->getInt8Field(Obj);
-          push(ConstantInt::get(Type::getInt8Ty(getGlobalContext()), val), true);
+          push(ConstantInt::get(Type::getInt8Ty(*llvmContext), val), true);
         } else if (prim->isShort()) {
           sint16 val = (sint16)field->getInt16Field(Obj);
-          push(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), val), false);
+          push(ConstantInt::get(Type::getInt16Ty(*llvmContext), val), false);
         } else if (prim->isChar()) {
           uint16 val = (uint16)field->getInt16Field(Obj);
-          push(ConstantInt::get(Type::getInt16Ty(getGlobalContext()), val), true);
+          push(ConstantInt::get(Type::getInt16Ty(*llvmContext), val), true);
         } else if (prim->isLong()) {
           sint64 val = (sint64)field->getLongField(Obj);
-          push(ConstantInt::get(Type::getInt64Ty(getGlobalContext()), val), false);
+          push(ConstantInt::get(Type::getInt64Ty(*llvmContext), val), false);
         } else if (prim->isFloat()) {
           float val = (float)field->getFloatField(Obj);
-          push(ConstantFP::get(Type::getFloatTy(getGlobalContext()), val), false);
+          push(ConstantFP::get(Type::getFloatTy(*llvmContext), val), false);
         } else if (prim->isDouble()) {
           double val = (double)field->getDoubleField(Obj);
-          push(ConstantFP::get(Type::getDoubleTy(getGlobalContext()), val), false);
+          push(ConstantFP::get(Type::getDoubleTy(*llvmContext), val), false);
         } else {
           abort();
         }
@@ -2126,7 +2126,8 @@
     CommonClass* cl = sign->findAssocClass(JCL);
     push(new LoadInst(ptr, "", currentBlock), sign->isUnsigned(), cl);
   }
-  if (type == Type::getInt64Ty(getGlobalContext()) || type == Type::getDoubleTy(getGlobalContext())) {
+  if (type == Type::getInt64Ty(*llvmContext) ||
+      type == Type::getDoubleTy(*llvmContext)) {
     push(intrinsics->constantZero, false);
   }
 }
@@ -2137,7 +2138,8 @@
   LLVMAssessorInfo& LAI = TheCompiler->getTypedefInfo(sign);
   const Type* type = LAI.llvmType;
   
-  if (type == Type::getInt64Ty(getGlobalContext()) || type == Type::getDoubleTy(getGlobalContext())) {
+  if (type == Type::getInt64Ty(*llvmContext) ||
+      type == Type::getDoubleTy(*llvmContext)) {
     val = pop();
   }
   
@@ -2202,8 +2204,8 @@
   }
  
   if (!final) push(new LoadInst(ptr, "", currentBlock), sign->isUnsigned(), cl);
-  if (type == Type::getInt64Ty(getGlobalContext()) ||
-      type == Type::getDoubleTy(getGlobalContext())) {
+  if (type == Type::getInt64Ty(*llvmContext) ||
+      type == Type::getDoubleTy(*llvmContext)) {
     push(intrinsics->constantZero, false);
   }
 }
@@ -2228,7 +2230,7 @@
   const llvm::Type* retType = virtualType->getReturnType();
   BasicBlock* endBlock = createBasicBlock("end interface invoke");
   PHINode * node = 0;
-  if (retType != Type::getVoidTy(getGlobalContext())) {
+  if (retType != Type::getVoidTy(*llvmContext)) {
     node = PHINode::Create(retType, "", endBlock);
   }
   
@@ -2258,7 +2260,7 @@
                                 currentBlock);
 
   uint32_t tableIndex = InterfaceMethodTable::getIndex(name, signature->keyName);
-  Constant* Index = ConstantInt::get(Type::getInt32Ty(getGlobalContext()),
+  Constant* Index = ConstantInt::get(Type::getInt32Ty(*llvmContext),
                                      tableIndex);
 
   Value* indices[2] = { intrinsics->constantZero, Index };
@@ -2346,8 +2348,8 @@
       push(node, false, signature->getReturnType()->findAssocClass(JCL));
     } else {
       push(node, signature->getReturnType()->isUnsigned());
-      if (retType == Type::getDoubleTy(getGlobalContext()) ||
-          retType == Type::getInt64Ty(getGlobalContext())) {
+      if (retType == Type::getDoubleTy(*llvmContext) ||
+          retType == Type::getInt64Ty(*llvmContext)) {
         push(intrinsics->constantZero, false);
       }
     }
@@ -2404,7 +2406,7 @@
   LoadInst* int32_22 = new LoadInst(ptr_21, "", false, label_bb);
   Value* cmp = BinaryOperator::CreateAnd(int32_22, intrinsics->IsArrayConstant, "",
                                          label_bb);
-  Value* zero = ConstantInt::get(Type::getInt16Ty(getGlobalContext()), 0);
+  Value* zero = ConstantInt::get(Type::getInt16Ty(*llvmContext), 0);
   ICmpInst* int1_23 = new ICmpInst(*label_bb, ICmpInst::ICMP_NE, cmp, zero, "");
   BranchInst::Create(label_bb4, label_bb2, int1_23, label_bb);
    
@@ -2554,8 +2556,8 @@
   
   // Block bb11 (label_bb11)
   currentBlock = label_bb11;
-  Argument* fwdref_39 = new Argument(Type::getInt32Ty(getGlobalContext()));
-  PHINode* int32_i_016 = PHINode::Create(Type::getInt32Ty(getGlobalContext()),
+  Argument* fwdref_39 = new Argument(Type::getInt32Ty(*llvmContext));
+  PHINode* int32_i_016 = PHINode::Create(Type::getInt32Ty(*llvmContext),
                                          "i.016", label_bb11);
   int32_i_016->reserveOperandSpace(2);
   int32_i_016->addIncoming(fwdref_39, label_bb11);

Modified: vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp?rev=96804&r1=96803&r2=96804&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp Mon Feb 22 15:39:15 2010
@@ -130,7 +130,7 @@
   const llvm::Type* Ty = classDef->isClass() ? JavaIntrinsics.JavaClassType :
                                                JavaIntrinsics.JavaCommonClassType;
   
-  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                      uint64_t(classDef));
   return ConstantExpr::getIntToPtr(CI, Ty);
 }
@@ -138,20 +138,20 @@
 Constant* JavaJITCompiler::getConstantPool(JavaConstantPool* ctp) {
   void* ptr = ctp->ctpRes;
   assert(ptr && "No constant pool found");
-  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                      uint64_t(ptr));
   return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.ConstantPoolType);
 }
 
 Constant* JavaJITCompiler::getMethodInClass(JavaMethod* meth) {
-  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                      (int64_t)meth);
   return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.JavaMethodType);
 }
 
 Constant* JavaJITCompiler::getString(JavaString* str) {
   assert(str && "No string given");
-  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                      uint64(str));
   return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.JavaObjectType);
 }
@@ -159,7 +159,7 @@
 Constant* JavaJITCompiler::getStringPtr(JavaString** str) {
   assert(str && "No string given");
   const llvm::Type* Ty = PointerType::getUnqual(JavaIntrinsics.JavaObjectType);
-  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                      uint64(str));
   return ConstantExpr::getIntToPtr(CI, Ty);
 }
@@ -167,7 +167,7 @@
 Constant* JavaJITCompiler::getJavaClass(CommonClass* cl) {
   JavaObject* obj = cl->getClassDelegatee(JavaThread::get()->getJVM());
   assert(obj && "Delegatee not created");
-  Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+  Constant* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                   uint64(obj));
   return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.JavaObjectType);
 }
@@ -176,7 +176,7 @@
   Jnjvm* vm = JavaThread::get()->getJVM();
   JavaObject* const* obj = cl->getClassDelegateePtr(vm);
   assert(obj && "Delegatee not created");
-  Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+  Constant* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                   uint64(obj));
   const Type* Ty = PointerType::getUnqual(JavaIntrinsics.JavaObjectType);
   return ConstantExpr::getIntToPtr(CI, Ty);
@@ -192,7 +192,7 @@
 }
 
 Constant* JavaJITCompiler::getFinalObject(JavaObject* obj, CommonClass* cl) {
-  Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+  Constant* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                   uint64(obj));
   return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.JavaObjectType);
 }
@@ -212,7 +212,7 @@
     }
     classDef->release();
   }
-  Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+  Constant* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                   (uint64_t(obj)));
   return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.ptrType);
 }
@@ -223,7 +223,7 @@
     LCI->getVirtualType();
   }
   
-  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                      uint64_t(VT));
   return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.VTType);
 }
@@ -234,7 +234,7 @@
   
   assert(ptr && "No native function given");
 
-  Constant* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+  Constant* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                   uint64_t(ptr));
   return ConstantExpr::getIntToPtr(CI, valPtrType);
 }
@@ -262,7 +262,7 @@
 
 #ifdef SERVICE
 Value* JavaJITCompiler::getIsolate(Jnjvm* isolate, Value* Where) {
-  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),
+  ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()),
                                      uint64_t(isolate));
   return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.ptrType);
 }

Modified: vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=96804&r1=96803&r2=96804&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp Mon Feb 22 15:39:15 2010
@@ -1996,7 +1996,7 @@
                                    args, args + 2, "", currentBlock);
 #endif
 
-          LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[charId];
+          LLVMAssessorInfo& LAI = TheCompiler->AssessorInfo[charId];
           sizeElement = ConstantInt::get(Type::getInt32Ty(*llvmContext),
                                                     LAI.logSizeInBytesConstant);
           if (TheCompiler->isStaticCompiling() &&

Modified: vmkit/trunk/lib/J3/Compiler/JavaLLVMCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaLLVMCompiler.cpp?rev=96804&r1=96803&r2=96804&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaLLVMCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaLLVMCompiler.cpp Mon Feb 22 15:39:15 2010
@@ -34,6 +34,7 @@
 #else
   cooperativeGC = false;
 #endif
+  initialiseAssessorInfo();
 }
   
 void JavaLLVMCompiler::resolveVirtualClass(Class* cl) {

Modified: vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp?rev=96804&r1=96803&r2=96804&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp Mon Feb 22 15:39:15 2010
@@ -55,7 +55,7 @@
         JavaField& field = classDef->virtualFields[i];
         field.num = i + 1;
         Typedef* type = field.getSignature();
-        LLVMAssessorInfo& LAI = JavaLLVMCompiler::getTypedefInfo(type);
+        LLVMAssessorInfo& LAI = Mod->getTypedefInfo(type);
         fields.push_back(LAI.llvmType);
       }
     
@@ -104,7 +104,7 @@
       JavaField& field = classDef->staticFields[i];
       field.num = i;
       Typedef* type = field.getSignature();
-      LLVMAssessorInfo& LAI = JavaLLVMCompiler::getTypedefInfo(type);
+      LLVMAssessorInfo& LAI = Mod->getTypedefInfo(type);
       fields.push_back(LAI.llvmType);
     }
   
@@ -248,16 +248,15 @@
 
     for (uint32 i = 0; i < size; ++i) {
       Typedef* type = arguments[i];
-      LLVMAssessorInfo& LAI = JavaLLVMCompiler::getTypedefInfo(type);
+      LLVMAssessorInfo& LAI = Mod->getTypedefInfo(type);
       llvmArgs.push_back(LAI.llvmType);
     }
 
 #if defined(ISOLATE_SHARING)
-    llvmArgs.push_back(J3Intrinsics::ConstantPoolType); // cached constant pool
+    llvmArgs.push_back(Mod->getIntrinsics()->ConstantPoolType);
 #endif
 
-    LLVMAssessorInfo& LAI = 
-      JavaLLVMCompiler::getTypedefInfo(signature->getReturnType());
+    LLVMAssessorInfo& LAI = Mod->getTypedefInfo(signature->getReturnType());
     virtualType = FunctionType::get(LAI.llvmType, llvmArgs, false);
     mvm::MvmModule::unprotectIR();
   }
@@ -271,10 +270,12 @@
     std::vector<const llvm::Type*> llvmArgs;
     uint32 size = signature->nbArguments;
     Typedef* const* arguments = signature->getArgumentsType();
+    JavaLLVMCompiler* Mod = 
+      (JavaLLVMCompiler*)signature->initialLoader->getCompiler();
 
     for (uint32 i = 0; i < size; ++i) {
       Typedef* type = arguments[i];
-      LLVMAssessorInfo& LAI = JavaLLVMCompiler::getTypedefInfo(type);
+      LLVMAssessorInfo& LAI = Mod->getTypedefInfo(type);
       llvmArgs.push_back(LAI.llvmType);
     }
 
@@ -283,8 +284,7 @@
     llvmArgs.push_back(Mod->getIntrinsics()->ConstantPoolType);
 #endif
 
-    LLVMAssessorInfo& LAI = 
-      JavaLLVMCompiler::getTypedefInfo(signature->getReturnType());
+    LLVMAssessorInfo& LAI = Mod->getTypedefInfo(signature->getReturnType());
     staticType = FunctionType::get(LAI.llvmType, llvmArgs, false);
     mvm::MvmModule::unprotectIR();
   }
@@ -309,7 +309,7 @@
 
     for (uint32 i = 0; i < size; ++i) {
       Typedef* type = arguments[i];
-      LLVMAssessorInfo& LAI = JavaLLVMCompiler::getTypedefInfo(type);
+      LLVMAssessorInfo& LAI = Mod->getTypedefInfo(type);
       const llvm::Type* Ty = LAI.llvmType;
       if (Ty == Mod->getIntrinsics()->JavaObjectType) {
         llvmArgs.push_back(LAI.llvmTypePtr);
@@ -323,8 +323,7 @@
     llvmArgs.push_back(Mod->getIntrinsics()->ConstantPoolType);
 #endif
 
-    LLVMAssessorInfo& LAI = 
-      JavaLLVMCompiler::getTypedefInfo(signature->getReturnType());
+    LLVMAssessorInfo& LAI = Mod->getTypedefInfo(signature->getReturnType());
     const llvm::Type* RetType =
       LAI.llvmType == Mod->getIntrinsics()->JavaObjectType ?
         LAI.llvmTypePtr : LAI.llvmType;
@@ -378,7 +377,7 @@
   Typedef* const* arguments = signature->getArgumentsType();
   for (uint32 i = 0; i < signature->nbArguments; ++i) {
   
-    LLVMAssessorInfo& LAI = JavaLLVMCompiler::getTypedefInfo(arguments[i]);
+    LLVMAssessorInfo& LAI = Mod->getTypedefInfo(arguments[i]);
     Value* arg = new LoadInst(ptr, "", currentBlock);
     
     if (arguments[i]->isReference()) {
@@ -402,7 +401,7 @@
       currentBlock = endBlock;
       arg = node;
     } else if (arguments[i]->isFloat()) {
-      arg = new TruncInst(arg, LLVMAssessorInfo::AssessorInfo[I_INT].llvmType,
+      arg = new TruncInst(arg, Mod->AssessorInfo[I_INT].llvmType,
                           "", currentBlock);
       arg = new BitCastInst(arg, LAI.llvmType, "", currentBlock);
     } else if (arguments[i]->isDouble()) {
@@ -468,7 +467,7 @@
 
   Typedef* const* arguments = signature->getArgumentsType();
   for (uint32 i = 0; i < signature->nbArguments; ++i) {
-    LLVMAssessorInfo& LAI = JavaLLVMCompiler::getTypedefInfo(arguments[i]);
+    LLVMAssessorInfo& LAI = Mod->getTypedefInfo(arguments[i]);
     Value* arg = new VAArgInst(ap, LAI.llvmType, "", currentBlock);
     if (arguments[i]->isReference()) {
       arg = new IntToPtrInst(arg, Intrinsics.JavaObjectType, "", currentBlock);
@@ -621,9 +620,8 @@
     Args.push_back(Mod->getIntrinsics()->ConstantPoolType); // ctp
     Args.push_back(getVirtualPtrType());
     Args.push_back(Mod->getIntrinsics()->JavaObjectType);
-    Args.push_back(LLVMAssessorInfo::AssessorInfo[I_LONG].llvmTypePtr);
-    LLVMAssessorInfo& LAI = 
-      JavaLLVMCompiler::getTypedefInfo(signature->getReturnType());
+    Args.push_back(Mod->AssessorInfo[I_LONG].llvmTypePtr);
+    LLVMAssessorInfo& LAI = Mod->getTypedefInfo(signature->getReturnType());
     virtualBufType = FunctionType::get(LAI.llvmType, Args, false);
     mvm::MvmModule::unprotectIR();
   }
@@ -639,9 +637,8 @@
     std::vector<const llvm::Type*> Args;
     Args.push_back(Mod->getIntrinsics()->ConstantPoolType); // ctp
     Args.push_back(getStaticPtrType());
-    Args.push_back(LLVMAssessorInfo::AssessorInfo[I_LONG].llvmTypePtr);
-    LLVMAssessorInfo& LAI = 
-      JavaLLVMCompiler::getTypedefInfo(signature->getReturnType());
+    Args.push_back(Mod->AssessorInfo[I_LONG].llvmTypePtr);
+    LLVMAssessorInfo& LAI = Mod->getTypedefInfo(signature->getReturnType());
     staticBufType = FunctionType::get(LAI.llvmType, Args, false);
     mvm::MvmModule::unprotectIR();
   }
@@ -767,49 +764,49 @@
   return virtualStubFunction;
 }
 
-void LLVMAssessorInfo::initialise() {
-  AssessorInfo[I_VOID].llvmType = Type::getVoidTy(getGlobalContext());
+void JavaLLVMCompiler::initialiseAssessorInfo() {
+  AssessorInfo[I_VOID].llvmType = Type::getVoidTy(getLLVMContext());
   AssessorInfo[I_VOID].llvmTypePtr = 0;
   AssessorInfo[I_VOID].logSizeInBytesConstant = 0;
   
-  AssessorInfo[I_BOOL].llvmType = Type::getInt8Ty(getGlobalContext());
+  AssessorInfo[I_BOOL].llvmType = Type::getInt8Ty(getLLVMContext());
   AssessorInfo[I_BOOL].llvmTypePtr =
-    PointerType::getUnqual(Type::getInt8Ty(getGlobalContext()));
+    PointerType::getUnqual(Type::getInt8Ty(getLLVMContext()));
   AssessorInfo[I_BOOL].logSizeInBytesConstant = 0;
   
-  AssessorInfo[I_BYTE].llvmType = Type::getInt8Ty(getGlobalContext());
+  AssessorInfo[I_BYTE].llvmType = Type::getInt8Ty(getLLVMContext());
   AssessorInfo[I_BYTE].llvmTypePtr =
-    PointerType::getUnqual(Type::getInt8Ty(getGlobalContext()));
+    PointerType::getUnqual(Type::getInt8Ty(getLLVMContext()));
   AssessorInfo[I_BYTE].logSizeInBytesConstant = 0;
   
-  AssessorInfo[I_SHORT].llvmType = Type::getInt16Ty(getGlobalContext());
+  AssessorInfo[I_SHORT].llvmType = Type::getInt16Ty(getLLVMContext());
   AssessorInfo[I_SHORT].llvmTypePtr =
-    PointerType::getUnqual(Type::getInt16Ty(getGlobalContext()));
+    PointerType::getUnqual(Type::getInt16Ty(getLLVMContext()));
   AssessorInfo[I_SHORT].logSizeInBytesConstant = 1;
   
-  AssessorInfo[I_CHAR].llvmType = Type::getInt16Ty(getGlobalContext());
+  AssessorInfo[I_CHAR].llvmType = Type::getInt16Ty(getLLVMContext());
   AssessorInfo[I_CHAR].llvmTypePtr =
-    PointerType::getUnqual(Type::getInt16Ty(getGlobalContext()));
+    PointerType::getUnqual(Type::getInt16Ty(getLLVMContext()));
   AssessorInfo[I_CHAR].logSizeInBytesConstant = 1;
   
-  AssessorInfo[I_INT].llvmType = Type::getInt32Ty(getGlobalContext());
+  AssessorInfo[I_INT].llvmType = Type::getInt32Ty(getLLVMContext());
   AssessorInfo[I_INT].llvmTypePtr =
-    PointerType::getUnqual(Type::getInt32Ty(getGlobalContext()));
+    PointerType::getUnqual(Type::getInt32Ty(getLLVMContext()));
   AssessorInfo[I_INT].logSizeInBytesConstant = 2;
   
-  AssessorInfo[I_FLOAT].llvmType = Type::getFloatTy(getGlobalContext());
+  AssessorInfo[I_FLOAT].llvmType = Type::getFloatTy(getLLVMContext());
   AssessorInfo[I_FLOAT].llvmTypePtr =
-    PointerType::getUnqual(Type::getFloatTy(getGlobalContext()));
+    PointerType::getUnqual(Type::getFloatTy(getLLVMContext()));
   AssessorInfo[I_FLOAT].logSizeInBytesConstant = 2;
   
-  AssessorInfo[I_LONG].llvmType = Type::getInt64Ty(getGlobalContext());
+  AssessorInfo[I_LONG].llvmType = Type::getInt64Ty(getLLVMContext());
   AssessorInfo[I_LONG].llvmTypePtr =
-    PointerType::getUnqual(Type::getInt64Ty(getGlobalContext()));
+    PointerType::getUnqual(Type::getInt64Ty(getLLVMContext()));
   AssessorInfo[I_LONG].logSizeInBytesConstant = 3;
   
-  AssessorInfo[I_DOUBLE].llvmType = Type::getDoubleTy(getGlobalContext());
+  AssessorInfo[I_DOUBLE].llvmType = Type::getDoubleTy(getLLVMContext());
   AssessorInfo[I_DOUBLE].llvmTypePtr =
-    PointerType::getUnqual(Type::getDoubleTy(getGlobalContext()));
+    PointerType::getUnqual(Type::getDoubleTy(getLLVMContext()));
   AssessorInfo[I_DOUBLE].logSizeInBytesConstant = 3;
   
   AssessorInfo[I_TAB].llvmType = PointerType::getUnqual(
@@ -823,10 +820,8 @@
   AssessorInfo[I_REF].logSizeInBytesConstant = sizeof(JavaObject*) == 8 ? 3 : 2;
 }
 
-std::map<const char, LLVMAssessorInfo> LLVMAssessorInfo::AssessorInfo;
-
 LLVMAssessorInfo& JavaLLVMCompiler::getTypedefInfo(const Typedef* type) {
-  return LLVMAssessorInfo::AssessorInfo[type->getKey()->elements[0]];
+  return AssessorInfo[type->getKey()->elements[0]];
 }
 
 LLVMSignatureInfo* JavaLLVMCompiler::getSignatureInfo(Signdef* sign) {





More information about the vmkit-commits mailing list