jit.look_inside_iff() is sometimes used dangerously
jit.look_inside_iff()
is sometimes used dangerously. For example, in tupleobject.py, in def _unroll_condition
and def _unroll_condition_cmp
, it always returns True if the W_TupleObject
is a virtual, irrespective of whether the items
list is actually a virtual or not. This makes code like this unroll n
times, for any value of n
:
n = 100
LST1 = [i*i for i in range(n)]
LST2 = [i*i for i in range(n)]
def f():
return tuple(LST1) == tuple(LST2)
while True:
f()
The reason is that _compare_tuples
unrolls, because the two W_TupleObject
involved are virtuals, but the actual lists of items are not.