[vmkit-commits] [vmkit] r84126 - in /vmkit/trunk/lib/N3/VMCore: CLIRuntimeJIT.cpp N3.cpp VMCache.cpp VMThread.cpp VMThread.h VirtualTables.cpp

Gael Thomas gael.thomas at lip6.fr
Wed Oct 14 12:11:51 PDT 2009


Author: gthomas
Date: Wed Oct 14 14:11:51 2009
New Revision: 84126

URL: http://llvm.org/viewvc/llvm-project?rev=84126&view=rev
Log:
pendingException is safe


Modified:
    vmkit/trunk/lib/N3/VMCore/CLIRuntimeJIT.cpp
    vmkit/trunk/lib/N3/VMCore/N3.cpp
    vmkit/trunk/lib/N3/VMCore/VMCache.cpp
    vmkit/trunk/lib/N3/VMCore/VMThread.cpp
    vmkit/trunk/lib/N3/VMCore/VMThread.h
    vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp

Modified: vmkit/trunk/lib/N3/VMCore/CLIRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIRuntimeJIT.cpp?rev=84126&r1=84125&r2=84126&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIRuntimeJIT.cpp Wed Oct 14 14:11:51 2009
@@ -72,7 +72,8 @@
 }
 
 extern "C" VMObject* GetCLIException() {
-  return VMThread::getCLIException();
+	declare_gcroot(VMObject*, res) = VMThread::getCLIException();
+  return res;
 }
 
 extern "C" bool CompareException(VMClass* cl) {

Modified: vmkit/trunk/lib/N3/VMCore/N3.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/N3.cpp?rev=84126&r1=84125&r2=84126&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/N3.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/N3.cpp Wed Oct 14 14:11:51 2009
@@ -327,7 +327,7 @@
   try{
     vm->executeAssembly(info.assembly, args);
   }catch(...) {
-    VMObject* exc = th->pendingException;
+    declare_gcroot(VMObject*, exc) = th->ooo_pendingException;
     printf("N3 caught %s\n", mvm::PrintBuffer(exc).cString());
   }
 

Modified: vmkit/trunk/lib/N3/VMCore/VMCache.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMCache.cpp?rev=84126&r1=84125&r2=84126&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMCache.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VMCache.cpp Wed Oct 14 14:11:51 2009
@@ -36,7 +36,7 @@
   if (lastCible) {
     lastCible->print(buf);
     buf->write(" -- ");
-		buf->writePtr(methPtr - 1);
+		buf->writePtr(methPtr);
   }
   buf->write(" in ");
   enveloppe->print(buf);

Modified: vmkit/trunk/lib/N3/VMCore/VMThread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMThread.cpp?rev=84126&r1=84125&r2=84126&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMThread.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VMThread.cpp Wed Oct 14 14:11:51 2009
@@ -49,7 +49,7 @@
   this->varcond = new mvm::Cond();
   this->interruptFlag = 0;
   this->state = StateRunning;
-  this->pendingException = 0;
+  this->ooo_pendingException = 0;
   this->perFunctionPasses = new llvm::FunctionPassManager(vm->TheModuleProvider);
   this->perFunctionPasses->add(new llvm::TargetData(vm->getLLVMModule()));
   AddStandardCompilePasses(this->perFunctionPasses);
@@ -70,7 +70,8 @@
 
 VMObject* VMThread::getCLIException() {
   VMThread* th = VMThread::get();
-  return th->pendingException;
+	declare_gcroot(VMObject *, pendingException) = th->ooo_pendingException;
+  return pendingException;
 }
 
 extern "C" void* __cxa_allocate_exception(unsigned);
@@ -78,21 +79,22 @@
 
 
 void VMThread::throwException(VMObject* obj) {
+	llvm_gcroot(obj, 0);
   VMThread* th = VMThread::get();
-  assert(th->pendingException == 0 && "pending exception already there?");
-  th->pendingException = obj;
+  assert(th->ooo_pendingException == 0 && "pending exception already there?");
+  th->ooo_pendingException = obj;
   void* exc = __cxa_allocate_exception(0);
   th->internalPendingException = exc;
   __cxa_throw(exc, 0, 0); 
 }
 
 void VMThread::internalClearException() {
-  pendingException = 0;
+  ooo_pendingException = 0;
   internalPendingException = 0;
 }
 
 bool VMThread::compareException(VMClass* cl) {
-  VMObject* pe = VMThread::get()->pendingException;
+  declare_gcroot(VMObject*, pe) = VMThread::get()->ooo_pendingException;
   assert(pe && "no pending exception?");
   return pe->classOf->subclassOf(cl);
 }

Modified: vmkit/trunk/lib/N3/VMCore/VMThread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMThread.h?rev=84126&r1=84125&r2=84126&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMThread.h (original)
+++ vmkit/trunk/lib/N3/VMCore/VMThread.h Wed Oct 14 14:11:51 2009
@@ -35,10 +35,10 @@
     return (N3*)MyVM;
   }
   
-  mvm::Lock* lock;
-  mvm::Cond* varcond;
-  VMObject* pendingException;
-  void* internalPendingException;
+  mvm::Lock*   lock;
+  mvm::Cond*   varcond;
+  VMObject*    ooo_pendingException;
+  void*        internalPendingException;
   unsigned int interruptFlag;
   unsigned int state;
   

Modified: vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp?rev=84126&r1=84125&r2=84126&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp Wed Oct 14 14:11:51 2009
@@ -29,7 +29,6 @@
 
 // N3 Objects
 void VMObject::_trace(VMObject *self) {
-	llvm_gcroot(self, 0);
   self->lockObj->MARK_AND_TRACE;
 }
 
@@ -46,7 +45,7 @@
 // internal objects
 void VMThread::TRACER {
   ooo_appThread->MARK_AND_TRACE;
-  pendingException->MARK_AND_TRACE;
+  ooo_pendingException->MARK_AND_TRACE;
 	// I suppose that the vm is already traced by the gc
 	//  vm->CALL_TRACER;
 }





More information about the vmkit-commits mailing list