[vmkit-commits] [vmkit] r121132 - in /vmkit/branches/multi-vm: include/mvm/VMKit.h lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/VMCore/VirtualTables.cpp lib/Mvm/Runtime/VMKit.cpp tools/j3/Main.cpp tools/vmjc/vmjc.cpp tools/vmkit/Launcher.cpp

Gael Thomas gael.thomas at lip6.fr
Tue Dec 7 04:25:19 PST 2010


Author: gthomas
Date: Tue Dec  7 06:25:19 2010
New Revision: 121132

URL: http://llvm.org/viewvc/llvm-project?rev=121132&view=rev
Log:
initialise the gc and MvmModule in vmkit

Modified:
    vmkit/branches/multi-vm/include/mvm/VMKit.h
    vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp
    vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp
    vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp
    vmkit/branches/multi-vm/tools/j3/Main.cpp
    vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp
    vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp

Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=121132&r1=121131&r2=121132&view=diff
==============================================================================
--- vmkit/branches/multi-vm/include/mvm/VMKit.h (original)
+++ vmkit/branches/multi-vm/include/mvm/VMKit.h Tue Dec  7 06:25:19 2010
@@ -5,6 +5,13 @@
 #include "mvm/Threads/CollectionRV.h"
 #include "mvm/VirtualMachine.h"
 
+#include "llvm/Target/TargetMachine.h"
+
+namespace llvm {
+  class Module;
+  class TargetMachine;
+}
+
 namespace mvm {
 class MethodInfo;
 class VMKit;
@@ -43,6 +50,11 @@
   /// allocator - Bump pointer allocator to allocate permanent memory of VMKit
   mvm::BumpPtrAllocator& allocator;
 
+	// initialise - initialise vmkit. If never called, will be called by the first constructor of vmkit
+	static void initialise(llvm::CodeGenOpt::Level = llvm::CodeGenOpt::Default,
+                         llvm::Module* TheModule = 0,
+                         llvm::TargetMachine* TheTarget = 0);
+
   VMKit(mvm::BumpPtrAllocator &Alloc);
 
 	LockNormal                   _vmkitLock;

Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp?rev=121132&r1=121131&r2=121132&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Tue Dec  7 06:25:19 2010
@@ -415,11 +415,8 @@
 // Helper function to run an executable with a JIT
 extern "C" int StartJnjvmWithJIT(int argc, char** argv, char* mainClass) {
   llvm::llvm_shutdown_obj X; 
-   
 
   mvm::BumpPtrAllocator Allocator;
-
-  mvm::MvmModule::initialise();
 	mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator);
 
   mvm::ThreadAllocator thallocator;

Modified: vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp?rev=121132&r1=121131&r2=121132&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Tue Dec  7 06:25:19 2010
@@ -30,7 +30,6 @@
 #include "Jnjvm.h"
 #include "JnjvmClassLoader.h"
 #include "LockedMap.h"
-#include "ReferenceQueue.h"
 #include "Zip.h"
 
 using namespace j3;

Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=121132&r1=121131&r2=121132&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original)
+++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Tue Dec  7 06:25:19 2010
@@ -2,6 +2,7 @@
 #include "mvm/VirtualMachine.h"
 #include "mvm/SystemThreads.h"
 #include "mvm/GC.h"
+#include "mvm/JIT.h"
 
 using namespace mvm;
 
@@ -14,14 +15,18 @@
 static SpinLock initedLock;
 static bool     inited = false;
 
-VMKit::VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) {
+void VMKit::initialise(llvm::CodeGenOpt::Level level, llvm::Module* TheModule, llvm::TargetMachine* TheTarget) {
 	initedLock.lock();
 	if(!inited) {
 		inited = true;
-		//mvm::MvmModule::initialise();
+		mvm::MvmModule::initialise(level, TheModule, TheTarget);
 		mvm::Collector::initialise();
 	}
 	initedLock.unlock();
+}
+
+VMKit::VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) {
+	initialise();
 
 	vms          = 0;
 	vmsArraySize = 0;

Modified: vmkit/branches/multi-vm/tools/j3/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/j3/Main.cpp?rev=121132&r1=121131&r2=121132&view=diff
==============================================================================
--- vmkit/branches/multi-vm/tools/j3/Main.cpp (original)
+++ vmkit/branches/multi-vm/tools/j3/Main.cpp Tue Dec  7 06:25:19 2010
@@ -29,18 +29,16 @@
   llvm::llvm_shutdown_obj X;  
 
   // Initialize base components.  
-  MvmModule::initialise();
-  Collector::initialise();
+  mvm::BumpPtrAllocator Allocator;
+	mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator);
   
   // Tell the compiler to run all optimizations.
   StandardCompileOpts = true;
  
   // Create the allocator that will allocate the bootstrap loader and the JVM.
-  mvm::BumpPtrAllocator Allocator;
   JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule");
   JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader")
     JnjvmBootstrapLoader(Allocator, Comp, true);
-	mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator);
   Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, loader);
  
   // Run the application. 

Modified: vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp?rev=121132&r1=121131&r2=121132&view=diff
==============================================================================
--- vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp (original)
+++ vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp Tue Dec  7 06:25:19 2010
@@ -118,7 +118,7 @@
     cl::PrintHelpMessage();
     return 0;
   }
-   
+
   // Disable cross-compiling for now.
   if (false) {
     Module* TheModule = new Module("bootstrap module",
@@ -168,18 +168,15 @@
                              getStringRepresentation());
 
 
-    mvm::MvmModule::initialise(CodeGenOpt::Default, TheModule, &Target);
+    mvm::VMKit::initialise(CodeGenOpt::Default, TheModule, &Target);
 #endif
-  } else {
-    mvm::MvmModule::initialise();
   }
 
   mvm::BumpPtrAllocator allocator;
+	mvm::VMKit* vmkit = new(allocator, "VMKit") mvm::VMKit(allocator);
 
   JavaAOTCompiler* Comp = new JavaAOTCompiler("AOT");
 
-	mvm::VMKit* vmkit = new(allocator, "VMKit") mvm::VMKit(allocator);
-
   JnjvmBootstrapLoader* loader = new(allocator, "Bootstrap loader")
     JnjvmBootstrapLoader(allocator, Comp, false);
 

Modified: vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp?rev=121132&r1=121131&r2=121132&view=diff
==============================================================================
--- vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp (original)
+++ vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Tue Dec  7 06:25:19 2010
@@ -68,7 +68,7 @@
   
 	mvm::BumpPtrAllocator Allocator;
 
-  mvm::MvmModule::initialise(Fast ? CodeGenOpt::None : CodeGenOpt::Aggressive);
+  mvm::VMKit::initialise(Fast ? CodeGenOpt::None : CodeGenOpt::Aggressive);
 	mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator);
 
   if (VMToRun == RunJava) {





More information about the vmkit-commits mailing list