Commits

Armin Rigo committed 1226e74

progress

Comments (0)

Files changed (2)

rpython/jit/backend/llsupport/stmrewrite.py

         return val not in self.write_barrier_applied
 
 
-    def handle_setfields(self, op):
-        opnum = op.getopnum()
-        descr = op.getdescr()
-        target_category = 'W'
-        if opnum == rop.SETFIELD_GC:
-            assert isinstance(descr, FieldDescr)
-            if not descr.is_pointer_field():
-                target_category = 'V'
-        elif opnum == rop.SETINTERIORFIELD_GC:
-            assert isinstance(descr, InteriorFieldDescr)
-            if not descr.is_pointer_field():
-                target_category = 'V'
-        elif opnum == rop.SETARRAYITEM_GC:
-            assert isinstance(descr, ArrayDescr)
-            if not descr.is_array_of_pointers():
-                target_category = 'V'
-        elif opnum in (rop.STRSETITEM, rop.UNICODESETITEM):
-            target_category = 'V'
-            
-        self.handle_category_operations(op, target_category)
-
-    
-    def handle_category_operations(self, op, target_category):
-        lst = op.getarglist()
-        lst[0] = self.gen_barrier(lst[0], target_category)
-        self.newops.append(op.copy_and_change(op.getopnum(), args=lst))
-
-    def handle_malloc_operation(self, op):
-        GcRewriterAssembler.handle_malloc_operation(self, op)
-        self.known_category[op.result] = 'W'
-
     def handle_copystrcontent(self, op):
+        xxxxxxxx
         # first, a write barrier on the target string
         lst = op.getarglist()
         lst[1] = self.gen_barrier(lst[1], 'W')
         self.newops.append(op)
         debug_print("fallback for", op.repr())
 
-    def _is_null(self, box):
-        return isinstance(box, ConstPtr) and not box.value
-
     def maybe_handle_raw_accesses(self, op):
+        xxxxx
         from rpython.jit.backend.llsupport.descr import FieldDescr
         descr = op.getdescr()
         assert isinstance(descr, FieldDescr)

rpython/jit/backend/llsupport/test/test_stmrewrite.py

     words.append('ARRAYLEN_GC')
     words.append('GETFIELD_GC_PURE')
     words.append('GETARRAYITEM_GC_PURE')
+    # these are handled by rewrite.py
+    words.append('SETFIELD_GC')
+    words.append('SETARRAYITEM_GC')
+    words.append('SETINTERIORFIELD_GC')
     #
     words = set(words)
     missing = []
              jump(p3)
         """)
 
-    def test_invalidate_read_status_after_write_to_constptr(self):
+    def test_mixed_case(self):
         TP = lltype.GcArray(lltype.Signed)
         NULL = lltype.cast_opaque_ptr(llmemory.GCREF, lltype.nullptr(TP))
         self.check_rewrite("""
-            [p0]
-            p1 = same_as(ConstPtr(t))
-            p2 = same_as(ConstPtr(t))
+            [p0, p1, p2]
             p3 = getfield_gc(p1, descr=tzdescr)
             setfield_gc(p2, p0, descr=tzdescr)
             p4 = getfield_gc(p1, descr=tzdescr)
             jump()
         """, """
-            [p0]
-            p1 = same_as(ConstPtr(t))
-            p2 = same_as(ConstPtr(t))
+            [p0, p1, p2]
             p3 = getfield_gc(p1, descr=tzdescr)
             stm_read(p1)
             cond_call_gc_wb(p2, descr=wbdescr)
             setfield_gc(p2, p0, descr=tzdescr)
-            cond_call_stm_b(p1, descr=Q2Rdescr)
             p4 = getfield_gc(p1, descr=tzdescr)
-            
             jump()
             """, t=NULL)
 
-    def test_invalidate_read_status_after_write(self):
-        self.check_rewrite("""
-            [p0]
-            p1 = same_as(p0)
-            p2 = same_as(p0)
-            p4 = getfield_gc(p1, descr=tzdescr)
-            setfield_gc(p2, p0, descr=tzdescr)
-            p5 = getfield_gc(p1, descr=tzdescr)
-            jump()
-        """, """
-            [p0]
-            p1 = same_as(p0)
-            p2 = same_as(p0)
-            cond_call_stm_b(p1, descr=A2Rdescr)
-            p4 = getfield_gc(p1, descr=tzdescr)
-            cond_call_stm_b(p2, descr=A2Wdescr)
-            setfield_gc(p2, p0, descr=tzdescr)
-            cond_call_stm_b(p1, descr=Q2Rdescr)
-            p5 = getfield_gc(p1, descr=tzdescr)
-            
-            jump()
-        """)
-
-    def test_invalidate_read_status_after_write_to_field(self):
-        self.check_rewrite("""
-            [p0]
-            p1 = getfield_gc(p0, descr=tzdescr)
-            p2 = getfield_gc(p0, descr=tzdescr)
-            p3 = getfield_gc(p1, descr=tzdescr)
-            setfield_gc(p2, p0, descr=tzdescr)
-            p4 = getfield_gc(p1, descr=tzdescr)
-            jump()
-        """, """
-            [p0]
-            cond_call_stm_b(p0, descr=A2Rdescr)
-            p1 = getfield_gc(p0, descr=tzdescr)
-            p2 = getfield_gc(p0, descr=tzdescr)
-            cond_call_stm_b(p1, descr=A2Rdescr)
-            p3 = getfield_gc(p1, descr=tzdescr)
-            cond_call_stm_b(p2, descr=A2Wdescr)
-            setfield_gc(p2, p0, descr=tzdescr)
-            cond_call_stm_b(p1, descr=Q2Rdescr)
-            p4 = getfield_gc(p1, descr=tzdescr)
-            
-            jump()
-        """)
-
-    def test_invalidate_read_status_after_write_array_interior(self):
-        ops = [('getarrayitem_gc', 'adescr'),
-                ('getinteriorfield_gc', 'intzdescr')]
-        original = """
-            [p0, i1, i2]
-            p1 = %s(p0, i1, descr=%s)
-            p2 = %s(p0, i2, descr=%s)
-            p3 = getfield_gc(p1, descr=tzdescr)
-            setfield_gc(p2, p0, descr=tzdescr)
-            p4 = getfield_gc(p1, descr=tzdescr)
-            jump()
-        """
-        rewritten = """
-            [p0, i1, i2]
-            cond_call_stm_b(p0, descr=A2Rdescr)
-            p1 = %s(p0, i1, descr=%s)
-            p2 = %s(p0, i2, descr=%s)
-            cond_call_stm_b(p1, descr=A2Rdescr)
-            p3 = getfield_gc(p1, descr=tzdescr)
-            cond_call_stm_b(p2, descr=A2Wdescr)
-            setfield_gc(p2, p0, descr=tzdescr)
-            cond_call_stm_b(p1, descr=Q2Rdescr)
-            p4 = getfield_gc(p1, descr=tzdescr)
-            
-            jump()
-        """
-        for op, descr in ops:
-            self.check_rewrite(original % (op, descr, op, descr),
-                               rewritten % (op, descr, op, descr))
-
     def test_rewrite_write_barrier_after_malloc(self):
         self.check_rewrite("""
             [p1, p3]
             jump(p2)
         """, """
             [p1, p3]
-            cond_call_stm_b(p3, descr=A2Wdescr)
+            cond_call_gc_wb(p3, descr=wbdescr)
             setfield_gc(p3, p1, descr=tzdescr)
             p2 = call_malloc_nursery(%(tdescr.size)d)
             setfield_gc(p2, %(tdescr.tid)d, descr=tiddescr)
-            stm_set_revision_gc(p2, descr=revdescr)
-            cond_call_stm_b(p3, descr=V2Wdescr)
+            cond_call_gc_wb(p3, descr=wbdescr)
             setfield_gc(p3, p1, descr=tzdescr)
-            
             jump(p2)
         """)
 
-    def test_rewrite_read_barrier_after_malloc(self):
+    def test_rewrite_no_read_barrier_after_malloc(self):
         self.check_rewrite("""
             [p1]
             p2 = getfield_gc(p1, descr=tzdescr)
             jump(p2)
         """, """
             [p1]
-            cond_call_stm_b(p1, descr=A2Rdescr)
             p2 = getfield_gc(p1, descr=tzdescr)
+            stm_read(p1)
             p3 = call_malloc_nursery(%(tdescr.size)d)
             setfield_gc(p3, %(tdescr.tid)d, descr=tiddescr)
-            stm_set_revision_gc(p3, descr=revdescr)
             p4 = getfield_gc(p1, descr=tzdescr)
-            
             jump(p2)
         """)
-            
+
     def test_rewrite_setfield_gc_on_local(self):
         self.check_rewrite("""
             [p1]