Author: Richard Plangger <[email protected]>
Branch: vecopt-merge
Changeset: r79165:c38afa242006
Date: 2015-08-23 19:40 +0200
http://bitbucket.org/pypy/pypy/changeset/c38afa242006/
Log: extended the llgraph to handle the stitching correctly (not yet
fully finished) translation issue
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
@@ -2,8 +2,8 @@
from rpython.jit.backend import model
from rpython.jit.backend.llgraph import support
from rpython.jit.backend.llsupport import symbolic
-from rpython.jit.metainterp.history import AbstractDescr
-from rpython.jit.metainterp.history import Const, getkind
+from rpython.jit.metainterp.history import AbstractDescr, BoxVector
+from rpython.jit.metainterp.history import Const, getkind, Box
from rpython.jit.metainterp.history import INT, REF, FLOAT, VOID, VECTOR
from rpython.jit.metainterp.resoperation import rop
from rpython.jit.metainterp.optimizeopt import intbounds
@@ -271,6 +271,7 @@
self.vinfo_for_tests = kwds.get('vinfo_for_tests', None)
def stitch_bridge(self, faildescr, target):
+ import pdb; pdb.set_trace()
faildescr._llgraph_bridge = target.lltrace
def compile_loop(self, inputargs, operations, looptoken, jd_id=0,
@@ -902,29 +903,36 @@
# -----------------------------------------------------
+ def _accumulate(self, descr, failargs, value):
+ if not hasattr(descr, 'rd_accum_list'):
+ return
+ accum = descr.rd_accum_list
+ while accum is not None:
+ value = values[accum.scalar_position]
+ assert isinstance(value, list)
+ if accum.operation == '+':
+ value = sum(value)
+ 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[accum.scalar_position] = value
+ accum = accum.prev
+
def fail_guard(self, descr, saved_data=None):
values = []
for i,box in enumerate(self.current_op.getfailargs()):
+ if box.getaccum() or isinstance(box, BoxVector):
+ import pdb; pdb.set_trace();
if box is not None:
value = self.env[box]
else:
value = None
- if hasattr(descr, 'rd_accum_list'):
- accum = descr.rd_accum_list
- while accum != None:
- if accum.position != i:
- accum = accum.prev
- continue
- if accum.operation == '+':
- value = sum(value)
- 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)
+ self._accumulate(descr, self.current_op.getfailargs(), values)
if hasattr(descr, '_llgraph_bridge'):
target = (descr._llgraph_bridge, -1)
values = [value for value in values if value is not None]
diff --git a/rpython/jit/backend/x86/regalloc.py
b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -326,6 +326,7 @@
# on the descriptor
loc = self.loc(accum.getoriginalbox())
faillocs.append(loc)
+ assert isinstance(descr, ResumeGuardDescr)
descr.rd_accum_list = AccumInfo(descr.rd_accum_list,
i, accum.operator,
accum.getoriginalbox(),
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit