[pypy-svn] r79260 - in pypy/branch/jit-free/pypy/jit/backend: . llgraph test x86 x86/test
arigo at codespeak.net
arigo at codespeak.net
Thu Nov 18 17:58:21 CET 2010
Author: arigo
Date: Thu Nov 18 17:58:20 2010
New Revision: 79260
Modified:
pypy/branch/jit-free/pypy/jit/backend/llgraph/runner.py
pypy/branch/jit-free/pypy/jit/backend/model.py
pypy/branch/jit-free/pypy/jit/backend/test/runner_test.py
pypy/branch/jit-free/pypy/jit/backend/x86/runner.py
pypy/branch/jit-free/pypy/jit/backend/x86/test/test_regalloc.py
pypy/branch/jit-free/pypy/jit/backend/x86/test/test_runner.py
Log:
Forgot to adapt the interface of x86's compile_bridge().
Fix some x86 tests.
Collect some stats on the cpu about how many bridges are made and freed.
Modified: pypy/branch/jit-free/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/branch/jit-free/pypy/jit/backend/llgraph/runner.py (original)
+++ pypy/branch/jit-free/pypy/jit/backend/llgraph/runner.py Thu Nov 18 17:58:20 2010
@@ -122,7 +122,7 @@
c = llimpl.compile_start()
clt = original_loop_token.compiled_loop_token
clt.loop_and_bridges.append(c)
- clt.bridges_count += 1
+ clt.compiling_a_bridge()
self._compile_loop_or_bridge(c, inputargs, operations)
old, oldindex = faildescr._compiled_fail
llimpl.compile_redirect_fail(old, oldindex, c)
Modified: pypy/branch/jit-free/pypy/jit/backend/model.py
==============================================================================
--- pypy/branch/jit-free/pypy/jit/backend/model.py (original)
+++ pypy/branch/jit-free/pypy/jit/backend/model.py Thu Nov 18 17:58:20 2010
@@ -8,6 +8,10 @@
done_with_this_frame_int_v = -1
done_with_this_frame_ref_v = -1
done_with_this_frame_float_v = -1
+ total_compiled_loops = 0
+ total_compiled_bridges = 0
+ total_freed_loops = 0
+ total_freed_bridges = 0
def __init__(self):
self.fail_descr_list = []
@@ -138,6 +142,8 @@
for n in compiled_loop_token.faildescr_indices:
lst[n] = None
self.fail_descr_free_list.extend(compiled_loop_token.faildescr_indices)
+ self.total_freed_loops += 1
+ self.total_freed_bridges += compiled_loop_token.bridges_count
# We expect 'compiled_loop_token' to be itself garbage-collected soon.
@staticmethod
@@ -268,6 +274,7 @@
class CompiledLoopToken(object):
def __init__(self, cpu, number):
+ cpu.total_compiled_loops += 1
self.cpu = cpu
self.number = number
self.bridges_count = 0
@@ -279,6 +286,10 @@
def record_faildescr_index(self, n):
self.faildescr_indices.append(n)
+ def compiling_a_bridge(self):
+ self.cpu.total_compiled_bridges += 1
+ self.bridges_count += 1
+
def __del__(self):
debug_start("jit-free-looptoken")
debug_print("Freeing loop #", self.number, 'with',
Modified: pypy/branch/jit-free/pypy/jit/backend/test/runner_test.py
==============================================================================
--- pypy/branch/jit-free/pypy/jit/backend/test/runner_test.py (original)
+++ pypy/branch/jit-free/pypy/jit/backend/test/runner_test.py Thu Nov 18 17:58:20 2010
@@ -174,6 +174,8 @@
assert not wr_i1() and not wr_guard()
def test_compile_bridge(self):
+ self.cpu.total_compiled_loops = 0
+ self.cpu.total_compiled_bridges = 0
i0 = BoxInt()
i1 = BoxInt()
i2 = BoxInt()
@@ -207,6 +209,9 @@
res = self.cpu.get_latest_value_int(0)
assert res == 20
+ assert self.cpu.total_compiled_loops == 1
+ assert self.cpu.total_compiled_bridges == 1
+
def test_compile_bridge_with_holes(self):
i0 = BoxInt()
i1 = BoxInt()
Modified: pypy/branch/jit-free/pypy/jit/backend/x86/runner.py
==============================================================================
--- pypy/branch/jit-free/pypy/jit/backend/x86/runner.py (original)
+++ pypy/branch/jit-free/pypy/jit/backend/x86/runner.py Thu Nov 18 17:58:20 2010
@@ -53,7 +53,10 @@
self.assembler.assemble_loop(inputargs, operations, looptoken,
log=log)
- def compile_bridge(self, faildescr, inputargs, operations, log=True):
+ def compile_bridge(self, faildescr, inputargs, operations,
+ original_loop_token, log=True):
+ clt = original_loop_token.compiled_loop_token
+ clt.compiling_a_bridge()
self.assembler.assemble_bridge(faildescr, inputargs, operations,
log=log)
Modified: pypy/branch/jit-free/pypy/jit/backend/x86/test/test_regalloc.py
==============================================================================
--- pypy/branch/jit-free/pypy/jit/backend/x86/test/test_regalloc.py (original)
+++ pypy/branch/jit-free/pypy/jit/backend/x86/test/test_regalloc.py Thu Nov 18 17:58:20 2010
@@ -166,7 +166,8 @@
assert ([box.type for box in bridge.inputargs] ==
[box.type for box in guard_op.getfailargs()])
faildescr = guard_op.getdescr()
- self.cpu.compile_bridge(faildescr, bridge.inputargs, bridge.operations)
+ self.cpu.compile_bridge(faildescr, bridge.inputargs, bridge.operations,
+ loop.token)
return bridge
def run(self, loop):
Modified: pypy/branch/jit-free/pypy/jit/backend/x86/test/test_runner.py
==============================================================================
--- pypy/branch/jit-free/pypy/jit/backend/x86/test/test_runner.py (original)
+++ pypy/branch/jit-free/pypy/jit/backend/x86/test/test_runner.py Thu Nov 18 17:58:20 2010
@@ -371,7 +371,7 @@
]
bridge[1].setfailargs([i1b])
- self.cpu.compile_bridge(faildescr1, [i1b], bridge)
+ self.cpu.compile_bridge(faildescr1, [i1b], bridge, looptoken)
name, address, size = agent.functions[1]
assert name == "Bridge # 0: bye"
# Would be exactly ==, but there are some guard failure recovery
More information about the Pypy-commit
mailing list