[pypy-commit] pypy stacklet: Fixes.
arigo
noreply at buildbot.pypy.org
Sun Aug 7 15:11:40 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: stacklet
Changeset: r46347:e8aad2e4ba9f
Date: 2011-08-07 15:12 +0200
http://bitbucket.org/pypy/pypy/changeset/e8aad2e4ba9f/
Log: Fixes.
diff --git a/pypy/module/_stacklet/interp_stacklet.py b/pypy/module/_stacklet/interp_stacklet.py
--- a/pypy/module/_stacklet/interp_stacklet.py
+++ b/pypy/module/_stacklet/interp_stacklet.py
@@ -1,5 +1,5 @@
import sys
-from pypy.rpython.lltypesystem import lltype, rffi
+from pypy.rpython.lltypesystem import lltype
from pypy.rlib import jit
from pypy.rlib.rstacklet import StackletThread
from pypy.rlib.objectmodel import we_are_translated
@@ -55,13 +55,13 @@
def __del__(self):
h = self.h
if h:
- self.h = self.get_null_handle()
+ self.h = self.sthread.get_null_handle()
self.sthread.destroy(h)
def consume_handle(self):
h = self.h
if h:
- self.h = self.get_null_handle()
+ self.h = self.sthread.get_null_handle()
if self is self.sthread.main_stacklet:
self.sthread.main_stacklet = None
return h
@@ -76,8 +76,10 @@
sthread = self.sthread
ec = sthread.ec
saved_frame_top = ec.topframeref
- h = sthread.switch(h)
- ec.topframeref = saved_frame_top
+ try:
+ h = sthread.switch(h)
+ finally:
+ ec.topframeref = saved_frame_top
return sthread.new_stacklet_object(h)
def is_pending(self, space):
@@ -125,7 +127,7 @@
main_stacklet_handle = h
else:
main_stacklet_handle = sthread.main_stacklet.h
- sthread.main_stacklet.h = NULLHANDLE
+ sthread.main_stacklet.h = sthread.get_null_handle()
sthread.main_stacklet = None
assert main_stacklet_handle
return main_stacklet_handle
@@ -139,7 +141,9 @@
start_state.w_callable = w_callable
start_state.args = __args__
saved_frame_top = ec.topframeref
- ec.topframeref = jit.vref_None
- h = sthread.new(new_stacklet_callback)
- ec.topframeref = saved_frame_top
+ try:
+ ec.topframeref = jit.vref_None
+ h = sthread.new(new_stacklet_callback)
+ finally:
+ ec.topframeref = saved_frame_top
return sthread.new_stacklet_object(h)
diff --git a/pypy/rlib/rstacklet.py b/pypy/rlib/rstacklet.py
--- a/pypy/rlib/rstacklet.py
+++ b/pypy/rlib/rstacklet.py
@@ -1,5 +1,5 @@
from pypy.rlib import _rffi_stacklet as _c
-from pypy.rpython.lltypesystem import lltype, rffi
+from pypy.rpython.lltypesystem import lltype, llmemory
class StackletThread(object):
@@ -16,7 +16,7 @@
self._thrd = lltype.nullptr(_c.thread_handle.TO)
_c.deletethread(thrd)
- def new(self, callback, arg=lltype.nullptr(rffi.VOIDP.TO)):
+ def new(self, callback, arg=llmemory.NULL):
return self._gcrootfinder.new(self._thrd, callback, arg)
new._annspecialcase_ = 'specialize:arg(1)'
More information about the pypy-commit
mailing list