[vmkit-commits] [vmkit] r84755 - in /vmkit/trunk: lib/Mvm/Compiler/JIT.cpp mmtk/magic/LowerJavaRT.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Wed Oct 21 04:35:26 PDT 2009


Author: geoffray
Date: Wed Oct 21 06:35:26 2009
New Revision: 84755

URL: http://llvm.org/viewvc/llvm-project?rev=84755&view=rev
Log:
Add MMTk boot operations.


Modified:
    vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
    vmkit/trunk/mmtk/magic/LowerJavaRT.cpp

Modified: vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/JIT.cpp?rev=84755&r1=84754&r2=84755&view=diff

==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Wed Oct 21 06:35:26 2009
@@ -73,6 +73,8 @@
   }
 }
 
+typedef void (*BootType)(uintptr_t Plan);
+
 void MvmModule::initialise(CodeGenOpt::Level level, Module* M,
                            TargetMachine* T) {
   mvm::linkVmkitGC();
@@ -164,6 +166,30 @@
     F = dyn_cast<Function>(GA->getAliasee());
     gc::MMTkCheckAllocator = (gc::MMTkCheckAllocatorType)
       (uintptr_t)executionEngine->getPointerToFunction(F);
+    
+    GV = globalModule->getGlobalVariable("org_j3_config_Selected_4Plan_static", false);
+    assert(GV && "No global plan.");
+    uintptr_t Plan = *((uintptr_t*)executionEngine->getPointerToGlobal(GV));
+    
+    GA = dyn_cast<GlobalAlias>(globalModule->getNamedValue("MMTkPlanBoot"));
+    assert(GA && "Could not find MMTkPlanBoot alias");
+    F = dyn_cast<Function>(GA->getAliasee());
+    BootType Boot = (BootType)
+      (uintptr_t)executionEngine->getPointerToFunction(F);
+    Boot(Plan);
+    
+    GA = dyn_cast<GlobalAlias>(globalModule->getNamedValue("MMTkPlanPostBoot"));
+    assert(GA && "Could not find MMTkPlanPostBoot alias");
+    F = dyn_cast<Function>(GA->getAliasee());
+    Boot = (BootType)(uintptr_t)executionEngine->getPointerToFunction(F);
+    Boot(Plan);
+    
+    GA = dyn_cast<GlobalAlias>(globalModule->getNamedValue("MMTkPlanFullBoot"));
+    assert(GA && "Could not find MMTkPlanFullBoot alias");
+    F = dyn_cast<Function>(GA->getAliasee());
+    Boot = (BootType)(uintptr_t)executionEngine->getPointerToFunction(F);
+    Boot(Plan);
+
   }
 #endif
 }

Modified: vmkit/trunk/mmtk/magic/LowerJavaRT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/magic/LowerJavaRT.cpp?rev=84755&r1=84754&r2=84755&view=diff

==============================================================================
--- vmkit/trunk/mmtk/magic/LowerJavaRT.cpp (original)
+++ vmkit/trunk/mmtk/magic/LowerJavaRT.cpp Wed Oct 21 06:35:26 2009
@@ -142,8 +142,62 @@
   
   C = CA->getOperand(CheckAllocIndex);
   C = C->getOperand(0);
-  new GlobalAlias(C->getType(), GlobalValue::ExternalLinkage, "MMTkCheckAllocator",
+  new GlobalAlias(C->getType(), GlobalValue::ExternalLinkage,
+                  "MMTkCheckAllocator", C, &M);
+  
+
+
+  GV = M.getGlobalVariable("org_mmtk_plan_Plan_VT", false);
+  CA = dyn_cast<ConstantArray>(GV->getInitializer());
+
+  Function* Boot = M.getFunction("JnJVM_org_mmtk_plan_Plan_boot__");
+  Function* PostBoot = M.getFunction("JnJVM_org_mmtk_plan_Plan_postBoot__");
+  Function* FullBoot = M.getFunction("JnJVM_org_mmtk_plan_Plan_fullyBooted__");
+  Function* Exit = M.getFunction("JnJVM_org_mmtk_plan_Plan_notifyExit__I");
+  uint32_t BootIndex = 0;
+  uint32_t PostBootIndex = 0;
+  uint32_t FullBootIndex = 0;
+  uint32_t ExitIndex = 0;
+  for (uint32_t i = 0; i < CA->getNumOperands(); ++i) {
+    ConstantExpr* CE = dyn_cast<ConstantExpr>(CA->getOperand(i));
+    if (CE) {
+      C = CE->getOperand(0);
+      if (C == Boot) {
+        BootIndex = i;
+      } else if (C == PostBoot) {
+        PostBootIndex = i;
+      } else if (C == FullBoot) {
+        FullBootIndex = i;
+      } else if (C == Exit) {
+        ExitIndex = i;
+      }
+    }
+  }
+
+  GV = M.getGlobalVariable("org_j3_config_Selected_4Plan_VT", false);
+  assert(GV && "No Plan");
+  CA = dyn_cast<ConstantArray>(GV->getInitializer());
+  
+  C = CA->getOperand(BootIndex);
+  C = C->getOperand(0);
+  new GlobalAlias(C->getType(), GlobalValue::ExternalLinkage, "MMTkPlanBoot",
                   C, &M);
+  
+  C = CA->getOperand(PostBootIndex);
+  C = C->getOperand(0);
+  new GlobalAlias(C->getType(), GlobalValue::ExternalLinkage,
+                  "MMTkPlanPostBoot", C, &M);
+  
+  C = CA->getOperand(FullBootIndex);
+  C = C->getOperand(0);
+  new GlobalAlias(C->getType(), GlobalValue::ExternalLinkage,
+                  "MMTkPlanFullBoot", C, &M);
+  
+  C = CA->getOperand(ExitIndex);
+  C = C->getOperand(0);
+  new GlobalAlias(C->getType(), GlobalValue::ExternalLinkage, "MMTkPlanExit",
+                  C, &M);
+   
    
    
   return Changed;





More information about the vmkit-commits mailing list