[pypy-commit] pypy stacklet: Fix.
arigo
noreply at buildbot.pypy.org
Sat Aug 6 16:25:30 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: stacklet
Changeset: r46324:774af80dfc9b
Date: 2011-08-06 16:26 +0200
http://bitbucket.org/pypy/pypy/changeset/774af80dfc9b/
Log: Fix.
diff --git a/pypy/rlib/_stacklet_asmgcc.py b/pypy/rlib/_stacklet_asmgcc.py
--- a/pypy/rlib/_stacklet_asmgcc.py
+++ b/pypy/rlib/_stacklet_asmgcc.py
@@ -194,6 +194,9 @@
@staticmethod
def set_handle_on_most_recent(h):
index = suspendedstacks.current_index
- if index >= 0:
+ if not h or rstacklet.is_empty_handle(h):
+ assert index == -1
+ else:
+ assert index >= 0
suspendedstacks.lst[index].handle = h
suspendedstacks.current_index = -1
diff --git a/pypy/rlib/rstacklet.py b/pypy/rlib/rstacklet.py
--- a/pypy/rlib/rstacklet.py
+++ b/pypy/rlib/rstacklet.py
@@ -78,15 +78,15 @@
new._annspecialcase_ = 'specialize:arg(2)'
def _new_callback():
- return _new(starter.thrd, llhelper(run_fn, _new_runfn),
- lltype.nullptr(rffi.VOIDP.TO))
+ h = _new(starter.thrd, llhelper(run_fn, _new_runfn),
+ lltype.nullptr(rffi.VOIDP.TO))
+ starter.c.set_handle_on_most_recent(h)
+ return h
def _new_runfn(h, arg):
llop.gc_stack_bottom(lltype.Void) # marker for trackgcroot.py
starter.c.set_handle_on_most_recent(h)
- h = starter.runfn(h, starter.arg)
- starter.c.set_handle_on_most_recent(h)
- return h
+ return starter.runfn(h, starter.arg)
def switch(gcrootfinder, thrd, h):
starter.thrd = thrd
diff --git a/pypy/rlib/test/test_rstacklet.py b/pypy/rlib/test/test_rstacklet.py
--- a/pypy/rlib/test/test_rstacklet.py
+++ b/pypy/rlib/test/test_rstacklet.py
@@ -192,7 +192,8 @@
class BaseTestStacklet(StandaloneTests):
def setup_class(cls):
- global GCROOTFINDER
+ global GCROOTFINDER, STATUSMAX
+ cls.old_values = GCROOTFINDER, STATUSMAX
from pypy.config.pypyoption import get_pypy_config
config = get_pypy_config(translating=True)
config.translation.gc = cls.gc
@@ -201,16 +202,19 @@
config.translation.gcrootfinder = cls.gcrootfinder
GCROOTFINDER = cls.gcrootfinder
cls.config = config
+ STATUSMAX = 25000
def teardown_class(cls):
- global GCROOTFINDER
- GCROOTFINDER = 'n/a'
+ global GCROOTFINDER, STATUSMAX
+ GCROOTFINDER, STATUSMAX = cls.old_values
def test_demo1(self):
t, cbuilder = self.compile(entry_point)
expected_data = "----- all done -----\n"
- for i in range(20):
+ for i in range(20, 3):
+ print 'running %s/%s with argument %d' % (
+ self.gc, self.gcrootfinder, i)
data = cbuilder.cmdexec('%d' % i, env={})
assert data.endswith(expected_data)
#data = cbuilder.cmdexec('%d' % i, env={'PYPY_GC_NURSERY': '10k'})
More information about the pypy-commit
mailing list