[pypy-svn] r74937 - in pypy/branch/blackhole-improvement/pypy/jit: codewriter metainterp
arigo at codespeak.net
arigo at codespeak.net
Sun May 30 22:21:03 CEST 2010
Author: arigo
Date: Sun May 30 22:21:01 2010
New Revision: 74937
Modified:
pypy/branch/blackhole-improvement/pypy/jit/codewriter/codewriter.py
pypy/branch/blackhole-improvement/pypy/jit/codewriter/jitcode.py
pypy/branch/blackhole-improvement/pypy/jit/metainterp/pyjitpl.py
Log:
Improve debugging dumps.
Modified: pypy/branch/blackhole-improvement/pypy/jit/codewriter/codewriter.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/codewriter/codewriter.py (original)
+++ pypy/branch/blackhole-improvement/pypy/jit/codewriter/codewriter.py Sun May 30 22:21:01 2010
@@ -52,14 +52,14 @@
# step 3b: compute the liveness around certain operations
compute_liveness(ssarepr)
#
- # print the resulting assembler
- self.print_ssa_repr(ssarepr, portal, verbose)
- #
# step 4: "assemble" it into a JitCode, which contains a sequence
# of bytes and lists of constants. It's during this step that
# constants are cast to their normalized type (Signed, GCREF or
# Float).
self.assembler.assemble(ssarepr, jitcode)
+ #
+ # print the resulting assembler
+ self.print_ssa_repr(ssarepr, portal, verbose)
def make_jitcodes(self, verbose=False):
log.info("making JitCodes...")
@@ -90,7 +90,7 @@
def print_ssa_repr(self, ssarepr, portal, verbose):
if verbose:
print '%s:' % (ssarepr.name,)
- print indent(format_assembler(ssarepr), 4)
+ print format_assembler(ssarepr)
else:
dir = udir.ensure("jitcodes", dir=1)
if portal:
@@ -101,8 +101,3 @@
name = 'unnamed_%x' % id(ssarepr)
dir.join(name).write(format_assembler(ssarepr))
log.dot()
-
-
-def indent(s, indent):
- indent = ' ' * indent
- return indent + s.replace('\n', '\n'+indent).rstrip(' ')
Modified: pypy/branch/blackhole-improvement/pypy/jit/codewriter/jitcode.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/codewriter/jitcode.py (original)
+++ pypy/branch/blackhole-improvement/pypy/jit/codewriter/jitcode.py Sun May 30 22:21:01 2010
@@ -51,9 +51,10 @@
# 'pc' gives a position in this bytecode. This returns an object
# of class LiveVarsInfo that describes all variables that are live
# across the instruction boundary at 'pc'.
- if not we_are_translated() and pc not in self.liveness:
+ try:
+ return self.liveness[pc] # XXX compactify!!
+ except KeyError:
self._missing_liveness(pc)
- return self.liveness[pc] # XXX compactify!!
def _live_vars(self, pc):
# for testing only
@@ -67,7 +68,11 @@
return ' '.join(lst_i + lst_r + lst_f)
def _missing_liveness(self, pc):
- raise MissingLiveness("missing liveness[%d]\n%s" % (pc, self.dump()))
+ msg = "missing liveness[%d] in %s" % (pc, self.name)
+ if we_are_translated():
+ print msg
+ raise AssertionError
+ raise MissingLiveness("%s\n%s" % (msg, self.dump()))
def follow_jump(self, position):
"""Assuming that 'position' points just after a bytecode
@@ -83,7 +88,7 @@
def dump(self):
if self._ssarepr is None:
- return '<no dump available>'
+ return '<no dump available for %r>' % (self.name,)
else:
from pypy.jit.codewriter.format import format_assembler
return format_assembler(self._ssarepr)
Modified: pypy/branch/blackhole-improvement/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/branch/blackhole-improvement/pypy/jit/metainterp/pyjitpl.py Sun May 30 22:21:01 2010
@@ -44,7 +44,6 @@
assert isinstance(jitcode, JitCode)
self.jitcode = jitcode
self.bytecode = jitcode.code
- self.name = jitcode.name # purely for having name attribute
# this is not None for frames that are recursive portal calls
self.greenkey = greenkey
# copy the constants in place
More information about the Pypy-commit
mailing list