pypy/module/pypyjit/test_pypy_c/test_thread.py::TestThread::()::test_lock_acquire_release
self = <pypy.module.pypyjit.test_pypy_c.test_thread.TestThread object at 0xf3cef98c>
def test_lock_acquire_release(self):
def main(n):
import threading
lock = threading.Lock()
while n > 0:
with lock:
n -= 1
log = self.run(main, [500])
assert log.result == main(500)
loop, = log.loops_by_filename(self.filepath)
assert loop.match("""
i56 = int_gt(i44, 0)
guard_true(i56, descr=...)
p57 = force_token()
setfield_gc(p0, p57, descr=<FieldP pypy.interpreter.pyframe.PyFrame.vable_token 8>)
i58 = call_may_force_i(ConstClass(acquire_timed), p31, -1, descr=<Calli . ri EF=7>)
guard_not_forced(descr=...)
guard_no_exception(descr=...)
i99 = int_eq(i58, 1)
guard_true(i99, descr=...)
i58 = int_sub(i44, 1)
guard_not_invalidated?
i59 = call_i(ConstClass(RPyThreadReleaseLock), i37, descr=<Calli . i EF=2>)
i60 = int_is_true(i59)
guard_false(i60, descr=...)
--TICK--
jump(..., descr=...)
> """)
pypy/module/pypyjit/test_pypy_c/test_thread.py:86:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pypy/module/pypyjit/test_pypy_c/model.py:177: in match
return matcher.match(expected_src, **kwds)
pypy/module/pypyjit/test_pypy_c/model.py:524: in match
self.match_loop(expected_ops, ignore_ops)
pypy/module/pypyjit/test_pypy_c/model.py:500: in match_loop
self.match_op(op, exp_op)
pypy/module/pypyjit/test_pypy_c/model.py:417: in match_op
self._assert(self.match_var(arg, exp_arg), "variable mismatch: %r instead of %r" % (arg, exp_arg))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.pypyjit.test_pypy_c.model.OpMatcher object at 0xf404b9ec>
cond = False, message = "variable mismatch: 'nan' instead of '-1'"
def _assert(self, cond, message):
if not cond:
> raise InvalidMatch(message, frame=sys._getframe(1))
E InvalidMatch: variable mismatch: 'nan' instead of '-1'
pypy/module/pypyjit/test_pypy_c/model.py:402: InvalidMatch
---------- Captured stdout call ----------
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Loops don't match
=================
loop id = None
("variable mismatch: 'nan' instead of '-1'",)
<could not determine information>
Ignore ops: []
Got:
i50 = int_gt(i40, 0)
guard_true(i50, descr=<Guard0xf4a3e538>)
p51 = force_token()
setfield_gc(p0, p51, descr=<FieldP pypy.interpreter.pyframe.PyFrame.vable_token 8>)
===== HERE =====
i54 = call_may_force_i(ConstClass(acquire_timed), p32, nan, descr=<Calli 4 rL EF=7>)
guard_not_forced(descr=<Guard0xf49d12a4>)
guard_no_exception(descr=<Guard0xf49d364c>)
i56 = int_eq(i54, 1)
guard_true(i56, descr=<Guard0xf49d3684>)
i58 = int_sub(i40, 1)
i60 = call_i(ConstClass(RPyThreadReleaseLock), i41, descr=<Calli 4 i EF=2>)
i61 = int_is_true(i60)
guard_false(i61, descr=<Guard0xf4a3e560>)
guard_not_invalidated(descr=<Guard0xf49d36bc>)
i64 = getfield_raw_i(-134796160, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
i66 = int_lt(i64, 0)
guard_false(i66, descr=<Guard0xf49d36f4>)
jump(p0, p1, i58, p10, p12, p22, p24, p32, i41, descr=TargetToken(-191075072))
Expected:
i56 = int_gt(i44, 0)
guard_true(i56, descr=...)
p57 = force_token()
setfield_gc(p0, p57, descr=<FieldP pypy.interpreter.pyframe.PyFrame.vable_token 8>)
i58 = call_may_force_i(ConstClass(acquire_timed), p31, -1, descr=<Calli . ri EF=7>)
guard_not_forced(descr=...)
guard_no_exception(descr=...)
i99 = int_eq(i58, 1)
guard_true(i99, descr=...)
i58 = int_sub(i44, 1)
guard_not_invalidated?
i59 = call_i(ConstClass(RPyThreadReleaseLock), i37, descr=<Calli . i EF=2>)
i60 = int_is_true(i59)
guard_false(i60, descr=...)
guard_not_invalidated?
ticker0 = getfield_raw_i(#, descr=<FieldS pypysig_long_struct_inner.c_value .*>)
ticker_cond0 = int_lt(ticker0, 0)
guard_false(ticker_cond0, descr=...)
jump(..., descr=...)
builder: pypy-c-jit-linux-x86-32 build #8370+
test: pypy/module/pypyjit/test_pypy_c/test_thread.py::TestThread::()::test_lock_acquire_release