[pypy-svn] r67170 - in pypy/branch/pyjitpl5-noframestack/pypy: interpreter module/_stackless
arigo at codespeak.net
arigo at codespeak.net
Mon Aug 24 18:02:37 CEST 2009
Author: arigo
Date: Mon Aug 24 18:02:36 2009
New Revision: 67170
Modified:
pypy/branch/pyjitpl5-noframestack/pypy/interpreter/executioncontext.py
pypy/branch/pyjitpl5-noframestack/pypy/module/_stackless/interp_coroutine.py
Log:
Some fixes.
Modified: pypy/branch/pyjitpl5-noframestack/pypy/interpreter/executioncontext.py
==============================================================================
--- pypy/branch/pyjitpl5-noframestack/pypy/interpreter/executioncontext.py (original)
+++ pypy/branch/pyjitpl5-noframestack/pypy/interpreter/executioncontext.py Mon Aug 24 18:02:36 2009
@@ -73,6 +73,7 @@
f_back.f_forward = None
if not we_are_jitted() or self.some_frame is frame:
self.some_frame = f_back
+ self.framestackdepth -= 1
if self.w_tracefunc is not None and not frame.hide():
self.space.frame_trace_action.fire()
@@ -112,20 +113,19 @@
# the following interface is for pickling and unpickling
def getstate(self, space):
- # we just save the top frame, which brings the whole frame stack
- f = self.topframe
- return space.wrap(f)
-
- def setstate(self, space, w_frame):
- f = space.interp_w(PyFrame, w_frame)
- self.topframe = f
- count = 0
- if f:
- count = 1
- while f.f_back:
- count += 1
- f = f.f_back
- self.framestackdepth = count
+ # XXX we could just save the top frame, which brings
+ # the whole frame stack, but right now we get the whole stack
+ items = [space.wrap(f) for f in self.getframestack()]
+ return space.newtuple(items)
+
+ def setstate(self, space, w_state):
+ from pypy.interpreter.pyframe import PyFrame
+ frames_w = space.unpackiterable(w_state)
+ if len(frames_w) > 0:
+ self.topframe = space.interp_w(PyFrame, frames_w[-1])
+ else:
+ self.topframe = None
+ self.framestackdepth = len(frames_w)
def getframestack(self):
index = self.framestackdepth
Modified: pypy/branch/pyjitpl5-noframestack/pypy/module/_stackless/interp_coroutine.py
==============================================================================
--- pypy/branch/pyjitpl5-noframestack/pypy/module/_stackless/interp_coroutine.py (original)
+++ pypy/branch/pyjitpl5-noframestack/pypy/module/_stackless/interp_coroutine.py Mon Aug 24 18:02:36 2009
@@ -174,7 +174,7 @@
def descr__setstate__(self, space, w_args):
try:
- w_flags, w_frame, w_thunk, w_parent = space.unpackiterable(w_args,
+ w_flags, w_state, w_thunk, w_parent = space.unpackiterable(w_args,
expected_length=4)
except UnpackValueError, e:
raise OperationError(space.w_ValueError, space.wrap(e.msg))
@@ -183,7 +183,7 @@
w_parent = self.w_getmain(space)
self.parent = space.interp_w(AppCoroutine, w_parent)
ec = self.space.getexecutioncontext()
- self.subctx.setstate(space, w_frame)
+ self.subctx.setstate(space, w_state)
self.reconstruct_framechain()
if space.is_w(w_thunk, space.w_None):
self.thunk = None
More information about the Pypy-commit
mailing list