Revision
4499
Author
lsansonetti@apple.com
Date
2010-09-09 20:39:53 -0700 (Thu, 09 Sep 2010)

Log Message

look around some critical parts, to allow #load & friends to be re-entrant

Modified Paths

Diff

Modified: MacRuby/trunk/vm.cpp (4498 => 4499)


--- MacRuby/trunk/vm.cpp	2010-09-09 01:36:41 UTC (rev 4498)
+++ MacRuby/trunk/vm.cpp	2010-09-10 03:39:53 UTC (rev 4499)
@@ -615,6 +615,8 @@
     assert(func->use_empty());
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+    RoxorCoreLock lock;
+
     // Remove from cache.
     std::map<Function *, IMP>::iterator iter = JITcache.find(func);
     if (iter != JITcache.end()) {
@@ -3782,6 +3784,7 @@
 #else
     RoxorVM *vm = GET_VM();
     RoxorCompiler *compiler = RoxorCompiler::shared;
+    RoxorCoreLock lock;
 
     // Compile IR.
     if (binding != NULL) {
@@ -3804,6 +3807,7 @@
 //printf("interpret:\n");
 //func->dump();
 	// If the function can be interpreted, do it, then delete the IR.
+	lock.unlock();
 	ret = RoxorInterpreter::shared->interpret(func,
 		vm->get_current_top_object(), 0);
  	func->eraseFromParent();
@@ -3823,6 +3827,7 @@
 	mnode->flags = 0;
 
 	// Execute the function.
+	lock.unlock();
 	ret = ((VALUE(*)(VALUE, SEL))imp)(vm->get_current_top_object(), 0);
 
 	if (inside_eval) {