Author: Richard Plangger <r...@pasra.at>
Branch: vecopt
Changeset: r78695:fce17b8ec26a
Date: 2015-07-28 17:02 +0200
http://bitbucket.org/pypy/pypy/changeset/fce17b8ec26a/

Log:    restricted the test environment, loop versioning only works
        resumedescr (not basicfaildescr) rawstart is now saved to the loop
        token to be more easily reconstructed when mc and datablockwrappers
        are removed from the assembler

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
@@ -258,6 +258,9 @@
         self.stats = stats or MiniStats()
         self.vinfo_for_tests = kwds.get('vinfo_for_tests', None)
 
+    def stitch_bridge(self, faildescr, jitcell_token):
+        pass
+
     def compile_loop(self, inputargs, operations, looptoken, jd_id=0,
                      unique_id=0, log=True, name='', logger=None):
         clt = model.CompiledLoopToken(self, looptoken.number)
@@ -868,17 +871,23 @@
 
     def fail_guard(self, descr, saved_data=None):
         values = []
-        for box in self.current_op.getfailargs():
+        for i,box in enumerate(self.current_op.getfailargs()):
             if box is not None:
                 value = self.env[box]
             else:
                 value = None
-            if box and box.getaccum():
-                if box.getaccum().operator == '+':
+            accum = descr.rd_accum_list
+            while accum != None:
+                if accum.position != i:
+                    accum = accum.prev
+                    continue
+                if accum.operation == '+':
                     value = sum(value)
-                elif box.getaccum().operator == '*':
+                    break
+                elif accum.operation == '*':
                     def prod(acc, x): return acc * x
                     value = reduce(prod, value, 1)
+                    break
                 else:
                     raise NotImplementedError("accum operator in fail guard")
             values.append(value)
diff --git a/rpython/jit/backend/llsupport/assembler.py 
b/rpython/jit/backend/llsupport/assembler.py
--- a/rpython/jit/backend/llsupport/assembler.py
+++ b/rpython/jit/backend/llsupport/assembler.py
@@ -35,6 +35,7 @@
         self.exc = exc
         self.is_guard_not_invalidated = is_guard_not_invalidated
         self.is_guard_not_forced = is_guard_not_forced
+        self.rawstart = 0
 
     def compute_gcmap(self, gcmap, failargs, fail_locs, frame_depth):
         # note that regalloc has a very similar compute, but
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
@@ -503,6 +503,7 @@
         full_size = self.mc.get_relative_pos()
         #
         rawstart = self.materialize_loop(looptoken)
+        looptoken.rawstart = rawstart
         self.patch_stack_checks(frame_depth_no_fixed_size + 
JITFRAME_FIXED_SIZE,
                                 rawstart)
         looptoken._ll_loop_code = looppos + rawstart
@@ -590,8 +591,8 @@
         return AsmInfo(ops_offset, startpos + rawstart, codeendpos - startpos)
 
     def stitch_bridge(self, faildescr, token):
-        rawstart = self.materialize_loop(token)
-        self.patch_jump_for_descr(faildescr, rawstart)
+        assert token.rawstart != 0
+        self.patch_jump_for_descr(faildescr, token.rawstart)
 
     def write_pending_failure_recoveries(self, regalloc):
         # for each pending guard, generate the code of the recovery stub
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
@@ -1,4 +1,5 @@
 import py
+from rpython.jit.metainterp.compile import ResumeGuardDescr
 from rpython.jit.metainterp.history import (Box, Const, ConstInt, ConstPtr,
     ConstFloat, BoxInt, BoxFloat, BoxVector, INT, REF,
     FLOAT, VECTOR, TargetToken)
@@ -65,6 +66,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"""
+        if not isinstance(faildescr, ResumeGuardDescr):
+            return
         assert regalloc is not None
         accum_info = faildescr.rd_accum_list
         while accum_info:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to