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 0xfffef8715910>
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_add(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:409: in match_op
self._assert(op.name == exp_opname, "operation mismatch")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.pypyjit.test_pypy_c.model.OpMatcher object at 0xfffef8417110>
cond = False, message = 'operation mismatch'
def _assert(self, cond, message):
if not cond:
> raise InvalidMatch(message, frame=sys._getframe(1))
E InvalidMatch: operation mismatch
pypy/module/pypyjit/test_pypy_c/model.py:402: InvalidMatch
---------- Captured stdout call ----------
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Loops don't match
=================
loop id = None
('operation mismatch',)
<could not determine information>
Ignore ops: []
Got:
i50 = int_gt(i40, 0)
guard_true(i50, descr=<Guard0xffff74811340>)
===== HERE =====
guard_not_invalidated(descr=<Guard0xffff746ba620>)
p51 = force_token()
setfield_gc(p0, p51, descr=<FieldP pypy.interpreter.pyframe.PyFrame.vable_token 8>)
i54 = call_may_force_i(ConstClass(acquire_timed), p32, -1, descr=<Calli 8 ri EF=7>)
guard_not_forced(descr=<Guard0xffff747f5740>)
guard_no_exception(descr=<Guard0xffff746ba650>)
i56 = int_eq(i54, 1)
guard_true(i56, descr=<Guard0xffff746ba6b0>)
i58 = int_add(i40, -1)
guard_not_invalidated(descr=<Guard0xffff746ba6e0>)
i60 = call_i(ConstClass(RPyThreadReleaseLock), i41, descr=<Calli 8 i EF=2>)
i61 = int_is_true(i60)
guard_false(i61, descr=<Guard0xffff74811388>)
i64 = getfield_raw_i(281472725739304, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
i66 = int_lt(i64, 0)
guard_false(i66, descr=<Guard0xffff746ba770>)
jump(p0, p1, i58, p10, p12, p22, p24, p32, i41, descr=TargetToken(281472636329184))
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_add(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-aarch64 build #2946+
test: pypy/module/pypyjit/test_pypy_c/test_thread.py::TestThread::()::test_lock_acquire_release