Author: Anton Gulenko <[email protected]>
Branch: storage
Changeset: r717:a0f1836c6654
Date: 2014-03-28 17:46 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/a0f1836c6654/
Log: Removed redundant space parameter from two methods.
diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -373,7 +373,7 @@
except primitives.PrimitiveFailedError:
pass # ignore this error and fall back to the Smalltalk version
arguments = self.pop_and_return_n(argcount)
- s_frame = s_method.create_frame(self.space, receiver, arguments, self)
+ s_frame = s_method.create_frame(receiver, arguments, self)
self.pop() # receiver
#
######################################################################
@@ -398,7 +398,7 @@
assert isinstance(s_class, ClassShadow)
print "Missing doesDoesNotUnderstand in hierarchy of %s" %
s_class.getname()
raise
- s_frame = s_method.create_frame(self.space, receiver, [w_message],
self)
+ s_frame = s_method.create_frame(receiver, [w_message], self)
self.pop()
#
######################################################################
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -1380,7 +1380,7 @@
return s_frame._call_primitive(code, interp, argcount, s_method,
w_selector)
except PrimitiveFailedError:
pass # ignore this error and fall back to the Smalltalk version
- s_new_frame = s_method.create_frame(interp.space, w_rcvr, args_w, s_frame)
+ s_new_frame = s_method.create_frame(w_rcvr, args_w, s_frame)
s_frame.pop()
return interp.stack_frame(s_new_frame)
@@ -1393,7 +1393,7 @@
code = s_method.primitive()
if code:
raise PrimitiveFailedError("withArgs:executeMethod: not support with
primitive method")
- s_new_frame = s_method.create_frame(interp.space, w_rcvr, args_w, s_frame)
+ s_new_frame = s_method.create_frame(w_rcvr, args_w, s_frame)
return interp.stack_frame(s_new_frame)
@expose_primitive(SIGNAL, unwrap_spec=[object], clean_stack=False,
no_result=True)
diff --git a/spyvm/shadow.py b/spyvm/shadow.py
--- a/spyvm/shadow.py
+++ b/spyvm/shadow.py
@@ -196,10 +196,10 @@
def __init__(self, space, w_self, size):
AbstractShadow.__init__(self, space, w_self)
- self.initialize_storage(space, size)
+ self.initialize_storage(size)
- def initialize_storage(self, space, size):
- self.storage = [space.w_nil] * size
+ def initialize_storage(self, size):
+ self.storage = [self.space.w_nil] * size
def fetch(self, n0):
return self.storage[n0]
def store(self, n0, w_value):
@@ -208,7 +208,7 @@
return len(self.storage)
def copy_from(self, other_shadow):
if self.size() != other_shadow.size():
- self.initialize_storage(other_shadow.space, other_shadow.size())
+ self.initialize_storage(other_shadow.size())
AbstractShadow.copy_from(self, other_shadow)
class WeakListStorageShadow(AbstractShadow):
@@ -1246,9 +1246,9 @@
def primitive(self):
return self._primitive
- def create_frame(self, space, receiver, arguments, sender = None):
+ def create_frame(self, receiver, arguments, sender = None):
assert len(arguments) == self.argsize
- return MethodContextShadow(space, None, self, receiver, arguments,
sender)
+ return MethodContextShadow(self.space, None, self, receiver,
arguments, sender)
@constant_for_version
def getbytecode(self, pc):
diff --git a/spyvm/test/test_interpreter.py b/spyvm/test/test_interpreter.py
--- a/spyvm/test/test_interpreter.py
+++ b/spyvm/test/test_interpreter.py
@@ -113,7 +113,7 @@
w_method.setliterals([model.W_PointersObject(space, None, 2)])
if receiver is None:
receiver = space.w_nil
- s_frame = w_method.as_compiledmethod_get_shadow(space).create_frame(space,
receiver, [space.w("foo"), space.w("bar")])
+ s_frame =
w_method.as_compiledmethod_get_shadow(space).create_frame(receiver,
[space.w("foo"), space.w("bar")])
return s_frame.w_self(), s_frame
def new_frame(bytes, receiver=None):
@@ -127,7 +127,7 @@
w_method.islarge = 1
w_method.argsize=2
w_method.tempsize=8
- s_frame = w_method.as_compiledmethod_get_shadow(space).create_frame(space,
w("receiver"), [w("foo"), w("bar")])
+ s_frame =
w_method.as_compiledmethod_get_shadow(space).create_frame(w("receiver"),
[w("foo"), w("bar")])
w_frame = s_frame.w_self()
assert s_frame.w_receiver().as_string() == "receiver"
assert s_frame.gettemp(0).as_string() == "foo"
@@ -1003,7 +1003,7 @@
w_method.setliterals([space.wrap_int(11)])
#create a frame for that method
- w_frame = w_method.as_compiledmethod_get_shadow(space).create_frame(space,
space.wrap_int(0), []).w_self()
+ w_frame =
w_method.as_compiledmethod_get_shadow(space).create_frame(space.wrap_int(0),
[]).w_self()
try:
interp.loop(w_frame)
except interpreter.ReturnFromTopLevel, e:
@@ -1013,7 +1013,7 @@
try:
interp = interpreter.Interpreter(space, None, "", max_stack_depth=10)
interp._loop = True
-
interp.c_loop(w_method.as_compiledmethod_get_shadow(space).create_frame(space,
space.wrap_int(0), []))
+
interp.c_loop(w_method.as_compiledmethod_get_shadow(space).create_frame(space.wrap_int(0),
[]))
except interpreter.StackOverflow, e:
assert isinstance(e.s_context, shadow.MethodContextShadow)
except interpreter.ReturnFromTopLevel, e:
@@ -1049,7 +1049,7 @@
w_method.setliterals([space.wrap_int(11)])
#create a frame for that method
- w_frame = w_method.as_compiledmethod_get_shadow(space).create_frame(space,
space.wrap_int(0), []).w_self()
+ w_frame =
w_method.as_compiledmethod_get_shadow(space).create_frame(space.wrap_int(0),
[]).w_self()
try:
interp.loop(w_frame)
except interpreter.ReturnFromTopLevel, e:
diff --git a/spyvm/test/test_zin_squeak_4_5_image.py
b/spyvm/test/test_zin_squeak_4_5_image.py
--- a/spyvm/test/test_zin_squeak_4_5_image.py
+++ b/spyvm/test/test_zin_squeak_4_5_image.py
@@ -42,8 +42,8 @@
w('ensure'), space.w_BlockClosure])
# create a frame for our newly crafted method with a valid sender (to
avoid raising returnFromTop to early)
- s_initial_frame = create_method_shadow(chr(0x7c)).create_frame(space,
w(0), [])
- w_frame = s_method.create_frame(space, w(0), [],
sender=s_initial_frame).w_self()
+ s_initial_frame = create_method_shadow(chr(0x7c)).create_frame(w(0), [])
+ w_frame = s_method.create_frame(w(0), [], sender=s_initial_frame).w_self()
try:
interp.loop(w_frame)
diff --git a/targettinybenchsmalltalk.py b/targettinybenchsmalltalk.py
--- a/targettinybenchsmalltalk.py
+++ b/targettinybenchsmalltalk.py
@@ -25,7 +25,7 @@
w_object = model.W_SmallInteger(0)
s_class = w_object.class_shadow(space)
s_method = s_class.lookup(w_selector)
- s_frame = s_method.create_frame(space, w_object, [])
+ s_frame = s_method.create_frame(w_object, [])
return interp, s_frame
interp, s_frame = setup()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit