本文整理匯總了Python中pypy.jit.metainterp.heapcache.HeapCache.is_unescaped方法的典型用法代碼示例。如果您正苦於以下問題:Python HeapCache.is_unescaped方法的具體用法?Python HeapCache.is_unescaped怎麽用?Python HeapCache.is_unescaped使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pypy.jit.metainterp.heapcache.HeapCache
的用法示例。
在下文中一共展示了HeapCache.is_unescaped方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_unescaped_array
# 需要導入模塊: from pypy.jit.metainterp.heapcache import HeapCache [as 別名]
# 或者: from pypy.jit.metainterp.heapcache.HeapCache import is_unescaped [as 別名]
def test_unescaped_array(self):
h = HeapCache()
h.new_array(box1, lengthbox1)
assert h.is_unescaped(box1)
h.invalidate_caches(rop.SETARRAYITEM_GC, None, [box1, index1, box2])
assert h.is_unescaped(box1)
h.invalidate_caches(rop.SETARRAYITEM_GC, None, [box2, index1, box1])
assert not h.is_unescaped(box1)
示例2: test_unescaped
# 需要導入模塊: from pypy.jit.metainterp.heapcache import HeapCache [as 別名]
# 或者: from pypy.jit.metainterp.heapcache.HeapCache import is_unescaped [as 別名]
def test_unescaped(self):
h = HeapCache()
assert not h.is_unescaped(box1)
h.new(box2)
assert h.is_unescaped(box2)
h.invalidate_caches(rop.SETFIELD_GC, None, [box2, box1])
assert h.is_unescaped(box2)
h.invalidate_caches(rop.SETFIELD_GC, None, [box1, box2])
assert not h.is_unescaped(box2)
示例3: test_unescaped_testing
# 需要導入模塊: from pypy.jit.metainterp.heapcache import HeapCache [as 別名]
# 或者: from pypy.jit.metainterp.heapcache.HeapCache import is_unescaped [as 別名]
def test_unescaped_testing(self):
h = HeapCache()
h.new(box1)
h.new(box2)
assert h.is_unescaped(box1)
assert h.is_unescaped(box2)
# Putting a virtual inside of another virtual doesn't escape it.
h.invalidate_caches(rop.SETFIELD_GC, None, [box1, box2])
assert h.is_unescaped(box2)
# Reading a field from a virtual doesn't escape it.
h.invalidate_caches(rop.GETFIELD_GC, None, [box1])
assert h.is_unescaped(box1)
# Escaping a virtual transitively escapes anything inside of it.
assert not h.is_unescaped(box3)
h.invalidate_caches(rop.SETFIELD_GC, None, [box3, box1])
assert not h.is_unescaped(box1)
assert not h.is_unescaped(box2)