Author: Lars Wassermann <[email protected]>
Branch: 
Changeset: r60:385df11cafb3
Date: 2013-02-19 14:02 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/385df11cafb3/

Log:    (cfbolz, krono, lwassermann): added methodname guessing to
        compiledMethod for debugging

diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -17,7 +17,8 @@
 
 def get_printable_location(pc, self, method):
     bc = ord(method.bytecode[pc])
-    return '%d: [%s]%s' % (pc, hex(bc), BYTECODE_NAMES[bc])
+    name = method._w_self._likely_methodname
+    return '%d: [%s]%s (%s)' % (pc, hex(bc), BYTECODE_NAMES[bc], name)
 
 
 class Interpreter(object):
diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -463,6 +463,7 @@
 ###    the last byte in the method.
 
     _shadow = None
+    _likely_methodname = "<unknown>"
 
     def __init__(self, bytecount=0, header=0):
         self.setheader(header)
diff --git a/spyvm/shadow.py b/spyvm/shadow.py
--- a/spyvm/shadow.py
+++ b/spyvm/shadow.py
@@ -282,6 +282,7 @@
                     raise ClassShadowError("the methoddict must contain "
                                            "CompiledMethods only for now")
                 self.methoddict[selector] = w_compiledmethod
+                w_compiledmethod._likely_methodname = selector
 
 
 class AbstractRedirectingShadow(AbstractShadow):
@@ -716,10 +717,12 @@
 
 
 class CompiledMethodShadow(object):
-    _immutable_fields_ = ["bytecode", "literals[*]", "bytecodeoffset",
+    _immutable_fields_ = ["_w_self", "bytecode",
+                          "literals[*]", "bytecodeoffset",
                           "literalsize", "tempsize", "w_compiledin"]
 
     def __init__(self, w_compiledmethod):
+        self._w_self = w_compiledmethod
         self.bytecode = "".join(w_compiledmethod.bytes)
         self.literals = w_compiledmethod.literals
         self.bytecodeoffset = w_compiledmethod.bytecodeoffset()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to