Author: Lars Wassermann <[email protected]>
Branch:
Changeset: r81:0b69628b3e93
Date: 2013-02-21 20:26 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/0b69628b3e93/
Log: refactored newClosure to RPython different from the squeak-image,
newClosure expects an empty list instead of w_nil, if there are no
copiedValues
diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -427,7 +427,7 @@
i = self.getbytecode()
blockSize = (j << 8) | i
#create new instance of BlockClosure
- w_closure, closure = space.newClosure(self._w_self, self.pc(),
numArgs,
+ w_closure = space.newClosure(self._w_self, self.pc(), numArgs,
self.pop_and_return_n(numCopied))
self.push(w_closure)
self.jump(blockSize)
diff --git a/spyvm/objspace.py b/spyvm/objspace.py
--- a/spyvm/objspace.py
+++ b/spyvm/objspace.py
@@ -265,7 +265,7 @@
def newClosure(self, outerContext, pc, numArgs, copiedValues):
BlockClosureShadow = self.w_BlockClosure.as_class_get_shadow(self)
- numCopied = 0 if copiedValues is self.w_nil else len(copiedValues)
+ numCopied = len(copiedValues)
w_closure = BlockClosureShadow.new(numCopied)
closure = wrapper.BlockClosureWrapper(self, w_closure)
closure.store_outerContext(outerContext)
@@ -273,7 +273,7 @@
closure.store_numArgs(numArgs)
for i0 in range(numCopied):
closure.atput0(i0, copiedValues[i0])
- return w_closure, closure
+ return w_closure
def bootstrap_class(space, instsize, w_superclass=None, w_metaclass=None,
name='?', format=shadow.POINTERS, varsized=False):
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -926,7 +926,7 @@
@expose_primitive(CLOSURE_COPY_WITH_COPIED_VALUES, unwrap_spec=[object, int,
list])
def func(interp, outerContext, numArgs, copiedValues):
frame = interp.s_active_context()
- w_context, s_context = interp.space.newClosure(outerContext, frame.pc(),
+ w_context = interp.space.newClosure(outerContext, frame.pc(),
numArgs, copiedValues)
return w_context
diff --git a/spyvm/test/test_primitives.py b/spyvm/test/test_primitives.py
--- a/spyvm/test/test_primitives.py
+++ b/spyvm/test/test_primitives.py
@@ -461,7 +461,7 @@
space=space)
s_initial_context = interp.s_active_context()
- closure, _ = space.newClosure(interp.w_active_context(), 4, 0, space.w_nil)
+ closure = space.newClosure(interp.w_active_context(), 4, 0, [])
s_initial_context.push(closure)
prim_table[201](interp, 0)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit