[pypy-commit] pypy resume-refactor: random delete

fijal noreply at buildbot.pypy.org
Thu Aug 29 12:24:32 CEST 2013


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: resume-refactor
Changeset: r66426:607ca4f81d20
Date: 2013-08-29 11:20 +0100
http://bitbucket.org/pypy/pypy/changeset/607ca4f81d20/

Log:	random delete

diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py
--- a/rpython/jit/backend/llgraph/runner.py
+++ b/rpython/jit/backend/llgraph/runner.py
@@ -45,8 +45,6 @@
                                        map(mapping, op.getarglist()),
                                        mapping(op.result),
                                        newdescr)
-            if op.getfailargs() is not None:
-                newop.setfailargs(map(mapping, op.getfailargs()))
             self.operations.append(newop)
 
 class WeakrefDescr(AbstractDescr):
@@ -694,19 +692,11 @@
     # -----------------------------------------------------
 
     def fail_guard(self, descr, saved_data=None):
-        values = []
-        for box in self.current_op.getfailargs():
-            if box is not None:
-                value = self.env[box]
-            else:
-                value = None
-            values.append(value)
         if hasattr(descr, '_llgraph_bridge'):
             target = (descr._llgraph_bridge, -1)
-            values = [value for value in values if value is not None]
-            raise Jump(target, values)
+            raise Jump(target, self.frontend_env)
         else:
-            raise ExecutionFinished(LLDeadFrame(descr, values,
+            raise ExecutionFinished(LLDeadFrame(descr, self.frontend_env,
                                                 self.last_exception,
                                                 saved_data))
 
@@ -827,6 +817,9 @@
     def execute_jump(self, descr, *args):
         raise Jump(descr._llgraph_target, args)
 
+    def execute_resume_put(self, descr, box, depth, position):
+        xxx
+
     def _do_math_sqrt(self, value):
         import math
         y = support.cast_from_floatstorage(lltype.Float, value)
diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py
--- a/rpython/jit/backend/test/runner_test.py
+++ b/rpython/jit/backend/test/runner_test.py
@@ -164,6 +164,8 @@
             ResOperation(rop.LABEL, [i0], None, descr=targettoken),
             ResOperation(rop.INT_ADD, [i0, ConstInt(1)], i1),
             ResOperation(rop.INT_LE, [i1, ConstInt(9)], i2),
+            ResOperation(rop.RESUME_PUT, [i2, ConstInt(0), ConstInt(0)],
+                         None),
             ResOperation(rop.GUARD_TRUE, [i2], None, descr=BasicFailDescr(2)),
             ResOperation(rop.JUMP, [i1], None, descr=targettoken),
             ]
@@ -2240,7 +2242,7 @@
 
         for i in range(5):
             called = []
-        
+
             FUNC = self.FuncType([lltype.Signed] * i, lltype.Void)
             func_ptr = llhelper(lltype.Ptr(FUNC), func_void)
             calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
diff --git a/rpython/jit/metainterp/compile.py b/rpython/jit/metainterp/compile.py
--- a/rpython/jit/metainterp/compile.py
+++ b/rpython/jit/metainterp/compile.py
@@ -486,17 +486,9 @@
     _counter = 0        # on a GUARD_VALUE, there is one counter per value;
     _counters = None    # they get stored in _counters then.
 
-    # this class also gets the following attributes stored by resume.py code
-
-    # XXX move all of unused stuff to guard_op, now that we can have
-    #     a separate class, so it does not survive that long
-    rd_snapshot = None
-    rd_frame_info_list = None
-    rd_numb = lltype.nullptr(NUMBERING)
-    rd_count = 0
-    rd_consts = None
-    rd_virtuals = None
-    rd_pendingfields = lltype.nullptr(PENDINGFIELDSP.TO)
+    # the following attributes are used by the resume
+    rd_loop = None # keeping the loop alive
+    rd_bytecode_position = -1 # position in the generated bytecode
 
     CNT_BASE_MASK  =  0x0FFFFFFF     # the base counter value
     CNT_BUSY_FLAG  =  0x10000000     # if set, busy tracing from the guard
@@ -628,32 +620,11 @@
                                self, inputargs, new_loop.operations,
                                new_loop.original_jitcell_token)
 
-    def copy_all_attributes_into(self, res):
-        # XXX a bit ugly to have to list them all here
-        res.rd_snapshot = self.rd_snapshot
-        res.rd_frame_info_list = self.rd_frame_info_list
-        res.rd_numb = self.rd_numb
-        res.rd_consts = self.rd_consts
-        res.rd_virtuals = self.rd_virtuals
-        res.rd_pendingfields = self.rd_pendingfields
-        res.rd_count = self.rd_count
-
-    def _clone_if_mutable(self):
-        res = ResumeGuardDescr()
-        self.copy_all_attributes_into(res)
-        return res
-
 class ResumeGuardNotInvalidated(ResumeGuardDescr):
-    def _clone_if_mutable(self):
-        res = ResumeGuardNotInvalidated()
-        self.copy_all_attributes_into(res)
-        return res
+    pass
 
 class ResumeAtPositionDescr(ResumeGuardDescr):
-    def _clone_if_mutable(self):
-        res = ResumeAtPositionDescr()
-        self.copy_all_attributes_into(res)
-        return res
+    pass
 
 class AllVirtuals:
     llopaque = True
@@ -736,12 +707,6 @@
         hidden_all_virtuals = obj.hide(metainterp_sd.cpu)
         metainterp_sd.cpu.set_savedata_ref(deadframe, hidden_all_virtuals)
 
-    def _clone_if_mutable(self):
-        res = ResumeGuardForcedDescr(self.metainterp_sd,
-                                     self.jitdriver_sd)
-        self.copy_all_attributes_into(res)
-        return res
-
 
 class AbstractResumeGuardCounters(object):
     # Completely custom algorithm for now: keep 5 pairs (value, counter),
diff --git a/rpython/jit/metainterp/optimizeopt/optimizer.py b/rpython/jit/metainterp/optimizeopt/optimizer.py
--- a/rpython/jit/metainterp/optimizeopt/optimizer.py
+++ b/rpython/jit/metainterp/optimizeopt/optimizer.py
@@ -546,14 +546,11 @@
         self.metainterp_sd.profiler.count(jitprof.Counters.OPT_OPS)
         if op.is_guard():
             self.metainterp_sd.profiler.count(jitprof.Counters.OPT_GUARDS)
-            pendingfields = self.pendingfields
             self.pendingfields = None
             if self.replaces_guard and op in self.replaces_guard:
                 self.replace_op(self.replaces_guard[op], op)
                 del self.replaces_guard[op]
                 return
-            else:
-                op = self.store_final_boxes_in_guard(op, pendingfields)
         elif op.can_raise():
             self.exception_might_have_happened = True
         if op.result:
diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -53,9 +53,6 @@
         self.copy_constants(self.registers_r, jitcode.constants_r, ConstPtr)
         self.copy_constants(self.registers_f, jitcode.constants_f, ConstFloat)
         self._result_argcode = 'v'
-        # for resume.py operation
-        self.parent_resumedata_snapshot = None
-        self.parent_resumedata_frame_info_list = None
         # counter for unrolling inlined loops
         self.unroll_iterations = 1
 
@@ -1047,7 +1044,7 @@
             saved_pc = self.pc
             self.pc = orgpc
             resumedescr = compile.ResumeAtPositionDescr()
-            self.metainterp.capture_resumedata(resumedescr, orgpc)
+            #self.metainterp.capture_resumedata(resumedescr, orgpc)
 
             self.metainterp.reached_loop_header(greenboxes, redboxes, resumedescr)
             self.pc = saved_pc
@@ -1791,7 +1788,7 @@
             resumedescr = compile.ResumeGuardDescr()
         guard_op = self.history.record(opnum, moreargs, None,
                                              descr=resumedescr)
-        self.capture_resumedata(resumedescr, resumepc)
+        #self.capture_resumedata(resumedescr, resumepc)
         self.staticdata.profiler.count_ops(opnum, Counters.GUARDS)
         # count
         self.attach_debug_info(guard_op)
diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py
--- a/rpython/jit/metainterp/resoperation.py
+++ b/rpython/jit/metainterp/resoperation.py
@@ -472,6 +472,9 @@
     'ENTER_FRAME/1d',
     'LEAVE_FRAME/0',
     'RESUME_PUT/3',
+    'BACKEND_PUT/3',
+    # same as resume_put, but the first arg is backend-dependent,
+    # instead of a box
     '_RESUME_LAST',
     '_NOSIDEEFFECT_LAST', # ----- end of no_side_effect operations -----
 


More information about the pypy-commit mailing list