Armin Rigo avatar Armin Rigo committed 6bcafe9

Backout 4d4b01d56455 and investigate the failure, probably related,
of benchmarks.

Comments (0)

Files changed (9)

pypy/jit/backend/llgraph/llimpl.py

     assert list(argsiter_f) == []
     return args
 
-def do_partial_virtualizable(virtualizable):
-    pass
-
 
 # for ootype meth and staticmeth
 def call_maybe_on_top_of_llinterp(meth, args):

pypy/jit/metainterp/compile.py

         raise metainterp_sd.ExitFrameWithExceptionRef(cpu, exception)
 
 propagate_exception_descr = PropagateExceptionDescr()
-_compile_bogus_code = False     # for test_compile_tmp_callback_and_using_it
 
 def compile_tmp_callback(cpu, jitdriver_sd, greenboxes, redboxes,
                          memory_manager=None):
     else:
         finishargs = []
     #
-    # must cancel the optimization done by optimize_PARTIAL_VIRTUALIZABLE
-    # in optimizeopt/virtualize.py
-    setoperations = []
-    src_index = nb_red_args
-    vinfo = jitdriver_sd.virtualizable_info
-    if vinfo is not None:
-        vablebox = inputargs[jitdriver_sd.index_of_virtualizable]
-        for descr in vinfo.static_field_descrs:
-            valuebox = inputargs[src_index]
-            src_index += 1
-            setoperations.append(
-                ResOperation(rop.SETFIELD_GC, [vablebox, valuebox], None,
-                             descr=descr))
-        for arrayindex in range(len(vinfo.array_field_descrs)):
-            # xxx fish the virtualizable from the box
-            length = vinfo.get_array_length(vablebox.getref_base(), arrayindex)
-            assert src_index + length <= len(inputargs)
-            arraybox = BoxPtr()
-            arrayfielddescr = vinfo.array_field_descrs[arrayindex]
-            arraydescr = vinfo.array_descrs[arrayindex]
-            setoperations.append(
-                ResOperation(rop.GETFIELD_GC, [vablebox], arraybox,
-                             descr=arrayfielddescr))
-            for i in range(length):
-                valuebox = inputargs[src_index]
-                src_index += 1
-                setoperations.append(
-                    ResOperation(rop.SETARRAYITEM_GC,
-                                 [arraybox, history.ConstInt(i), valuebox],
-                                 None, descr=arraydescr))
-    assert src_index == len(inputargs)
-    #
     jd = jitdriver_sd
     faildescr = propagate_exception_descr
     operations = [
         ResOperation(rop.FINISH, finishargs, None, descr=jd.portal_finishtoken)
         ]
     operations[1].setfailargs([])
-    if _compile_bogus_code:      # testing only
-        operations.insert(0, ResOperation(rop.INT_FLOORDIV,
-                                          [history.ConstInt(42),
-                                           history.ConstInt(0)],
-                                          history.BoxInt()))
-    operations = setoperations + operations
     operations = get_deep_immutable_oplist(operations)
     cpu.compile_loop(inputargs, operations, loop_token, log=False)
     if memory_manager is not None:    # for tests

pypy/jit/metainterp/executor.py

                          rop.JIT_DEBUG,
                          rop.SETARRAYITEM_RAW,
                          rop.QUASIIMMUT_FIELD,
-                         rop.PARTIAL_VIRTUALIZABLE,
                          ):      # list of opcodes never executed by pyjitpl
                 continue
             raise AssertionError("missing %r" % (key,))

pypy/jit/metainterp/history.py

     def get_jitcode_for_class(self, oocls):
         return self.jitcodes[oocls]
 
-class JitDriverDescr(AbstractDescr):
-    def __init__(self, jitdriver_sd):
-        self.jitdriver_sd = jitdriver_sd
-
 
 class Const(AbstractValue):
     __slots__ = ()

pypy/jit/metainterp/optimizeopt/simplify.py

         #     but it's a bit hard to implement robustly if heap.py is also run
         pass
 
-    def optimize_PARTIAL_VIRTUALIZABLE(self, op):
-        pass
-
     def propagate_forward(self, op):
         opnum = op.getopnum()
         for value, func in optimize_ops:

pypy/jit/metainterp/optimizeopt/virtualize.py

-from pypy.jit.metainterp import history
 from pypy.jit.metainterp.history import Const, ConstInt, BoxInt
 from pypy.jit.metainterp.resoperation import rop, ResOperation
 from pypy.jit.metainterp.optimizeutil import _findall, sort_descrs
         ###self.heap_op_optimizer.optimize_SETARRAYITEM_GC(op, value, fieldvalue)
         self.emit_operation(op)
 
-    def optimize_PARTIAL_VIRTUALIZABLE(self, op):
-        value = self.getvalue(op.getarg(0))
-        if value.is_virtual():
-            jddescr = op.getdescr()
-            assert isinstance(jddescr, history.JitDriverDescr)
-            vinfo = jddescr.jitdriver_sd.virtualizable_info
-            # XXX giant hack.  The idea is that this virtual will be passed
-            # as the virtualizable to the CALL_ASSEMBLER operation that
-            # follows, so it will be forced.  But we will also pass the
-            # virtualizable fields explicitly as arguments to CALL_ASSEMBLER,
-            # which have already been read out of the virtual just before.
-            # The following hackery resets the fields to their NULL/0 value,
-            # which has (only) the effect that forcing the virtual will not
-            # write anything in these fields.
-            assert isinstance(value, AbstractVirtualStructValue)
-            for descr in vinfo.static_field_descrs:
-                try:
-                    del value._fields[descr]
-                except KeyError:
-                    pass
-            for descr in vinfo.array_field_descrs:
-                avalue = value.getfield(descr, None)
-                if isinstance(avalue, VArrayValue):
-                    for i in range(len(avalue._items)):
-                        avalue._items[i] = avalue.constvalue
-
     def propagate_forward(self, op):
         opnum = op.getopnum()
         for value, func in optimize_ops:

pypy/jit/metainterp/pyjitpl.py

             vbox = args[index]
             args = args + self.gen_load_from_other_virtualizable(vinfo, vbox)
             # ^^^ and not "+=", which makes 'args' a resizable list
-            jddescr = history.JitDriverDescr(targetjitdriver_sd)
-            self.history.record(rop.PARTIAL_VIRTUALIZABLE, [vbox], None,
-                                descr=jddescr)
         warmrunnerstate = targetjitdriver_sd.warmstate
         token = warmrunnerstate.get_assembler_token(greenargs, args)
         op = op.copy_and_change(rop.CALL_ASSEMBLER, args=args, descr=token)

pypy/jit/metainterp/resoperation.py

     'COPYSTRCONTENT/5',       # src, dst, srcstart, dststart, length
     'COPYUNICODECONTENT/5',
     'QUASIIMMUT_FIELD/1d',    # [objptr], descr=SlowMutateDescr
-    'PARTIAL_VIRTUALIZABLE/1d',  # removed before it's passed to the backend
 
     '_CANRAISE_FIRST', # ----- start of can_raise operations -----
     '_CALL_FIRST',

pypy/jit/metainterp/test/test_recursive.py

             i = 1
             while 1:
                 driver.jit_merge_point(codeno=codeno, i=i, frame=frame)
-                assert frame.j >= 100
                 if (i >> 1) == 1:
-                    if frame.j == 100:
+                    if frame.j == 0:
                         return
                     portal(2, Frame(frame.j - 1))
                 elif i == 5:
                 driver.can_enter_jit(codeno=codeno, i=i, frame=frame)
 
         def main(codeno, j):
-            portal(codeno, Frame(j + 100))
+            portal(codeno, Frame(j))
 
         main(2, 5)
 
             print redirected
             assert redirected.keys() == trace
 
-    def test_compile_tmp_callback_and_using_it(self):
-        # unlike the previous tests, this test calls compile_tmp_callback()
-        # and actually invokes the compiled temporary callback
-        driver = JitDriver(greens = ['codeno'], reds = ['i'])
-
-        def main(codeno):
-            i = 1
-            while i < 7:
-                driver.jit_merge_point(codeno=codeno, i=i)
-                if codeno == 1:
-                    return 42
-                if i >= 3:
-                    main(1)
-                i += 1
-            return i
-
-        from pypy.rpython.llinterp import LLException
-        from pypy.jit.metainterp import compile
-        compile._compile_bogus_code = True
-        try:
-            e = py.test.raises(LLException, self.meta_interp,
-                               main, [2], inline=True)
-        finally:
-            compile._compile_bogus_code = False
-        assert e.value.args[2][0] is ZeroDivisionError
-
-        res = self.meta_interp(main, [2], inline=True)
-        assert res == 7
-
-    def test_compile_tmp_callback_and_using_it_with_virtualizable(self):
-        # same as the previous test, but with a virtualizable
-        class Frame(object):
-            _virtualizable2_ = ['j']
-            def __init__(self, j):
-                self.j = j
-
-        driver = JitDriver(greens = ['codeno'], reds = ['i', 'frame'],
-                           virtualizables = ['frame'])
-
-        def main(codeno):
-            frame = Frame(codeno+100)
-            i = 1
-            while i < 7:
-                driver.jit_merge_point(codeno=codeno, i=i, frame=frame)
-                assert frame.j == codeno+100
-                if codeno == 1:
-                    return
-                if i >= 3:
-                    main(1)
-                i += 1
-
-        self.meta_interp(main, [2], inline=True)
-
-    def test_compile_tmp_callback_and_using_it_with_virtualizable_array(self):
-        # same as the previous test, but with a virtualizable with an array
-        class Frame(object):
-            _virtualizable2_ = ['lst[*]']
-            def __init__(self, lst):
-                self = hint(self, fresh_virtualizable=True,
-                                  access_directly=True)
-                self.lst = lst
-
-        driver = JitDriver(greens = ['codeno'], reds = ['i', 'frame'],
-                           virtualizables = ['frame'])
-
-        def main(codeno):
-            frame = Frame([codeno+100])
-            i = 1
-            while i < 7:
-                driver.jit_merge_point(codeno=codeno, i=i, frame=frame)
-                assert frame.lst[0] == codeno+100
-                if codeno == 1:
-                    return
-                if i >= 3:
-                    main(1)
-                i += 1
-
-        self.meta_interp(main, [2], inline=True)
-
     def test_directly_call_assembler_return(self):
         driver = JitDriver(greens = ['codeno'], reds = ['i', 'k'],
                            get_printable_location = lambda codeno : str(codeno))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.