[vmkit-commits] [vmkit] r59299 - in /vmkit/trunk: include/mvm/Threads/Thread.h include/mvm/VirtualMachine.h lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/GCMmap2/gcthread.h

Nicolas Geoffray nicolas.geoffray at lip6.fr
Fri Nov 14 04:15:05 PST 2008


Author: geoffray
Date: Fri Nov 14 06:15:05 2008
New Revision: 59299

URL: http://llvm.org/viewvc/llvm-project?rev=59299&view=rev
Log:
More support for ISOLATE and SERVICE.


Modified:
    vmkit/trunk/include/mvm/Threads/Thread.h
    vmkit/trunk/include/mvm/VirtualMachine.h
    vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp
    vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h

Modified: vmkit/trunk/include/mvm/Threads/Thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/Thread.h?rev=59299&r1=59298&r2=59299&view=diff

==============================================================================
--- vmkit/trunk/include/mvm/Threads/Thread.h (original)
+++ vmkit/trunk/include/mvm/Threads/Thread.h Fri Nov 14 06:15:05 2008
@@ -53,10 +53,26 @@
 };
 
 
+#ifdef ISOLATE
+/// ThreadIsolate - Threads implement this class in an isolate environment
+/// so that the ID can be loaded easely in LLVM compiled code.
+class ThreadIsolate {
+public:
+
+  /// IsolateID - The IsolateID of the virtual machine, put here for fast
+  /// access.
+  uint32 IsolateID;
+};
+#endif
+
 /// Thread - This class is the base of custom virtual machines' Thread classes.
 /// It provides static functions to manage threads. An instance of this class
 /// contains all thread-specific informations.
-class Thread : public CircularBase {
+class Thread : 
+#ifdef ISOLATE
+  public ThreadIsolate,
+#endif
+  public CircularBase {
 public:
   
   /// yield - Yield the processor to another thread.

Modified: vmkit/trunk/include/mvm/VirtualMachine.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/VirtualMachine.h?rev=59299&r1=59298&r2=59299&view=diff

==============================================================================
--- vmkit/trunk/include/mvm/VirtualMachine.h (original)
+++ vmkit/trunk/include/mvm/VirtualMachine.h Fri Nov 14 06:15:05 2008
@@ -18,6 +18,7 @@
 #include "mvm/Allocator.h"
 #include "mvm/CompilationUnit.h"
 #include "mvm/Object.h"
+#include "mvm/Threads/Locks.h"
 
 namespace mvm {
 

Modified: vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp?rev=59299&r1=59298&r2=59299&view=diff

==============================================================================
--- vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp (original)
+++ vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp Fri Nov 14 06:15:05 2008
@@ -132,7 +132,9 @@
 ///
 void Thread::internalThreadStart(mvm::Thread* th) {
   th->baseSP  = (void*)&th;
-
+#ifdef ISOLATE
+  th->IsolateID = th->vm->IsolateID;
+#endif
   Collector::inject_my_thread(th); 
   th->routine(th);
   Collector::remove_my_thread(th);

Modified: vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h?rev=59299&r1=59298&r2=59299&view=diff

==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gcthread.h Fri Nov 14 06:15:05 2008
@@ -47,7 +47,7 @@
 };
 
 class GCThread {
-  /// _globalLoc - Global lock for gcmalloc.
+  /// _globalLock - Global lock for gcmalloc.
   GCLockRecovery _globalLock;
 
   /// _stackLock - Stack lock for synchronization.
@@ -114,6 +114,9 @@
     th->remove();
     _nb_threads--;
     if (!_nb_threads) base = 0;
+#ifdef SERVICE
+    th->theVM->numThreads--;
+#endif
     unlock();
   }
 
@@ -124,6 +127,9 @@
     else
       base = th;
     _nb_threads++;
+#ifdef SERVICE
+    th->theVM->numThreads++;
+#endif
     unlock();
   }
 };





More information about the vmkit-commits mailing list