[pypy-svn] r34191 - in pypy/dist/pypy/jit/codegen/i386: . test
arigo at codespeak.net
arigo at codespeak.net
Sat Nov 4 17:17:20 CET 2006
Author: arigo
Date: Sat Nov 4 17:17:19 2006
New Revision: 34191
Modified:
pypy/dist/pypy/jit/codegen/i386/test/test_genc_portal.py
pypy/dist/pypy/jit/codegen/i386/viewcode.py
Log:
- missing renames in test_genc_portal
- fix the viewer, which now works on larger examples too
Modified: pypy/dist/pypy/jit/codegen/i386/test/test_genc_portal.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/i386/test/test_genc_portal.py (original)
+++ pypy/dist/pypy/jit/codegen/i386/test/test_genc_portal.py Sat Nov 4 17:17:19 2006
@@ -68,9 +68,9 @@
def check_insns(self, expected=None, **counts):
"Cannot check instructions in the generated assembler."
-class TestPromotion(I386PortalTestMixin,
- test_portal.TestPortal):
+class TestPortal(I386PortalTestMixin,
+ test_portal.TestPortal):
# for the individual tests see
- # ====> ../../../timeshifter/test/test_promotion.py
+ # ====> ../../../timeshifter/test/test_portal.py
pass
Modified: pypy/dist/pypy/jit/codegen/i386/viewcode.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/i386/viewcode.py (original)
+++ pypy/dist/pypy/jit/codegen/i386/viewcode.py Sat Nov 4 17:17:19 2006
@@ -53,6 +53,7 @@
# ____________________________________________________________
class CodeRange(object):
+ fallthrough = False
def __init__(self, addr, data):
self.addr = addr
@@ -90,7 +91,8 @@
def findjumps(self):
text = self.disassemble()
- for i, line in enumerate(text.splitlines()):
+ lines = text.splitlines()
+ for i, line in enumerate(lines):
if '\tj' not in line: # poor heuristic to recognize lines that
continue # could be jump instructions
addrs = list(lineaddresses(line))
@@ -98,6 +100,8 @@
continue
addr = addrs[-1]
yield i, addr
+ if self.fallthrough:
+ yield len(lines), self.addr + len(self.data)
class World(object):
@@ -125,30 +129,31 @@
break
else:
self.ranges.append(coderange)
-## # find cross-references between blocks
-## for r in self.ranges:
-## for lineno, targetaddr in r.findjumps():
-## self.labeltargets[targetaddr] = True
-## # split blocks at labeltargets
-## # XXX slooooow!
-## t = self.labeltargets
-## print t
-## for r in self.ranges:
-## print r.addr, r.addr + len(r.data)
-## for i in range(r.addr + 1, r.addr + len(r.data)):
-## if i in t:
-## print i
-## ofs = i - r.addr
-## self.ranges.append(CodeRange(i, r.data[ofs:]))
-## r.data = r.data[:ofs]
-## del r.text
-## break
-## # hack hack hacked
+ # find cross-references between blocks
+ for r in self.ranges:
+ for lineno, targetaddr in r.findjumps():
+ self.labeltargets[targetaddr] = True
+ # split blocks at labeltargets
+ # XXX slooooow!
+ t = self.labeltargets
+ print t
+ for r in self.ranges:
+ print r.addr, r.addr + len(r.data)
+ for i in range(r.addr + 1, r.addr + len(r.data)):
+ if i in t:
+ print i
+ ofs = i - r.addr
+ self.ranges.append(CodeRange(i, r.data[ofs:]))
+ r.data = r.data[:ofs]
+ r.fallthrough = True
+ del r.text
+ break
+ # hack hack hacked
def show(self):
g1 = Graph('codedump')
for r in self.ranges:
- text = r.disassemble()
+ text = r.disassemble().replace('\t', ' ')
text = '0x%x\n\n%s' % (r.addr, text)
g1.emit_node('N_%x' % r.addr, shape="box", label=text)
for lineno, targetaddr in r.findjumps():
More information about the pypy-svn
mailing list