[pypy-commit] lang-smalltalk default: changed perform to not suffer from StackOverflow Errors
lwassermann
noreply at buildbot.pypy.org
Wed Mar 20 14:44:24 CET 2013
Author: Lars Wassermann <lars.wassermann at gmail.com>
Branch:
Changeset: r223:967479e64bc4
Date: 2013-03-20 14:20 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/967479e64bc4/
Log: changed perform to not suffer from StackOverflow Errors fixed the
bootstrapped-tests fixed a flaky test among the shadow tests changed
the starting method lookup class for DNU
diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -69,6 +69,7 @@
while s_new_context is not nlr.s_target_context:
s_new_context.mark_returned()
s_new_context = s_sender
+ self.remaining_stack_depth = self.max_stack_depth
s_new_context.push(nlr.value)
except ProcessSwitch, p:
self.remaining_stack_depth = self.max_stack_depth
@@ -121,24 +122,17 @@
else:
w_selector = selector
- w_method = model.W_CompiledMethod()
- w_method.setbytes([chr(124)]) #returnTopFromMethod
+ w_method = model.W_CompiledMethod(header=512)
+ w_method.literalatput0(self.space, 1, w_selector)
+ assert len(arguments_w) <= 7
+ w_method.setbytes([chr(131), chr(len(arguments_w) << 5 + 0), chr(124)]) #returnTopFromMethod
s_method = w_method.as_compiledmethod_get_shadow(self.space)
s_frame = MethodContextShadow.make_context(
self.space, s_method, w_receiver, [], None)
s_frame.push(w_receiver)
s_frame.push_all(list(arguments_w))
try:
- try:
- s_new_frame = s_frame._sendSelfSelector(w_selector, len(arguments_w), self)
- except Return, nlr:
- s_new_frame = nlr.s_target_context
- nlr.s_target_context.push(nlr.value)
- if s_new_frame is None:
- # which means that we tried to call a primitive method
- return s_frame.pop()
- else:
- self.loop(s_new_frame.w_self())
+ self.loop(s_frame.w_self())
except ReturnFromTopLevel, e:
return e.object
@@ -296,7 +290,7 @@
w_message.store(self.space, 0, w_selector)
w_message.store(self.space, 1, self.space.wrap_list(arguments))
try:
- s_method = receiverclassshadow.lookup(self.space.objtable["w_doesNotUnderstand"])
+ s_method = receiver.shadow_of_my_class(self.space).lookup(self.space.objtable["w_doesNotUnderstand"])
except MethodNotFound:
print "Missing doesDoesNotUnderstand in hierarchy of %s" % receiverclassshadow.getname()
raise
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -633,7 +633,9 @@
whileTrue: [self at: index put: (replacement at: repOff + index)]"""
if (start < 0 or start - 1 > stop or repStart < 0):
raise PrimitiveFailedError()
- if w_rcvr.getclass(interp.space) is not w_replacement.getclass(interp.space):
+ # This test deliberately test for equal W_Object class. The Smalltalk classes
+ # might be different (e.g. Symbol and ByteString)
+ if w_rcvr.__class__ is not w_replacement.__class__:
raise PrimitiveFailedError()
if (w_rcvr.size() <= stop
or w_replacement.size() < repStart + (stop - start)):
diff --git a/spyvm/test/test_bootstrappedimage.py b/spyvm/test/test_bootstrappedimage.py
--- a/spyvm/test/test_bootstrappedimage.py
+++ b/spyvm/test/test_bootstrappedimage.py
@@ -43,6 +43,7 @@
ifTrue: [ ^ sym ] ].
^ (Symbol basicNew: self size) initFrom: self"""
w_result = perform(w("someString"), "asSymbol")
+ assert w_result.as_string() == "someString"
w_anotherSymbol = perform(w("someString"), "asSymbol")
assert w_result is w_anotherSymbol
diff --git a/spyvm/test/test_shadow.py b/spyvm/test/test_shadow.py
--- a/spyvm/test/test_shadow.py
+++ b/spyvm/test/test_shadow.py
@@ -241,8 +241,8 @@
i = 0
key = s_methoddict.w_self()._fetch(constants.METHODDICT_NAMES_INDEX+i)
while key is space.w_nil:
+ i = i + 1
key = s_methoddict.w_self()._fetch(constants.METHODDICT_NAMES_INDEX+i)
- i = i + 1
assert (s_class.lookup(key) is foo.as_compiledmethod_get_shadow(space)
or s_class.lookup(key) is bar.as_compiledmethod_get_shadow(space))
More information about the pypy-commit
mailing list