[vmkit-commits] [vmkit] r139081 - in /vmkit/trunk: include/mvm/System.h include/mvm/Threads/ObjectLocks.h lib/Mvm/CommonThread/ObjectLocks.cpp lib/Mvm/CommonThread/ctthread.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sat Sep 3 05:56:24 PDT 2011


Author: geoffray
Date: Sat Sep  3 07:56:23 2011
New Revision: 139081

URL: http://llvm.org/viewvc/llvm-project?rev=139081&view=rev
Log:
Support wider thread ID for Macos/x64. Also remove the sigsegv handler, which is not helping when debugging.


Modified:
    vmkit/trunk/include/mvm/System.h
    vmkit/trunk/include/mvm/Threads/ObjectLocks.h
    vmkit/trunk/lib/Mvm/CommonThread/ObjectLocks.cpp
    vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp

Modified: vmkit/trunk/include/mvm/System.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/System.h?rev=139081&r1=139080&r2=139081&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/System.h (original)
+++ vmkit/trunk/include/mvm/System.h Sat Sep  3 07:56:23 2011
@@ -12,7 +12,6 @@
 
 #include <csetjmp>
 #include <cstring>
-#include <csetjmp>
 #include <dlfcn.h>
 #include <stdint.h>
 
@@ -53,10 +52,10 @@
 
 
 
-#if 0//def ARCH_X64
-const intptr_t kThreadStart = 0x110000000;
-const intptr_t kThreadIDMask = 0xF7FF00000;
-const uintptr_t kMvmThreadMask = 0xFF0000000;
+#if MACOS_OS && ARCH_X64
+const intptr_t kThreadStart = 0x110000000LL;
+const intptr_t kThreadIDMask = 0xF7FF00000LL;
+const uintptr_t kMvmThreadMask = 0xFF0000000LL;
 #else
 const intptr_t kThreadStart = 0x10000000;
 const intptr_t kThreadIDMask = 0x7FF00000;
@@ -68,16 +67,24 @@
   #define SETJMP _setjmp
   #define DYLD_EXTENSION ".dylib"
   #define SELF_HANDLE RTLD_DEFAULT
-  const uintptr_t kGCMemoryStart = 0x30000000;
 #else
   #define LONGJMP longjmp
   #define SETJMP setjmp
   #define DYLD_EXTENSION ".so"
   #define SELF_HANDLE 0
+#endif
+
+#if MACOS_OS
+  #if ARCH_X64
+    const uintptr_t kGCMemoryStart = 0x300000000LL;
+  #else
+    const uintptr_t kGCMemoryStart = 0x30000000;
+  #endif
+#else
   const uintptr_t kGCMemoryStart = 0x50000000;
 #endif
 
-static const uintptr_t kGCMemorySize = 0x30000000;  
+const uintptr_t kGCMemorySize = 0x30000000;  
 
 #define TRY { mvm::ExceptionBuffer __buffer__; if (!SETJMP(__buffer__.buffer))
 #define CATCH else

Modified: vmkit/trunk/include/mvm/Threads/ObjectLocks.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/ObjectLocks.h?rev=139081&r1=139080&r2=139081&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Threads/ObjectLocks.h (original)
+++ vmkit/trunk/include/mvm/Threads/ObjectLocks.h Sat Sep  3 07:56:23 2011
@@ -80,7 +80,7 @@
   uintptr_t getID();
   int tryAcquire() { return internalLock.tryLock(); }
   bool acquire(gc* object);
-  void acquireAll(gc* object, uint32_t count);
+  void acquireAll(gc* object, uintptr_t count);
   void release(gc* object, LockSystem& table);
   mvm::Thread* getOwner();
   bool owner();
@@ -161,14 +161,14 @@
   //    1           11                    12                  8
   // fat lock    thread id       thin lock count + hash     GC bits
 
-  static const uint64_t FatMask = 1 << 31;
+  static const uint64_t FatMask = 1LL << (kThreadStart > 0xFFFFFFFFLL ? 61LL : 31LL);
 
   static const uint32_t NonLockBits = HashBits + GCBits;
-  static const uint64_t NonLockBitsMask = ((1 << NonLockBits) - 1);
+  static const uint64_t NonLockBitsMask = ((1LL << NonLockBits) - 1LL);
 
   static const uint64_t ThinCountMask = ~(FatMask + kThreadIDMask + NonLockBitsMask);
   static const uint64_t ThinCountShift = NonLockBits;
-  static const uint64_t ThinCountAdd = 1 << NonLockBits;
+  static const uint64_t ThinCountAdd = 1LL << NonLockBits;
 
   /// initialise - Initialise the value of the lock.
   ///

Modified: vmkit/trunk/lib/Mvm/CommonThread/ObjectLocks.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ObjectLocks.cpp?rev=139081&r1=139080&r2=139081&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/CommonThread/ObjectLocks.cpp (original)
+++ vmkit/trunk/lib/Mvm/CommonThread/ObjectLocks.cpp Sat Sep  3 07:56:23 2011
@@ -240,7 +240,7 @@
   }
 }
 
-void FatLock::acquireAll(gc* object, uint32 nb) {
+void FatLock::acquireAll(gc* object, uintptr_t nb) {
   assert(associatedObject == object);
   llvm_gcroot(object, 0);
   internalLock.lockAll(nb);

Modified: vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp?rev=139081&r1=139080&r2=139081&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp (original)
+++ vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp Sat Sep  3 07:56:23 2011
@@ -318,8 +318,6 @@
 /// machine specific.
 StackThreadManager TheStackManager;
 
-extern void sigsegvHandler(int, siginfo_t*, void*);
-
 /// internalThreadStart - The initial function called by a thread. Sets some
 /// thread specific data, registers the thread to the GC and calls the
 /// given routine of th.
@@ -327,16 +325,6 @@
 void Thread::internalThreadStart(mvm::Thread* th) {
   th->baseSP  = System::GetCallerAddress();
 
-  // Set the SIGSEGV handler to diagnose errors.
-  struct sigaction sa;
-  sigset_t mask;
-  sigfillset(&mask);
-  sa.sa_flags = SA_SIGINFO;
-  sa.sa_mask = mask;
-  sa.sa_sigaction = sigsegvHandler;
-  sigaction(SIGSEGV, &sa, NULL);
-
-
   assert(th->MyVM && "VM not set in a thread");
   th->MyVM->rendezvous.addThread(th);
   th->routine(th);





More information about the vmkit-commits mailing list