[llvm-commits] [vmkit] r51049 - in /vmkit/trunk/lib: JnJVM/VMCore/JavaBacktrace.cpp JnJVM/VMCore/JavaIsolate.cpp Mvm/BoehmGC/MvmGC.h Mvm/GCMmap2/gc.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue May 13 08:28:27 PDT 2008


Author: geoffray
Date: Tue May 13 10:28:27 2008
New Revision: 51049

URL: http://llvm.org/viewvc/llvm-project?rev=51049&view=rev
Log:
Use our own end of stack info.


Modified:
    vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
    vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h
    vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp?rev=51049&r1=51048&r2=51049&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp Tue May 13 10:28:27 2008
@@ -43,13 +43,11 @@
 #define FRAME_IP(fp) (fp[1])
 #endif
 
-extern void* __libc_stack_end;
-
 int JavaJIT::getBacktrace(void** stack, int size) {
   void** blah = (void**)__builtin_frame_address(1);
   int cpt = 0;
-  while (blah && cpt < size && blah < __libc_stack_end && 
-         !(((long) blah & 3))) {
+  void* baseSP = JavaThread::get()->baseSP;
+  while (blah && cpt < size && blah < baseSP) {
     stack[cpt++] = (void**)FRAME_IP(blah);
     blah = (void**)blah[0];
   }

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp?rev=51049&r1=51048&r2=51049&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Tue May 13 10:28:27 2008
@@ -460,11 +460,13 @@
   
   isolate->bootstrapThread = vm_new(isolate, JavaThread)();
   isolate->bootstrapThread->initialise(0, isolate);
+  void* baseSP = mvm::Thread::get()->baseSP;
 #ifdef MULTIPLE_GC
   isolate->bootstrapThread->GC = isolate->GC;
-  isolate->GC->inject_my_thread(0);
+  isolate->GC->inject_my_thread(baseSP);
   mvm::jit::memoryManager->addGCForModule(isolate->module, isolate->GC);
 #endif 
+  isolate->bootstrapThread->baseSP = baseSP;
   JavaThread::threadKey->set(isolate->bootstrapThread);
   
   isolate->threadSystem = vm_new(isolate, ThreadSystem)();
@@ -527,13 +529,15 @@
   
   isolate->bootstrapThread = vm_new(isolate, JavaThread)();
   isolate->bootstrapThread->initialise(0, isolate);
+  void* baseSP = mvm::Thread::get()->baseSP;
 #ifdef MULTIPLE_GC
   isolate->bootstrapThread->GC = isolate->GC;
 #ifndef SERVICE_VM
-  isolate->GC->inject_my_thread(0);
+  isolate->GC->inject_my_thread(baseSP);
 #endif
   mvm::jit::memoryManager->addGCForModule(isolate->module, isolate->GC);
 #endif 
+  isolate->bootstrapThread->baseSP = baseSP;
   JavaThread::threadKey->set(isolate->bootstrapThread);
 
   isolate->name = "bootstrapVM";

Modified: vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h?rev=51049&r1=51048&r2=51049&view=diff

==============================================================================
--- vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h (original)
+++ vmkit/trunk/lib/Mvm/BoehmGC/MvmGC.h Tue May 13 10:28:27 2008
@@ -78,6 +78,7 @@
   typedef void (*markerFn)(void*);
   
   static void initialise(markerFn mark, void *base_sp) {
+    mvm::Thread::get()->baseSP = base_sp;
     GC_INIT();
   }
   static void destroy() {}
@@ -110,6 +111,7 @@
   }
   
   static void inject_my_thread(void *sp) {
+    mvm::Thread::get()->baseSP = base_sp;
     GC_init();
   }
   

Modified: vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp?rev=51049&r1=51048&r2=51049&view=diff

==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp Tue May 13 10:28:27 2008
@@ -116,6 +116,7 @@
   GCCollector::initialise(marker);
   GCCollector::inject_my_thread(base_sp);
 #endif
+  mvm::Thread::get()->baseSP = base_sp;
 }
 
 void Collector::destroy() {
@@ -126,6 +127,7 @@
 #ifdef HAVE_PTHREAD
   COLLECTOR inject_my_thread(base_sp);
 #endif
+  mvm::Thread::get()->baseSP = base_sp;
 }
 
 void Collector::maybeCollect() {





More information about the llvm-commits mailing list