Commits

Lars Wassermann committed 967479e

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

  • Participants
  • Parent commits 2575462

Comments (0)

Files changed (4)

File spyvm/interpreter.py

                 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
         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
 
             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

File spyvm/primitives.py

         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)):

File spyvm/test/test_bootstrappedimage.py

                 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
 

File spyvm/test/test_shadow.py

     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))