本文整理汇总了Python中pypy.jit.metainterp.heapcache.HeapCache.new_array方法的典型用法代码示例。如果您正苦于以下问题:Python HeapCache.new_array方法的具体用法?Python HeapCache.new_array怎么用?Python HeapCache.new_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypy.jit.metainterp.heapcache.HeapCache
的用法示例。
在下文中一共展示了HeapCache.new_array方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ll_arraycopy
# 需要导入模块: from pypy.jit.metainterp.heapcache import HeapCache [as 别名]
# 或者: from pypy.jit.metainterp.heapcache.HeapCache import new_array [as 别名]
def test_ll_arraycopy(self):
h = HeapCache()
h.new_array(box1, lengthbox1)
h.setarrayitem(box1, descr1, index1, box2)
h.new_array(box2, lengthbox1)
# Just need the destination box for this call
h.invalidate_caches(
rop.CALL,
FakeCallDescr(FakeEffektinfo.EF_CANNOT_RAISE, FakeEffektinfo.OS_ARRAYCOPY),
[None, None, box2, None, None]
)
assert h.getarrayitem(box1, descr1, index1) is box2
h.invalidate_caches(
rop.CALL,
FakeCallDescr(FakeEffektinfo.EF_CANNOT_RAISE, FakeEffektinfo.OS_ARRAYCOPY),
[None, None, box3, None, None]
)
assert h.getarrayitem(box1, descr1, index1) is None
h.setarrayitem(box4, descr1, index1, box2)
assert h.getarrayitem(box4, descr1, index1) is box2
h.invalidate_caches(
rop.CALL,
FakeCallDescr(FakeEffektinfo.EF_CANNOT_RAISE, FakeEffektinfo.OS_ARRAYCOPY),
[None, None, box2, None, None]
)
assert h.getarrayitem(box4, descr1, index1) is None
示例2: test_length_cache
# 需要导入模块: from pypy.jit.metainterp.heapcache import HeapCache [as 别名]
# 或者: from pypy.jit.metainterp.heapcache.HeapCache import new_array [as 别名]
def test_length_cache(self):
h = HeapCache()
h.new_array(box1, lengthbox1)
assert h.arraylen(box1) is lengthbox1
assert h.arraylen(box2) is None
h.arraylen_now_known(box2, lengthbox2)
assert h.arraylen(box2) is lengthbox2
示例3: test_unescaped_array
# 需要导入模块: from pypy.jit.metainterp.heapcache import HeapCache [as 别名]
# 或者: from pypy.jit.metainterp.heapcache.HeapCache import new_array [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)