Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r59081:1674d1dcc65d
Date: 2012-11-24 18:07 +0100
http://bitbucket.org/pypy/pypy/changeset/1674d1dcc65d/
Log: make the key available
diff --git a/pypy/module/pypyjit/interp_resop.py
b/pypy/module/pypyjit/interp_resop.py
--- a/pypy/module/pypyjit/interp_resop.py
+++ b/pypy/module/pypyjit/interp_resop.py
@@ -297,6 +297,13 @@
return space.wrap(self.bridge_no)
raise OperationError(space.w_TypeError, space.wrap("not a bridge"))
+ def descr_get_key(self, space):
+ if space.is_none(self.w_green_key):
+ return space.newtuple([space.wrap(self.type), space.wrap(
+ self.bridge_no)])
+ return space.newtuple([space.wrap(self.type),
space.wrap(self.loop_no)])
+
+
@unwrap_spec(loopno=int, asmaddr=int, asmlen=int, loop_no=int,
type=str, jd_name=str, bridge_no=int)
def descr_new_jit_loop_info(space, w_subtype, w_greenkey, w_ops, loopno,
@@ -331,6 +338,8 @@
doc="bridge number (if a bridge)"),
type = interp_attrproperty('type', cls=W_JitLoopInfo,
doc="Loop type"),
+ key = GetSetProperty(W_JitLoopInfo.descr_get_key,
+ doc="bridge key in counters"),
__repr__ = interp2app(W_JitLoopInfo.descr_repr),
)
W_JitLoopInfo.acceptable_as_base_class = False
diff --git a/pypy/module/pypyjit/test/test_jit_hook.py
b/pypy/module/pypyjit/test/test_jit_hook.py
--- a/pypy/module/pypyjit/test/test_jit_hook.py
+++ b/pypy/module/pypyjit/test/test_jit_hook.py
@@ -120,6 +120,7 @@
assert info.loop_no == 0
assert info.type == 'loop'
raises(TypeError, 'info.bridge_no')
+ assert info.key == ('loop', 0)
assert len(info.operations) == 4
int_add = info.operations[0]
dmp = info.operations[1]
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit