[pypy-svn] r77112 - in pypy/branch/resoperation-refactoring/pypy/jit/metainterp: . optimizeopt test

antocuni at codespeak.net antocuni at codespeak.net
Thu Sep 16 15:04:27 CEST 2010


Author: antocuni
Date: Thu Sep 16 15:04:25 2010
New Revision: 77112

Modified:
   pypy/branch/resoperation-refactoring/pypy/jit/metainterp/optimizeopt/optimizer.py
   pypy/branch/resoperation-refactoring/pypy/jit/metainterp/optimizeopt/virtualize.py
   pypy/branch/resoperation-refactoring/pypy/jit/metainterp/pyjitpl.py
   pypy/branch/resoperation-refactoring/pypy/jit/metainterp/simple_optimize.py
   pypy/branch/resoperation-refactoring/pypy/jit/metainterp/test/oparser.py
   pypy/branch/resoperation-refactoring/pypy/jit/metainterp/test/test_logger.py
   pypy/branch/resoperation-refactoring/pypy/jit/metainterp/test/test_oparser.py
Log:
(david, antocuni): more ResOperation refactoring: now all the metainterp tests but ztranslation pass


Modified: pypy/branch/resoperation-refactoring/pypy/jit/metainterp/optimizeopt/optimizer.py
==============================================================================
--- pypy/branch/resoperation-refactoring/pypy/jit/metainterp/optimizeopt/optimizer.py	(original)
+++ pypy/branch/resoperation-refactoring/pypy/jit/metainterp/optimizeopt/optimizer.py	Thu Sep 16 15:04:25 2010
@@ -362,7 +362,8 @@
                 else:
                     raise AssertionError("uh?")
                 op.opnum = opnum
-                op.args = [op.getarg(0)]
+                # XXX XXX: fix me when the refactoring is complete
+                op._args = [op.getarg(0)]
             else:
                 # a real GUARD_VALUE.  Make it use one counter per value.
                 descr.make_a_counter_per_value(op)

Modified: pypy/branch/resoperation-refactoring/pypy/jit/metainterp/optimizeopt/virtualize.py
==============================================================================
--- pypy/branch/resoperation-refactoring/pypy/jit/metainterp/optimizeopt/virtualize.py	(original)
+++ pypy/branch/resoperation-refactoring/pypy/jit/metainterp/optimizeopt/virtualize.py	Thu Sep 16 15:04:25 2010
@@ -324,7 +324,7 @@
         vrefinfo = self.optimizer.metainterp_sd.virtualref_info
         # op.getarg(1) should really never point to null here
         # - set 'forced' to point to the real object
-        op1 = ResOperation(rop.SETFIELD_GC, op.args, None,
+        op1 = ResOperation(rop.SETFIELD_GC, op._args, None,
                           descr = vrefinfo.descr_forced)
         self.optimize_SETFIELD_GC(op1)
         # - set 'virtual_token' to TOKEN_NONE

Modified: pypy/branch/resoperation-refactoring/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/resoperation-refactoring/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/resoperation-refactoring/pypy/jit/metainterp/pyjitpl.py	Thu Sep 16 15:04:25 2010
@@ -2112,8 +2112,8 @@
         op = self.history.operations.pop()
         assert op.opnum == rop.CALL_MAY_FORCE
         num_green_args = targetjitdriver_sd.num_green_args
-        greenargs = op.args[1:num_green_args+1]
-        args = op.args[num_green_args+1:]
+        greenargs = op.sliceargs(1, num_green_args+1)
+        args = op.sliceargs(num_green_args+1, op.numargs())
         assert len(args) == targetjitdriver_sd.num_red_args
         vinfo = targetjitdriver_sd.virtualizable_info
         if vinfo is not None:
@@ -2124,7 +2124,7 @@
         warmrunnerstate = targetjitdriver_sd.warmstate
         token = warmrunnerstate.get_assembler_token(greenargs, args)
         op.opnum = rop.CALL_ASSEMBLER
-        op.args = args
+        op.setarglist(args)
         op.descr = token
         self.history.operations.append(op)
 

Modified: pypy/branch/resoperation-refactoring/pypy/jit/metainterp/simple_optimize.py
==============================================================================
--- pypy/branch/resoperation-refactoring/pypy/jit/metainterp/simple_optimize.py	(original)
+++ pypy/branch/resoperation-refactoring/pypy/jit/metainterp/simple_optimize.py	Thu Sep 16 15:04:25 2010
@@ -12,7 +12,7 @@
     # change ARRAYCOPY to call, so we don't have to pass around
     # unnecessary information to the backend.  Do the same with VIRTUAL_REF_*.
     if op.opnum == rop.ARRAYCOPY:
-        descr = op.args[0]
+        descr = op.getarg(0)
         assert isinstance(descr, AbstractDescr)
         args = op.sliceargs(1, op.numargs())
         op = ResOperation(rop.CALL, args, op.result, descr=descr)

Modified: pypy/branch/resoperation-refactoring/pypy/jit/metainterp/test/oparser.py
==============================================================================
--- pypy/branch/resoperation-refactoring/pypy/jit/metainterp/test/oparser.py	(original)
+++ pypy/branch/resoperation-refactoring/pypy/jit/metainterp/test/oparser.py	Thu Sep 16 15:04:25 2010
@@ -26,7 +26,7 @@
         def opboxes(operations):
             for op in operations:
                 yield op.result
-                for box in op.args:
+                for box in op.sliceargs(0, op.numargs()):
                     yield box
         def allboxes():
             for box in self.inputargs:

Modified: pypy/branch/resoperation-refactoring/pypy/jit/metainterp/test/test_logger.py
==============================================================================
--- pypy/branch/resoperation-refactoring/pypy/jit/metainterp/test/test_logger.py	(original)
+++ pypy/branch/resoperation-refactoring/pypy/jit/metainterp/test/test_logger.py	Thu Sep 16 15:04:25 2010
@@ -100,8 +100,8 @@
         debug_merge_point("info")
         '''
         loop, oloop = self.reparse(inp, check_equal=False)
-        assert loop.operations[0].args[0]._get_str() == 'info'
-        assert oloop.operations[0].args[0]._get_str() == 'info'
+        assert loop.operations[0].getarg(0)._get_str() == 'info'
+        assert oloop.operations[0].getarg(0)._get_str() == 'info'
         
     def test_floats(self):
         inp = '''

Modified: pypy/branch/resoperation-refactoring/pypy/jit/metainterp/test/test_oparser.py
==============================================================================
--- pypy/branch/resoperation-refactoring/pypy/jit/metainterp/test/test_oparser.py	(original)
+++ pypy/branch/resoperation-refactoring/pypy/jit/metainterp/test/test_oparser.py	Thu Sep 16 15:04:25 2010
@@ -111,7 +111,7 @@
     TP = lltype.GcArray(lltype.Signed)
     NULL = lltype.cast_opaque_ptr(llmemory.GCREF, lltype.nullptr(TP))
     loop = parse(x, None, {'func_ptr' : NULL})
-    assert loop.operations[0].args[0].value == NULL
+    assert loop.operations[0].getarg(0).value == NULL
 
 def test_jump_target():
     x = '''
@@ -136,7 +136,7 @@
     f1 = float_add(f0, 3.5)
     '''
     loop = parse(x)
-    assert isinstance(loop.operations[0].args[0], BoxFloat)
+    assert isinstance(loop.operations[0].getarg(0), BoxFloat)
     
 def test_debug_merge_point():
     x = '''
@@ -147,10 +147,10 @@
     debug_merge_point('(stuff) #1')
     '''
     loop = parse(x)
-    assert loop.operations[0].args[0]._get_str() == 'info'
-    assert loop.operations[1].args[0]._get_str() == 'info'
-    assert loop.operations[2].args[0]._get_str() == "<some ('other,')> info"
-    assert loop.operations[3].args[0]._get_str() == "(stuff) #1"
+    assert loop.operations[0].getarg(0)._get_str() == 'info'
+    assert loop.operations[1].getarg(0)._get_str() == 'info'
+    assert loop.operations[2].getarg(0)._get_str() == "<some ('other,')> info"
+    assert loop.operations[3].getarg(0)._get_str() == "(stuff) #1"
     
 
 def test_descr_with_obj_print():



More information about the Pypy-commit mailing list