[pypy-commit] lang-smalltalk default: Added shorthandprinting for the contexts. The hook in c_loop is commented out

lwassermann noreply at buildbot.pypy.org
Thu Mar 7 14:14:12 CET 2013


Author: Lars Wassermann <lars.wassermann at gmail.com>
Branch: 
Changeset: r134:a6dbd607b975
Date: 2013-03-07 14:13 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/a6dbd607b975/

Log:	Added shorthandprinting for the contexts. The hook in c_loop is
	commented out

diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -72,6 +72,8 @@
                 s_new_context.push(nlr.value)
 
     def c_loop(self, s_context):
+        # padding = ' ' * (self.max_stack_depth - self.remaining_stack_depth)
+        # print padding + s_context.short_str()
         while True:
             pc = s_context._pc
             method = s_context.s_method()
diff --git a/spyvm/shadow.py b/spyvm/shadow.py
--- a/spyvm/shadow.py
+++ b/spyvm/shadow.py
@@ -690,6 +690,10 @@
         # A blockcontext doesn't have any temps
         return 0
 
+    def short_str(self):
+        return 'BlockContext of %s (%i)' % (self.w_method().get_identifier_string(),
+                    self.pc() + 1)
+
 class MethodContextShadow(ContextPartShadow):
     _attr_ = ['w_closure_or_nil', '_w_receiver', '__w_method']
 
@@ -836,6 +840,10 @@
         retval += "\nStack   : " + str(self.stack())
         return retval
 
+    def short_str(self):
+        block = '[] of' if self.is_closure_context() else ''
+        return '%s %s (%i)' % (block, self.w_method().get_identifier_string(), self.pc() + 1)
+
 class CompiledMethodShadow(object):
     _immutable_fields_ = ["_w_self", "bytecode",
                           "literals[*]", "bytecodeoffset",


More information about the pypy-commit mailing list