[pypy-svn] r64046 - pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp

fijal at codespeak.net fijal at codespeak.net
Tue Apr 14 02:46:40 CEST 2009


Author: fijal
Date: Tue Apr 14 02:46:38 2009
New Revision: 64046

Modified:
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/compile.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py
Log:
actually don't adjust numbers. just slice it only when copying from history to loop


Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/compile.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/compile.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/compile.py	Tue Apr 14 02:46:38 2009
@@ -10,14 +10,14 @@
 from pypy.jit.metainterp.specnode import NotSpecNode
 from pypy.rlib.debug import debug_print
 
-def compile_new_loop(metainterp, old_loops, greenkey):
+def compile_new_loop(metainterp, old_loops, greenkey, start=0):
     """Try to compile a new loop by closing the current history back
     to the first operation.
     """
     if we_are_translated():
-        return compile_fresh_loop(metainterp, old_loops, greenkey)
+        return compile_fresh_loop(metainterp, old_loops, greenkey, start)
     else:
-        return _compile_new_loop_1(metainterp, old_loops, greenkey)
+        return _compile_new_loop_1(metainterp, old_loops, greenkey, start)
 
 def compile_new_bridge(metainterp, old_loops, resumekey):
     """Try to compile a new bridge leading from the beginning of the history
@@ -33,10 +33,10 @@
 
 
 # the following is not translatable
-def _compile_new_loop_1(metainterp, old_loops, greenkey):
+def _compile_new_loop_1(metainterp, old_loops, greenkey, start):
     old_loops_1 = old_loops[:]
     try:
-        loop = compile_fresh_loop(metainterp, old_loops, greenkey)
+        loop = compile_fresh_loop(metainterp, old_loops, greenkey, start)
     except Exception, exc:
         show_loop(metainterp, error=exc)
         raise
@@ -86,12 +86,15 @@
 
 # ____________________________________________________________
 
-def compile_fresh_loop(metainterp, old_loops, greenkey):
+def compile_fresh_loop(metainterp, old_loops, greenkey, start):
     history = metainterp.history
     loop = create_empty_loop(metainterp)
     loop.greenkey = greenkey
     loop.inputargs = history.inputargs
-    loop.operations = history.operations
+    if start != 0:
+        loop.operations = history.operations[start:]
+    else:
+        loop.operations = history.operations
     loop.operations[-1].jump_target = loop
     metainterp_sd = metainterp.staticdata
     old_loop = metainterp_sd.optimize_loop(metainterp_sd.options, old_loops,

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py	Tue Apr 14 02:46:38 2009
@@ -1021,15 +1021,6 @@
         except GenerateMergePoint, gmp:
             return self.designate_target_loop(gmp)
 
-    def adjust_guard_indexes(self, operations, offset):
-        for op in operations:
-            if op.is_guard():
-                fail = op.suboperations[-1]
-                if fail.opnum == rop.FAIL:
-                    resumekey = fail.descr
-                    assert isinstance(resumekey, compile.ResumeGuardDescr)
-                    resumekey.history_guard_index -= offset
-
     def reached_can_enter_jit(self, live_arg_boxes):
         # Called whenever we reach the 'can_enter_jit' hint.
         # First, attempt to make a bridge:
@@ -1056,9 +1047,9 @@
             else:
                 # Found!  Compile it as a loop.
                 if j > 0:
-                    assert start >= 0
-                    del self.history.operations[:start]
-                    self.adjust_guard_indexes(self.history.operations, start)
+                    pass
+                    #assert start >= 0
+                    #del self.history.operations[:start]
                 elif self.extra_rebuild_operations >= 0:
                     # The history only starts at a bridge, not at the
                     # full loop header.  Complete it as a full loop by
@@ -1068,7 +1059,7 @@
                     assert lgt >= 0
                     del self.history.operations[:lgt]
                     compile.prepare_loop_from_bridge(self, self.resumekey)
-                loop = self.compile(original_boxes, live_arg_boxes)
+                loop = self.compile(original_boxes, live_arg_boxes, start)
                 raise GenerateMergePoint(live_arg_boxes, loop)
 
         # Otherwise, no loop found so far, so continue tracing.
@@ -1098,14 +1089,14 @@
         elif opnum == rop.GUARD_NO_EXCEPTION or opnum == rop.GUARD_EXCEPTION:
             self.handle_exception()
 
-    def compile(self, original_boxes, live_arg_boxes):
+    def compile(self, original_boxes, live_arg_boxes, start):
         num_green_args = self.staticdata.num_green_args
         self.history.inputargs = original_boxes[num_green_args:]
         greenkey = original_boxes[:num_green_args]
         glob = self.staticdata.globaldata
         old_loops = glob.compiled_merge_points.setdefault(greenkey, [])
         self.history.record(rop.JUMP, live_arg_boxes[num_green_args:], None)
-        loop = compile.compile_new_loop(self, old_loops, greenkey)
+        loop = compile.compile_new_loop(self, old_loops, greenkey, start)
         assert loop is not None
         if not we_are_translated():
             loop._call_history = self._debug_history



More information about the Pypy-commit mailing list