[vmkit-commits] [vmkit] r121331 - in /vmkit/branches/multi-vm: include/mvm/VMKit.h include/mvm/VirtualMachine.h lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/Mvm/Runtime/VMKit.cpp tools/j3/Main.cpp tools/toy-vm/Main.cpp tools/vmkit/Launcher.cpp

Gael Thomas gael.thomas at lip6.fr
Wed Dec 8 16:29:16 PST 2010


Author: gthomas
Date: Wed Dec  8 18:29:16 2010
New Revision: 121331

URL: http://llvm.org/viewvc/llvm-project?rev=121331&view=rev
Log:
remove waitForExit from the vm and uses vmkit->waitNonDaemonThreads instead

Modified:
    vmkit/branches/multi-vm/include/mvm/VMKit.h
    vmkit/branches/multi-vm/include/mvm/VirtualMachine.h
    vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp
    vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp
    vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp
    vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h
    vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp
    vmkit/branches/multi-vm/tools/j3/Main.cpp
    vmkit/branches/multi-vm/tools/toy-vm/Main.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=121331&r1=121330&r2=121331&view=diff
==============================================================================
--- vmkit/branches/multi-vm/include/mvm/VMKit.h (original)
+++ vmkit/branches/multi-vm/include/mvm/VMKit.h Wed Dec  8 18:29:16 2010
@@ -129,6 +129,17 @@
 	// nonDaemonThreadsManager - manager of the non daemon threads
 	NonDaemonThreadManager       nonDaemonThreadsManager;
 
+	void registerPreparedThread(mvm::Thread* th);  
+	void unregisterPreparedThread(mvm::Thread* th);
+
+	void registerRunningThread(mvm::Thread* th);  
+	void unregisterRunningThread(mvm::Thread* th);
+
+	void waitNonDaemonThreads();
+
+	/// ------------------------------------------------- ///
+	/// ---             memory managment              --- ///
+	/// ------------------------------------------------- ///
   /// rendezvous - The rendezvous implementation for garbage collection.
   ///
 #ifdef WITH_LLVM_GCC
@@ -137,12 +148,6 @@
   UncooperativeCollectionRV    rendezvous;
 #endif
 
-	void registerPreparedThread(mvm::Thread* th);  
-	void unregisterPreparedThread(mvm::Thread* th);
-
-	void registerRunningThread(mvm::Thread* th);  
-	void unregisterRunningThread(mvm::Thread* th);
-
   /// enqueueThread - The thread that finalizes references.
   ///
 	FinalizerThread*             finalizerThread;
@@ -176,10 +181,6 @@
   ///
   void scanPhantomReferencesQueue(uintptr_t closure);
 
-	/// ------------------------------------------------- ///
-	/// ---             collection managment          --- ///
-	/// ------------------------------------------------- ///
-
 	bool startCollection(); // 1 ok, begin collection, 0 do not start collection
 	void endCollection();
 

Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121331&r1=121330&r2=121331&view=diff
==============================================================================
--- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original)
+++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Wed Dec  8 18:29:16 2010
@@ -68,9 +68,6 @@
 //   /// the arguments, hence it is the virtual machine's job to parse them.
 //   virtual void runApplication(int argc, char** argv) = 0;
   
-//   /// waitForExit - Wait until the virtual machine stops its execution.
-//   virtual void waitForExit() = 0;
-
 //===----------------------------------------------------------------------===//
 // (2) GC-related methods.
 //===----------------------------------------------------------------------===//

Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121331&r1=121330&r2=121331&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Wed Dec  8 18:29:16 2010
@@ -16,6 +16,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 #include "mvm/Threads/Thread.h"
+#include "mvm/VMKit.h"
 
 #include "j3/J3Intrinsics.h"
 #include "j3/JavaAOTCompiler.h"
@@ -2091,7 +2092,7 @@
   name = n;
 	vm->javaMainThread = JavaThread::create(vm);
   vm->javaMainThread->mut->start(mainCompilerStart);
-  vm->waitForExit();
+  vm->vmkit->waitNonDaemonThreads();
 }
 
 /// compileAllStubs - Compile all the native -> Java stubs. 

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=121331&r1=121330&r2=121331&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Wed Dec  8 18:29:16 2010
@@ -415,7 +415,7 @@
   JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule");
   Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, Comp, true);
   vm->runApplication(argc + 1, newArgv);
-  vm->waitForExit();
+  vmkit->waitNonDaemonThreads();
   
   return 0;
 }

Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121331&r1=121330&r2=121331&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec  8 18:29:16 2010
@@ -1245,10 +1245,6 @@
   } IGNORE;
 }
 
-void Jnjvm::waitForExit() { 
-	vmkit->nonDaemonThreadsManager.waitNonDaemonThreads();
-}
-
 void Jnjvm::mainJavaStart(mvm::Thread* thread) {
 
   JavaString* str = NULL;
@@ -1449,7 +1445,8 @@
   newArgv[1] = mainClass;
 
   vm->runApplication(argc + 1, newArgv);
-  vm->waitForExit();
+
+  vmkit->waitNonDaemonThreads();
   
   return 0; 
 }

Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121331&r1=121330&r2=121331&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Wed Dec  8 18:29:16 2010
@@ -286,10 +286,6 @@
   ///
   virtual void runApplication(int argc, char** argv);
 
-  /// waitForExit - Waits that there are no more non-daemon threads in this JVM.
-  ///
-  virtual void waitForExit();
-
 	/// buildVMThreadData - allocate a java thread for the underlying mutator. Called when the java thread is a foreign thread.
 	///
 	virtual mvm::VMThreadData* buildVMThreadData(mvm::Thread* mut);

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=121331&r1=121330&r2=121331&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original)
+++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Wed Dec  8 18:29:16 2010
@@ -201,6 +201,11 @@
 	vmkitUnlock();
 }
 
+void VMKit::waitNonDaemonThreads() { 
+	nonDaemonThreadsManager.waitNonDaemonThreads();
+}
+
+
 void NonDaemonThreadManager::leaveNonDaemonMode() {
   nonDaemonLock.lock();
   --nonDaemonThreads;

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=121331&r1=121330&r2=121331&view=diff
==============================================================================
--- vmkit/branches/multi-vm/tools/j3/Main.cpp (original)
+++ vmkit/branches/multi-vm/tools/j3/Main.cpp Wed Dec  8 18:29:16 2010
@@ -41,7 +41,7 @@
  
   // Run the application. 
   vm->runApplication(argc, argv);
-  vm->waitForExit();
+  vmkit->waitNonDamonThreads();
   exit(0);
 
   // Destroy everyone.

Modified: vmkit/branches/multi-vm/tools/toy-vm/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/toy-vm/Main.cpp?rev=121331&r1=121330&r2=121331&view=diff
==============================================================================
--- vmkit/branches/multi-vm/tools/toy-vm/Main.cpp (original)
+++ vmkit/branches/multi-vm/tools/toy-vm/Main.cpp Wed Dec  8 18:29:16 2010
@@ -15,7 +15,6 @@
 		virtual bool enqueueReference(mvm::gc*) { NI(); }
 		virtual size_t getObjectSize(mvm::gc*) { NI(); }
 		virtual void runApplication(int, char**) { NI(); }
-		virtual void waitForExit() { NI(); }
 	};
 
 	class ToyVMThread : public mvm::VMThreadData {

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=121331&r1=121330&r2=121331&view=diff
==============================================================================
--- vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp (original)
+++ vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Wed Dec  8 18:29:16 2010
@@ -75,8 +75,9 @@
     JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule");
     Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, Comp, true);
     vm->runApplication(argc, argv);
-    vm->waitForExit();
   }
 
+	vmkit->waitNonDaemonThreads();
+
   return 0;
 }





More information about the vmkit-commits mailing list