[pypy-svn] r78887 - in pypy/branch/more-asm-debugging/pypy/jit/backend/x86: . test
fijal at codespeak.net
fijal at codespeak.net
Mon Nov 8 18:23:54 CET 2010
Author: fijal
Date: Mon Nov 8 18:23:52 2010
New Revision: 78887
Modified:
pypy/branch/more-asm-debugging/pypy/jit/backend/x86/assembler.py
pypy/branch/more-asm-debugging/pypy/jit/backend/x86/test/test_runner.py
Log:
implement a checksum feature, to be able to gdb on exact loop
(not sure how this is useful, but let's see)
Modified: pypy/branch/more-asm-debugging/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/more-asm-debugging/pypy/jit/backend/x86/assembler.py (original)
+++ pypy/branch/more-asm-debugging/pypy/jit/backend/x86/assembler.py Mon Nov 8 18:23:52 2010
@@ -303,6 +303,7 @@
_x86_frame_depth
_x86_param_depth
_x86_arglocs
+ _x86_debug_checksum
"""
if not we_are_translated():
# Arguments should be unique
@@ -312,7 +313,7 @@
funcname = self._find_debug_merge_point(operations)
if log:
self._register_counter()
- operations = self._inject_debugging_code(operations)
+ operations = self._inject_debugging_code(looptoken, operations)
regalloc = RegAlloc(self, self.cpu.translate_support_code)
arglocs = regalloc.prepare_loop(inputargs, operations, looptoken)
@@ -350,7 +351,7 @@
funcname = self._find_debug_merge_point(operations)
if log:
self._register_counter()
- operations = self._inject_debugging_code(operations)
+ operations = self._inject_debugging_code(looptoken, operations)
arglocs = self.rebuild_faillocs_from_descr(
faildescr._x86_failure_recovery_bytecode)
@@ -432,9 +433,13 @@
mc.done()
- def _inject_debugging_code(self, operations):
+ def _inject_debugging_code(self, looptoken, operations):
if self._debug:
# before doing anything, let's increase a counter
+ s = 0
+ for op in operations:
+ s += op.getopnum()
+ looptoken._x86_debug_checksum = s
c_adr = ConstInt(rffi.cast(lltype.Signed,
self.loop_run_counters[-1][1]))
box = BoxInt()
Modified: pypy/branch/more-asm-debugging/pypy/jit/backend/x86/test/test_runner.py
==============================================================================
--- pypy/branch/more-asm-debugging/pypy/jit/backend/x86/test/test_runner.py (original)
+++ pypy/branch/more-asm-debugging/pypy/jit/backend/x86/test/test_runner.py Mon Nov 8 18:23:52 2010
@@ -515,3 +515,20 @@
self.cpu.finish_once()
lines = py.path.local(self.logfile + ".count").readlines()
assert lines[0] == '0:10\n' # '10 xyz\n'
+
+ def test_debugger_checksum(self):
+ loop = """
+ [i0]
+ debug_merge_point('xyz', 0)
+ i1 = int_add(i0, 1)
+ i2 = int_ge(i1, 10)
+ guard_false(i2) []
+ jump(i1)
+ """
+ ops = parse(loop)
+ self.cpu.assembler.set_debug(True)
+ self.cpu.compile_loop(ops.inputargs, ops.operations, ops.token)
+ self.cpu.set_future_value_int(0, 0)
+ self.cpu.execute_token(ops.token)
+ assert ops.token._x86_debug_checksum == sum([op.getopnum()
+ for op in ops.operations])
More information about the Pypy-commit
mailing list