[pypy-commit] lang-smalltalk default: changed the print format of compiled method to include methodname, hex-bytecodes and moved the bytecode number to the front, so that the names are now aligned

lwassermann noreply at buildbot.pypy.org
Tue Feb 26 11:52:51 CET 2013


Author: Lars Wassermann <lars.wassermann at gmail.com>
Branch: 
Changeset: r100:9ce049baa49b
Date: 2013-02-26 11:52 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/9ce049baa49b/

Log:	changed the print format of compiled method to include methodname,
	hex-bytecodes and moved the bytecode number to the front, so that
	the names are now aligned

diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -492,11 +492,12 @@
     def __str__(self):
         from spyvm.interpreter import BYTECODE_TABLE
         j = 1
-        retval = "\n\nBytecode:\n---------------------\n"
+        retval  = "\nMethodname: " + self._likely_methodname 
+        retval += "\nBytecode:------------\n"
         for i in self.bytes:
-            retval += str(j) + ": " + BYTECODE_TABLE[ord(i)].__name__ + " " + str(ord(i)) + "\n"
+            retval += ('%0.2i: 0x%0.2x(%0.3i) ' % (j ,ord(i), ord(i))) + BYTECODE_TABLE[ord(i)].__name__ + "\n"
             j += 1
-        return retval + "\n---------------------\n"
+        return retval + "---------------------\n"
 
     def invariant(self):
         return (W_Object.invariant(self) and


More information about the pypy-commit mailing list