[pypy-commit] pypy vecopt-merge: added docu to LoopVersion, translation issue with tuple/None unification

plan_rich noreply at buildbot.pypy.org
Sun Aug 23 20:51:08 CEST 2015


Author: Richard Plangger <rich at pasra.at>
Branch: vecopt-merge
Changeset: r79170:70512ea6c862
Date: 2015-08-23 20:50 +0200
http://bitbucket.org/pypy/pypy/changeset/70512ea6c862/

Log:	added docu to LoopVersion, translation issue with tuple/None
	unification

diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -596,9 +596,10 @@
             allocation. This needs remapping which is done here for both normal registers
             and accumulation registers.
             Why? Because this only generates a very small junk of memory, instead of
-            duplicating the loop assembler!
+            duplicating the loop assembler for each faildescr!
         """
-        asminfo, bridge_faildescr, compiled_version, looptoken = version._compiled
+        asminfo, bridge_faildescr, looptoken = version._compiled
+        compiled_version = bridge_faildescr.version
         assert isinstance(bridge_faildescr, ResumeGuardDescr)
         assert isinstance(faildescr, ResumeGuardDescr)
         assert asminfo.rawstart != 0
@@ -640,7 +641,7 @@
         self.mc.force_frame_size(DEFAULT_FRAME_BYTES)
         offset = self.mc.get_relative_pos() - 4
         rawstart = self.materialize_loop(looptoken)
-        # update the exit target
+        # update the jump to the real trace
         self._patch_jump_for_descr(rawstart + offset, asminfo.rawstart)
         # update the guard to jump right to this custom piece of assembler
         self.patch_jump_for_descr(faildescr, rawstart)
diff --git a/rpython/jit/backend/x86/vector_ext.py b/rpython/jit/backend/x86/vector_ext.py
--- a/rpython/jit/backend/x86/vector_ext.py
+++ b/rpython/jit/backend/x86/vector_ext.py
@@ -78,7 +78,8 @@
 
     def _accum_update_at_exit(self, fail_locs, fail_args, faildescr, regalloc):
         """ If accumulation is done in this loop, at the guard exit
-        some vector registers must be adjusted to yield the correct value"""
+            some vector registers must be adjusted to yield the correct value
+        """
         if not isinstance(faildescr, ResumeGuardDescr):
             return
         assert regalloc is not None
@@ -99,7 +100,7 @@
                 self._accum_reduce_mul(scalar_arg, vector_loc, scalar_loc)
             else:
                 not_implemented("accum operator %s not implemented" %
-                                            (accum_info.operation)) 
+                                            (accum_info.accum_operation)) 
             accum_info = accum_info.prev
 
     def _accum_reduce_mul(self, arg, accumloc, targetloc):
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
@@ -209,8 +209,9 @@
                                    version.operations, jitcell_token)
             record_loop_or_bridge(metainterp_sd, vl)
             assert asminfo is not None
-            version._compiled = (asminfo, faildescr, faildescr.version, jitcell_token)
+            version._compiled = (asminfo, faildescr, jitcell_token)
             faildescr.version = None
+        # stitch to the trace loop
         for lv in loop.versions:
             if not lv.compiled():
                 # the version was never compiled, do not bother
diff --git a/rpython/jit/metainterp/history.py b/rpython/jit/metainterp/history.py
--- a/rpython/jit/metainterp/history.py
+++ b/rpython/jit/metainterp/history.py
@@ -740,10 +740,13 @@
     return -1
 
 class LoopVersion(object):
-
+    """ A special version of a trace loop. Use loop.snaphost() to
+        create one instance and attach it to a guard descr.
+        If not attached to a descriptor, it will not be compiled.
+    """
     def __init__(self, loop):
         self.faildescrs = []
-        self._compiled = None
+        self._compiled = (None,None,None)
         if loop:
             self.operations = self.copy_operations(loop.operations) 
             idx = index_of_first(rop.LABEL, self.operations)
@@ -761,7 +764,7 @@
             # root version must always be compiled
             return True
 
-        return self._compiled is not None
+        return self._compiled[0] is not None
 
     def copy_operations(self, operations):
         from rpython.jit.metainterp.compile import (ResumeGuardDescr,


More information about the pypy-commit mailing list