Commits

Armin Rigo committed fd3e4ef

Fix the second half of test_gc_integration.

Comments (0)

Files changed (1)

pypy/jit/backend/x86/test/test_gc_integration.py

 
     def test_malloc_fastpath(self):
         ops = '''
-        []
+        [i0]
         p0 = call_malloc_nursery(16)
         p1 = call_malloc_nursery(32)
         p2 = call_malloc_nursery(16)
-        finish(p0, p1, p2)
+        guard_true(i0) [p0, p1, p2]
         '''
-        self.interpret(ops, [])
+        self.interpret(ops, [0])
         # check the returned pointers
         gc_ll_descr = self.cpu.gc_ll_descr
         nurs_adr = rffi.cast(lltype.Signed, gc_ll_descr.nursery)
-        ref = self.cpu.get_latest_value_ref
+        ref = lambda n: self.cpu.get_latest_value_ref(self.deadframe, n)
         assert rffi.cast(lltype.Signed, ref(0)) == nurs_adr + 0
         assert rffi.cast(lltype.Signed, ref(1)) == nurs_adr + 16
         assert rffi.cast(lltype.Signed, ref(2)) == nurs_adr + 48
 
     def test_malloc_slowpath(self):
         ops = '''
-        []
+        [i0]
         p0 = call_malloc_nursery(16)
         p1 = call_malloc_nursery(32)
         p2 = call_malloc_nursery(24)     # overflow
-        finish(p0, p1, p2)
+        guard_true(i0) [p0, p1, p2]
         '''
-        self.interpret(ops, [])
+        self.interpret(ops, [0])
         # check the returned pointers
         gc_ll_descr = self.cpu.gc_ll_descr
         nurs_adr = rffi.cast(lltype.Signed, gc_ll_descr.nursery)
-        ref = self.cpu.get_latest_value_ref
+        ref = lambda n: self.cpu.get_latest_value_ref(self.deadframe, n)
         assert rffi.cast(lltype.Signed, ref(0)) == nurs_adr + 0
         assert rffi.cast(lltype.Signed, ref(1)) == nurs_adr + 16
         assert rffi.cast(lltype.Signed, ref(2)) == nurs_adr + 0
         for i in range(16):
             self.namespace['ds%i' % i] = cpu.fielddescrof(S2, 's%d' % i)
         ops = '''
-        [p0]
+        [i0, p0]
         p1 = getfield_gc(p0, descr=ds0)
         p2 = getfield_gc(p0, descr=ds1)
         p3 = getfield_gc(p0, descr=ds2)
         p17 = call_malloc_nursery(40)
         p18 = call_malloc_nursery(40)     # overflow
         #
-        finish(p1, p2, p3, p4, p5, p6, p7, p8,         \
-               p9, p10, p11, p12, p13, p14, p15, p16)
+        guard_true(i0) [p1, p2, p3, p4, p5, p6, \
+            p7, p8, p9, p10, p11, p12, p13, p14, p15, p16]
         '''
         s2 = lltype.malloc(S2)
         for i in range(16):
             setattr(s2, 's%d' % i, lltype.malloc(S1))
         s2ref = lltype.cast_opaque_ptr(llmemory.GCREF, s2)
         #
-        self.interpret(ops, [s2ref])
+        self.interpret(ops, [0, s2ref])
         gc_ll_descr = cpu.gc_ll_descr
         gc_ll_descr.check_nothing_in_nursery()
         assert gc_ll_descr.calls == [40]
         # check the returned pointers
         for i in range(16):
-            s1ref = self.cpu.get_latest_value_ref(i)
+            s1ref = self.cpu.get_latest_value_ref(self.deadframe, i)
             s1 = lltype.cast_opaque_ptr(lltype.Ptr(S1), s1ref)
             assert s1 == getattr(s2, 's%d' % i)
 
         for i in range(16):
             self.namespace['ds%i' % i] = cpu.fielddescrof(S2, 's%d' % i)
         ops = '''
-        [p0]
+        [i0, p0]
         p1 = getfield_gc(p0, descr=ds0)
         p2 = getfield_gc(p0, descr=ds1)
         p3 = getfield_gc(p0, descr=ds2)
         p17 = call_malloc_nursery(40)
         p18 = call_malloc_nursery(40)     # overflow
         #
-        finish(p1, p2, p3, p4, p5, p6, p7, p8,         \
-               p9, p10, p11, p12, p13, p14, p15, p16)
+        guard_true(i0) [p1, p2, p3, p4, p5, p6, p7, p8,         \
+               p9, p10, p11, p12, p13, p14, p15, p16]
         '''
         s2 = lltype.malloc(S2)
         for i in range(16):
             gc_ll_descr.gcrootmap.should_see.append(s1)
         s2ref = lltype.cast_opaque_ptr(llmemory.GCREF, s2)
         #
-        self.interpret(ops, [s2ref])
+        self.interpret(ops, [0, s2ref])
         gc_ll_descr.check_nothing_in_nursery()
         assert gc_ll_descr.calls == [40]
         gc_ll_descr.gcrootmap.check_initial_and_final_state()
         # check the returned pointers
         for i in range(16):
-            s1ref = self.cpu.get_latest_value_ref(i)
+            s1ref = self.cpu.get_latest_value_ref(self.deadframe, i)
             s1 = lltype.cast_opaque_ptr(lltype.Ptr(S1), s1ref)
             for j in range(16):
                 assert s1 != getattr(s2, 's%d' % j)