Author: Lars Wassermann <[email protected]>
Branch:
Changeset: r310:bfa8d3f29095
Date: 2013-04-22 14:03 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/bfa8d3f29095/
Log: fixed the infect of creating blockclosures with non-st-compliant pc
offsets
diff --git a/spyvm/objspace.py b/spyvm/objspace.py
--- a/spyvm/objspace.py
+++ b/spyvm/objspace.py
@@ -309,13 +309,15 @@
def _freeze_(self):
return True
- def newClosure(self, outerContext, pc, numArgs, copiedValues):
+ def newClosure(self, w_outer_ctxt, pc, numArgs, copiedValues):
+ assert isinstance(w_outer_ctxt, model.W_PointersObject)
+ pc_with_bytecodeoffset = pc +
w_outer_ctxt.as_context_get_shadow(self).s_method().bytecodeoffset + 1
BlockClosureShadow = self.w_BlockClosure.as_class_get_shadow(self)
numCopied = len(copiedValues)
w_closure = BlockClosureShadow.new(numCopied)
closure = wrapper.BlockClosureWrapper(self, w_closure)
- closure.store_outerContext(outerContext)
- closure.store_startpc(pc)
+ closure.store_outerContext(w_outer_ctxt)
+ closure.store_startpc(pc_with_bytecodeoffset)
closure.store_numArgs(numArgs)
for i0 in range(numCopied):
closure.atput0(i0, copiedValues[i0])
diff --git a/spyvm/wrapper.py b/spyvm/wrapper.py
--- a/spyvm/wrapper.py
+++ b/spyvm/wrapper.py
@@ -228,7 +228,7 @@
startpc, store_startpc = make_int_getter_setter(constants.BLKCLSR_STARTPC)
numArgs, store_numArgs = make_int_getter_setter(constants.BLKCLSR_NUMARGS)
- def asContextWithSender(self, w_aContext, arguments):
+ def asContextWithSender(self, w_context, arguments):
from spyvm import shadow
w_outerContext = self.outerContext()
if not isinstance(w_outerContext, model.W_PointersObject):
@@ -236,9 +236,10 @@
s_outerContext = w_outerContext.as_context_get_shadow(self.space)
s_method =
s_outerContext.w_method().as_compiledmethod_get_shadow(self.space)
w_receiver = s_outerContext.w_receiver()
+ pc = self.startpc() - s_method.bytecodeoffset - 1
w_new_frame = shadow.MethodContextShadow.make_context(self.space,
s_method, w_receiver,
- arguments, s_sender=w_aContext.get_shadow(self.space),
- pc=self.startpc(), closure=self)
+ arguments, s_sender=w_context.get_shadow(self.space),
+ pc=pc, closure=self)
return w_new_frame
def tempsize(self):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit