[pypy-svn] r48021 - in pypy/dist/pypy/lang/smalltalk: . test tool

tverwaes at codespeak.net tverwaes at codespeak.net
Fri Oct 26 11:22:57 CEST 2007


Author: tverwaes
Date: Fri Oct 26 11:22:56 2007
New Revision: 48021

Modified:
   pypy/dist/pypy/lang/smalltalk/interpreter.py
   pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py
   pypy/dist/pypy/lang/smalltalk/tool/analyseimage.py
Log:
reverting change for extendedSuperSend (popping receiver, fixed test)


Modified: pypy/dist/pypy/lang/smalltalk/interpreter.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/interpreter.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/interpreter.py	Fri Oct 26 11:22:56 2007
@@ -116,15 +116,15 @@
     def _sendSelfSelector(self, selector, argcount, interp):
         receiver = self.peek(argcount)
         self._sendSelector(selector, argcount, interp,
-                           receiver, receiver.shadow_of_my_class(), 1)             
+                           receiver, receiver.shadow_of_my_class())             
 
     def _sendSuperSelector(self, selector, argcount, interp):
         s_compiledin = self.w_method().compiledin().as_class_get_shadow()
         self._sendSelector(selector, argcount, interp, self.w_receiver,
-                           s_compiledin.s_superclass, 0)
+                           s_compiledin.s_superclass)
 
     def _sendSelector(self, selector, argcount, interp,
-                      receiver, receiverclassshadow, popreceiver):
+                      receiver, receiverclassshadow):
         assert argcount >= 0
         method = receiverclassshadow.lookup(selector)
         # XXX catch MethodNotFound here and send doesNotUnderstand:
@@ -143,7 +143,7 @@
         assert start >= 0  # XXX check in the Blue Book what to do in this case
         arguments = self.stack[start:]
         interp.w_active_context = method.create_frame(receiver, arguments, self) 
-        self.pop_n(argcount + popreceiver) 
+        self.pop_n(argcount + 1) 
 
     def _return(self, object, interp):
         if self.w_sender is None:   # for tests, when returning from the top-level context

Modified: pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py	Fri Oct 26 11:22:56 2007
@@ -410,10 +410,10 @@
     # first call method installed in w_class
     bytecodes = singleExtendedSendBytecode + chr(0)
     # which does a call to its super
-    meth1 = model.W_CompiledMethod(0, bytecode)
+    meth1 = model.W_CompiledMethod(0, pushReceiverBytecode + bytecode)
     w_class.as_class_get_shadow().installmethod("foo", meth1)
     # and that one again to its super
-    meth2 = model.W_CompiledMethod(0, bytecode)
+    meth2 = model.W_CompiledMethod(0, pushReceiverBytecode + bytecode)
     w_super.as_class_get_shadow().installmethod("foo", meth2)
     meth3 = model.W_CompiledMethod(0, "")
     w_supersuper.as_class_get_shadow().installmethod("foo", meth3)
@@ -422,9 +422,11 @@
     interp = new_interpreter(bytecodes)
     interp.w_active_context.w_method().literals = fakeliterals("foo")
     interp.w_active_context.push(w_object)
-    for w_specificclass in [w_class, w_super, w_supersuper]:
+    interp.step()
+    for w_specificclass in [w_super, w_supersuper]:
         callerContext = interp.w_active_context
         interp.step()
+        interp.step()
         assert interp.w_active_context.w_sender == callerContext
         assert interp.w_active_context.stack == []
         assert interp.w_active_context.w_receiver == w_object

Modified: pypy/dist/pypy/lang/smalltalk/tool/analyseimage.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/tool/analyseimage.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/tool/analyseimage.py	Fri Oct 26 11:22:56 2007
@@ -51,8 +51,10 @@
     while True:
         try:
             counter += 1
-            #if interp.w_active_context == w_frame:
-               # print "Executing toplevel bytecode nr: %d of %d" % (counter, len(w_method.bytes))
+            if interp.w_active_context == w_frame:
+                print "Executing toplevel bytecode nr: %d of %d" % (interp.w_active_context.pc+1, len(w_method.bytes))
+                cb = ord(interp.w_active_context.w_method().bytes[interp.w_active_context.pc])
+                print "= bytecode: %s %d" % (BYTECODE_TABLE[cb].__name__,cb)
             interp.step()
             #if hasattr(interp.w_active_context,"currentBytecode"):
             #    print "Executing bytecode: %s" % (BYTECODE_TABLE[interp.w_active_context.currentBytecode].__name__,)



More information about the Pypy-commit mailing list