[pypy-svn] r77114 - in pypy/branch/resoperation-refactoring/pypy/jit: backend/llsupport backend/llsupport/test metainterp

antocuni at codespeak.net antocuni at codespeak.net
Thu Sep 16 15:14:35 CEST 2010


Author: antocuni
Date: Thu Sep 16 15:14:34 2010
New Revision: 77114

Modified:
   pypy/branch/resoperation-refactoring/pypy/jit/backend/llsupport/gc.py
   pypy/branch/resoperation-refactoring/pypy/jit/backend/llsupport/test/test_gc.py
   pypy/branch/resoperation-refactoring/pypy/jit/metainterp/history.py
Log:
(david, antocuni) make llsupport tests passing


Modified: pypy/branch/resoperation-refactoring/pypy/jit/backend/llsupport/gc.py
==============================================================================
--- pypy/branch/resoperation-refactoring/pypy/jit/backend/llsupport/gc.py	(original)
+++ pypy/branch/resoperation-refactoring/pypy/jit/backend/llsupport/gc.py	Thu Sep 16 15:14:34 2010
@@ -563,8 +563,8 @@
                 continue
             # ---------- replace ConstPtrs with GETFIELD_RAW ----------
             # xxx some performance issue here
-            for i in range(len(op.args)):
-                v = op.args[i]
+            for i in range(op.numargs()):
+                v = op.getarg(i)
                 if isinstance(v, ConstPtr) and bool(v.value):
                     addr = self.gcrefs.get_address_of_gcref(v.value)
                     # ^^^even for non-movable objects, to record their presence
@@ -574,22 +574,22 @@
                         newops.append(ResOperation(rop.GETFIELD_RAW,
                                                    [ConstInt(addr)], box,
                                                    self.single_gcref_descr))
-                        op.args[i] = box
+                        op.setarg(i, box)
             # ---------- write barrier for SETFIELD_GC ----------
             if op.opnum == rop.SETFIELD_GC:
-                v = op.args[1]
+                v = op.getarg(1)
                 if isinstance(v, BoxPtr) or (isinstance(v, ConstPtr) and
                                              bool(v.value)): # store a non-NULL
-                    self._gen_write_barrier(newops, op.args[0], v)
-                    op = ResOperation(rop.SETFIELD_RAW, op.args, None,
+                    self._gen_write_barrier(newops, op.getarg(0), v)
+                    op = ResOperation(rop.SETFIELD_RAW, op._args, None,
                                       descr=op.descr)
             # ---------- write barrier for SETARRAYITEM_GC ----------
             if op.opnum == rop.SETARRAYITEM_GC:
-                v = op.args[2]
+                v = op.getarg(2)
                 if isinstance(v, BoxPtr) or (isinstance(v, ConstPtr) and
                                              bool(v.value)): # store a non-NULL
-                    self._gen_write_barrier(newops, op.args[0], v)
-                    op = ResOperation(rop.SETARRAYITEM_RAW, op.args, None,
+                    self._gen_write_barrier(newops, op.getarg(0), v)
+                    op = ResOperation(rop.SETARRAYITEM_RAW, op._args, None,
                                       descr=op.descr)
             # ----------
             newops.append(op)

Modified: pypy/branch/resoperation-refactoring/pypy/jit/backend/llsupport/test/test_gc.py
==============================================================================
--- pypy/branch/resoperation-refactoring/pypy/jit/backend/llsupport/test/test_gc.py	(original)
+++ pypy/branch/resoperation-refactoring/pypy/jit/backend/llsupport/test/test_gc.py	Thu Sep 16 15:14:34 2010
@@ -259,8 +259,8 @@
         assert llop1.record == []
         assert len(newops) == 1
         assert newops[0].opnum == rop.COND_CALL_GC_WB
-        assert newops[0].args[0] == v_base
-        assert newops[0].args[1] == v_value
+        assert newops[0].getarg(0) == v_base
+        assert newops[0].getarg(1) == v_value
         assert newops[0].result is None
         wbdescr = newops[0].descr
         assert isinstance(wbdescr.jit_wb_if_flag, int)
@@ -299,12 +299,13 @@
         gc_ll_descr.rewrite_assembler(MyFakeCPU(), operations)
         assert len(operations) == 2
         assert operations[0].opnum == rop.GETFIELD_RAW
-        assert operations[0].args == [ConstInt(43)]
+        assert operations[0].getarg(0) == ConstInt(43)
         assert operations[0].descr == gc_ll_descr.single_gcref_descr
         v_box = operations[0].result
         assert isinstance(v_box, BoxPtr)
         assert operations[1].opnum == rop.PTR_EQ
-        assert operations[1].args == [v_random_box, v_box]
+        assert operations[1].getarg(0) == v_random_box
+        assert operations[1].getarg(1) == v_box
         assert operations[1].result == v_result
 
     def test_rewrite_assembler_1_cannot_move(self):
@@ -337,7 +338,8 @@
             rgc.can_move = old_can_move
         assert len(operations) == 1
         assert operations[0].opnum == rop.PTR_EQ
-        assert operations[0].args == [v_random_box, ConstPtr(s_gcref)]
+        assert operations[0].getarg(0) == v_random_box
+        assert operations[0].getarg(1) == ConstPtr(s_gcref)
         assert operations[0].result == v_result
         # check that s_gcref gets added to the list anyway, to make sure
         # that the GC sees it
@@ -357,12 +359,13 @@
         assert len(operations) == 2
         #
         assert operations[0].opnum == rop.COND_CALL_GC_WB
-        assert operations[0].args[0] == v_base
-        assert operations[0].args[1] == v_value
+        assert operations[0].getarg(0) == v_base
+        assert operations[0].getarg(1) == v_value
         assert operations[0].result is None
         #
         assert operations[1].opnum == rop.SETFIELD_RAW
-        assert operations[1].args == [v_base, v_value]
+        assert operations[1].getarg(0) == v_base
+        assert operations[1].getarg(1) == v_value
         assert operations[1].descr == field_descr
 
     def test_rewrite_assembler_3(self):
@@ -380,10 +383,12 @@
         assert len(operations) == 2
         #
         assert operations[0].opnum == rop.COND_CALL_GC_WB
-        assert operations[0].args[0] == v_base
-        assert operations[0].args[1] == v_value
+        assert operations[0].getarg(0) == v_base
+        assert operations[0].getarg(1) == v_value
         assert operations[0].result is None
         #
         assert operations[1].opnum == rop.SETARRAYITEM_RAW
-        assert operations[1].args == [v_base, v_index, v_value]
+        assert operations[1].getarg(0) == v_base
+        assert operations[1].getarg(1) == v_index
+        assert operations[1].getarg(2) == v_value
         assert operations[1].descr == array_descr

Modified: pypy/branch/resoperation-refactoring/pypy/jit/metainterp/history.py
==============================================================================
--- pypy/branch/resoperation-refactoring/pypy/jit/metainterp/history.py	(original)
+++ pypy/branch/resoperation-refactoring/pypy/jit/metainterp/history.py	Thu Sep 16 15:14:34 2010
@@ -794,7 +794,8 @@
         # RPython-friendly
         print '%r: inputargs =' % self, self._dump_args(self.inputargs)
         for op in self.operations:
-            print '\t', op.getopname(), self._dump_args(op.args), \
+            args = op.sliceargs(0, op.numargs())
+            print '\t', op.getopname(), self._dump_args(args), \
                   self._dump_box(op.result)
 
     def _dump_args(self, boxes):



More information about the Pypy-commit mailing list