当前位置: 首页>>代码示例>>Python>>正文


Python HeapCache.new方法代码示例

本文整理汇总了Python中pypy.jit.metainterp.heapcache.HeapCache.new方法的典型用法代码示例。如果您正苦于以下问题:Python HeapCache.new方法的具体用法?Python HeapCache.new怎么用?Python HeapCache.new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pypy.jit.metainterp.heapcache.HeapCache的用法示例。


在下文中一共展示了HeapCache.new方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_circular_virtuals

# 需要导入模块: from pypy.jit.metainterp.heapcache import HeapCache [as 别名]
# 或者: from pypy.jit.metainterp.heapcache.HeapCache import new [as 别名]
 def test_circular_virtuals(self):
     h = HeapCache()
     h.new(box1)
     h.new(box2)
     h.invalidate_caches(rop.SETFIELD_GC, None, [box1, box2])
     h.invalidate_caches(rop.SETFIELD_GC, None, [box2, box1])
     h.invalidate_caches(rop.SETFIELD_GC, None, [box3, box1]) # does not crash
开发者ID:,项目名称:,代码行数:9,代码来源:

示例2: test_heapcache_write_fields_multiple_array

# 需要导入模块: from pypy.jit.metainterp.heapcache import HeapCache [as 别名]
# 或者: from pypy.jit.metainterp.heapcache.HeapCache import new [as 别名]
    def test_heapcache_write_fields_multiple_array(self):
        h = HeapCache()
        h.setarrayitem(box1, descr1, index1, box2)
        assert h.getarrayitem(box1, descr1, index1) is box2
        h.setarrayitem(box3, descr1, index1, box4)
        assert h.getarrayitem(box3, descr1, index1) is box4
        assert h.getarrayitem(box1, descr1, index1) is None # box1 and box3 can alias

        h = HeapCache()
        h.new(box1)
        h.setarrayitem(box1, descr1, index1, box2)
        assert h.getarrayitem(box1, descr1, index1) is box2
        h.setarrayitem(box3, descr1, index1, box4)
        assert h.getarrayitem(box3, descr1, index1) is box4
        assert h.getarrayitem(box1, descr1, index1) is None # box1 and box3 can alias

        h = HeapCache()
        h.new(box1)
        h.new(box3)
        h.setarrayitem(box1, descr1, index1, box2)
        assert h.getarrayitem(box1, descr1, index1) is box2
        h.setarrayitem(box3, descr1, index1, box4)
        assert h.getarrayitem(box3, descr1, index1) is box4
        assert h.getarrayitem(box1, descr1, index1) is box2 # box1 and box3 cannot alias
        h.setarrayitem(box1, descr1, index1, box3)
        assert h.getarrayitem(box3, descr1, index1) is box4
        assert h.getarrayitem(box1, descr1, index1) is box3 # box1 and box3 cannot alias
开发者ID:,项目名称:,代码行数:29,代码来源:

示例3: test_unescaped

# 需要导入模块: from pypy.jit.metainterp.heapcache import HeapCache [as 别名]
# 或者: from pypy.jit.metainterp.heapcache.HeapCache import new [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)
开发者ID:,项目名称:,代码行数:11,代码来源:

示例4: test_unescaped_testing

# 需要导入模块: from pypy.jit.metainterp.heapcache import HeapCache [as 别名]
# 或者: from pypy.jit.metainterp.heapcache.HeapCache import new [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)
开发者ID:,项目名称:,代码行数:19,代码来源:

示例5: test_unescaped_array

# 需要导入模块: from pypy.jit.metainterp.heapcache import HeapCache [as 别名]
# 或者: from pypy.jit.metainterp.heapcache.HeapCache import new [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)

        h = HeapCache()
        h.new_array(box1, lengthbox1)
        h.new(box2)
        assert h.is_unescaped(box1)
        assert h.is_unescaped(box2)
        h.invalidate_caches(rop.SETARRAYITEM_GC, None, [box1, lengthbox2, box2])
        assert h.is_unescaped(box1)
        assert h.is_unescaped(box2)
        h.invalidate_caches(
            rop.CALL, FakeCallDescr(FakeEffektinfo.EF_RANDOM_EFFECTS), [box1]
        )
        assert not h.is_unescaped(box1)
        assert not h.is_unescaped(box2)
开发者ID:,项目名称:,代码行数:24,代码来源:


注:本文中的pypy.jit.metainterp.heapcache.HeapCache.new方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。