Ejemplo n.º 1
0
    def test_nonstandard_virtualizable(self):
        h = HeapCache()
        assert not h.is_nonstandard_virtualizable(1)
        assert not h.is_nonstandard_virtualizable(2)
        h.nonstandard_virtualizables_now_known(1)
        assert h.is_nonstandard_virtualizable(1)
        assert not h.is_nonstandard_virtualizable(2)

        h.reset()
        assert not h.is_nonstandard_virtualizable(1)
        assert not h.is_nonstandard_virtualizable(2)
Ejemplo n.º 2
0
    def test_nonstandard_virtualizable(self):
        h = HeapCache()
        assert not h.is_nonstandard_virtualizable(1)
        assert not h.is_nonstandard_virtualizable(2)
        h.nonstandard_virtualizables_now_known(1)
        assert h.is_nonstandard_virtualizable(1)
        assert not h.is_nonstandard_virtualizable(2)

        h.reset()
        assert not h.is_nonstandard_virtualizable(1)
        assert not h.is_nonstandard_virtualizable(2)
Ejemplo n.º 3
0
    def test_known_class_box(self):
        h = HeapCache()
        assert not h.is_class_known(1)
        assert not h.is_class_known(2)
        h.class_now_known(1)
        assert h.is_class_known(1)
        assert not h.is_class_known(2)

        h.reset()
        assert not h.is_class_known(1)
        assert not h.is_class_known(2)
Ejemplo n.º 4
0
    def test_known_class_box(self):
        h = HeapCache()
        assert not h.is_class_known(1)
        assert not h.is_class_known(2)
        h.class_now_known(1)
        assert h.is_class_known(1)
        assert not h.is_class_known(2)

        h.reset()
        assert not h.is_class_known(1)
        assert not h.is_class_known(2)
Ejemplo n.º 5
0
    def test_heapcache_read_fields_multiple(self):
        h = HeapCache()
        h.getfield_now_known(box1, descr1, box2)
        h.getfield_now_known(box3, descr1, box4)
        assert h.getfield(box1, descr1) is box2
        assert h.getfield(box1, descr2) is None
        assert h.getfield(box3, descr1) is box4
        assert h.getfield(box3, descr2) is None

        h.reset()
        assert h.getfield(box1, descr1) is None
        assert h.getfield(box1, descr2) is None
        assert h.getfield(box3, descr1) is None
        assert h.getfield(box3, descr2) is None
Ejemplo n.º 6
0
    def test_heapcache_read_fields_multiple_array(self):
        h = HeapCache()
        h.getarrayitem_now_known(box1, descr1, index1, box2)
        h.getarrayitem_now_known(box3, descr1, index1, box4)
        assert h.getarrayitem(box1, descr1, index1) is box2
        assert h.getarrayitem(box1, descr2, index1) is None
        assert h.getarrayitem(box3, descr1, index1) is box4
        assert h.getarrayitem(box3, descr2, index1) is None

        h.reset()
        assert h.getarrayitem(box1, descr1, index1) is None
        assert h.getarrayitem(box1, descr2, index1) is None
        assert h.getarrayitem(box3, descr1, index1) is None
        assert h.getarrayitem(box3, descr2, index1) is None
Ejemplo n.º 7
0
    def test_heapcache_read_fields_multiple(self):
        h = HeapCache()
        h.getfield_now_known(box1, descr1, box2)
        h.getfield_now_known(box3, descr1, box4)
        assert h.getfield(box1, descr1) is box2
        assert h.getfield(box1, descr2) is None
        assert h.getfield(box3, descr1) is box4
        assert h.getfield(box3, descr2) is None

        h.reset()
        assert h.getfield(box1, descr1) is None
        assert h.getfield(box1, descr2) is None
        assert h.getfield(box3, descr1) is None
        assert h.getfield(box3, descr2) is None
Ejemplo n.º 8
0
    def test_heapcache_read_fields_multiple_array(self):
        h = HeapCache()
        h.getarrayitem_now_known(box1, descr1, index1, box2)
        h.getarrayitem_now_known(box3, descr1, index1, box4)
        assert h.getarrayitem(box1, descr1, index1) is box2
        assert h.getarrayitem(box1, descr2, index1) is None
        assert h.getarrayitem(box3, descr1, index1) is box4
        assert h.getarrayitem(box3, descr2, index1) is None

        h.reset()
        assert h.getarrayitem(box1, descr1, index1) is None
        assert h.getarrayitem(box1, descr2, index1) is None
        assert h.getarrayitem(box3, descr1, index1) is None
        assert h.getarrayitem(box3, descr2, index1) is None
Ejemplo n.º 9
0
    def test_heapcache_arrays(self):
        h = HeapCache()
        assert h.getarrayitem(box1, descr1, index1) is None
        assert h.getarrayitem(box1, descr2, index1) is None
        assert h.getarrayitem(box1, descr1, index2) is None
        assert h.getarrayitem(box1, descr2, index2) is None

        h.setarrayitem(box1, descr1, index1, box2)
        assert h.getarrayitem(box1, descr1, index1) is box2
        assert h.getarrayitem(box1, descr2, index1) is None
        assert h.getarrayitem(box1, descr1, index2) is None
        assert h.getarrayitem(box1, descr2, index2) is None
        h.setarrayitem(box1, descr1, index2, box4)
        assert h.getarrayitem(box1, descr1, index1) is box2
        assert h.getarrayitem(box1, descr2, index1) is None
        assert h.getarrayitem(box1, descr1, index2) is box4
        assert h.getarrayitem(box1, descr2, index2) is None

        h.setarrayitem(box1, descr2, index1, box3)
        assert h.getarrayitem(box1, descr1, index1) is box2
        assert h.getarrayitem(box1, descr2, index1) is box3
        assert h.getarrayitem(box1, descr1, index2) is box4
        assert h.getarrayitem(box1, descr2, index2) is None

        h.setarrayitem(box1, descr1, index1, box3)
        assert h.getarrayitem(box1, descr1, index1) is box3
        assert h.getarrayitem(box1, descr2, index1) is box3
        assert h.getarrayitem(box1, descr1, index2) is box4
        assert h.getarrayitem(box1, descr2, index2) is None

        h.setarrayitem(box3, descr1, index1, box1)
        assert h.getarrayitem(box3, descr1, index1) is box1
        assert h.getarrayitem(box1, descr1, index1) is None
        assert h.getarrayitem(box1, descr2, index1) is box3
        assert h.getarrayitem(box1, descr1, index2) is box4
        assert h.getarrayitem(box1, descr2, index2) is None

        h.reset()
        assert h.getarrayitem(box1, descr1, index1) is None
        assert h.getarrayitem(box1, descr2, index1) is None
        assert h.getarrayitem(box3, descr1, index1) is None
Ejemplo n.º 10
0
    def test_heapcache_arrays(self):
        h = HeapCache()
        assert h.getarrayitem(box1, descr1, index1) is None
        assert h.getarrayitem(box1, descr2, index1) is None
        assert h.getarrayitem(box1, descr1, index2) is None
        assert h.getarrayitem(box1, descr2, index2) is None

        h.setarrayitem(box1, descr1, index1, box2)
        assert h.getarrayitem(box1, descr1, index1) is box2
        assert h.getarrayitem(box1, descr2, index1) is None
        assert h.getarrayitem(box1, descr1, index2) is None
        assert h.getarrayitem(box1, descr2, index2) is None
        h.setarrayitem(box1, descr1, index2, box4)
        assert h.getarrayitem(box1, descr1, index1) is box2
        assert h.getarrayitem(box1, descr2, index1) is None
        assert h.getarrayitem(box1, descr1, index2) is box4
        assert h.getarrayitem(box1, descr2, index2) is None

        h.setarrayitem(box1, descr2, index1, box3)
        assert h.getarrayitem(box1, descr1, index1) is box2
        assert h.getarrayitem(box1, descr2, index1) is box3
        assert h.getarrayitem(box1, descr1, index2) is box4
        assert h.getarrayitem(box1, descr2, index2) is None

        h.setarrayitem(box1, descr1, index1, box3)
        assert h.getarrayitem(box1, descr1, index1) is box3
        assert h.getarrayitem(box1, descr2, index1) is box3
        assert h.getarrayitem(box1, descr1, index2) is box4
        assert h.getarrayitem(box1, descr2, index2) is None

        h.setarrayitem(box3, descr1, index1, box1)
        assert h.getarrayitem(box3, descr1, index1) is box1
        assert h.getarrayitem(box1, descr1, index1) is None
        assert h.getarrayitem(box1, descr2, index1) is box3
        assert h.getarrayitem(box1, descr1, index2) is box4
        assert h.getarrayitem(box1, descr2, index2) is None

        h.reset()
        assert h.getarrayitem(box1, descr1, index1) is None
        assert h.getarrayitem(box1, descr2, index1) is None
        assert h.getarrayitem(box3, descr1, index1) is None
Ejemplo n.º 11
0
    def test_heapcache_fields(self):
        h = HeapCache()
        assert h.getfield(box1, descr1) is None
        assert h.getfield(box1, descr2) is None
        h.setfield(box1, descr1, box2)
        assert h.getfield(box1, descr1) is box2
        assert h.getfield(box1, descr2) is None
        h.setfield(box1, descr2, box3)
        assert h.getfield(box1, descr1) is box2
        assert h.getfield(box1, descr2) is box3
        h.setfield(box1, descr1, box3)
        assert h.getfield(box1, descr1) is box3
        assert h.getfield(box1, descr2) is box3
        h.setfield(box3, descr1, box1)
        assert h.getfield(box3, descr1) is box1
        assert h.getfield(box1, descr1) is None
        assert h.getfield(box1, descr2) is box3

        h.reset()
        assert h.getfield(box1, descr1) is None
        assert h.getfield(box1, descr2) is None
        assert h.getfield(box3, descr1) is None
Ejemplo n.º 12
0
    def test_heapcache_fields(self):
        h = HeapCache()
        assert h.getfield(box1, descr1) is None
        assert h.getfield(box1, descr2) is None
        h.setfield(box1, descr1, box2)
        assert h.getfield(box1, descr1) is box2
        assert h.getfield(box1, descr2) is None
        h.setfield(box1, descr2, box3)
        assert h.getfield(box1, descr1) is box2
        assert h.getfield(box1, descr2) is box3
        h.setfield(box1, descr1, box3)
        assert h.getfield(box1, descr1) is box3
        assert h.getfield(box1, descr2) is box3
        h.setfield(box3, descr1, box1)
        assert h.getfield(box3, descr1) is box1
        assert h.getfield(box1, descr1) is None
        assert h.getfield(box1, descr2) is box3

        h.reset()
        assert h.getfield(box1, descr1) is None
        assert h.getfield(box1, descr2) is None
        assert h.getfield(box3, descr1) is None