[pypy-commit] pypy default: move the check whether something is an ovf operation from
cfbolz
noreply at buildbot.pypy.org
Thu Jun 18 10:56:47 CEST 2015
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch:
Changeset: r78167:7b929b68078d
Date: 2015-06-18 10:46 +0200
http://bitbucket.org/pypy/pypy/changeset/7b929b68078d/
Log: move the check whether something is an ovf operation from
_record_helper_nonpure_varargs (where it was run for every single
operation emitted) to execute_and_record (where it is constant-
folded because that is specialized to the opnum). This also means we
don't create the list of argboxes in the case where the ovf
operation is folded away.
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
@@ -1922,9 +1922,10 @@
resbox = executor.execute(self.cpu, self, opnum, descr, *argboxes)
if rop._ALWAYS_PURE_FIRST <= opnum <= rop._ALWAYS_PURE_LAST:
return self._record_helper_pure(opnum, resbox, descr, *argboxes)
- else:
- return self._record_helper_nonpure_varargs(opnum, resbox, descr,
- list(argboxes))
+ if rop._OVF_FIRST <= opnum <= rop._OVF_LAST:
+ return self._record_helper_ovf(opnum, resbox, descr, *argboxes)
+ return self._record_helper_nonpure_varargs(opnum, resbox, descr,
+ list(argboxes))
@specialize.arg(1)
def execute_and_record_varargs(self, opnum, argboxes, descr=None):
@@ -1951,6 +1952,12 @@
resbox = resbox.nonconstbox() # ensure it is a Box
return self._record_helper_nonpure_varargs(opnum, resbox, descr, list(argboxes))
+ def _record_helper_ovf(self, opnum, resbox, descr, *argboxes):
+ if (self.last_exc_value_box is None and
+ self._all_constants(*argboxes)):
+ return resbox.constbox()
+ return self._record_helper_nonpure_varargs(opnum, resbox, descr, list(argboxes))
+
def _record_helper_pure_varargs(self, opnum, resbox, descr, argboxes):
canfold = self._all_constants_varargs(argboxes)
if canfold:
@@ -1962,10 +1969,6 @@
def _record_helper_nonpure_varargs(self, opnum, resbox, descr, argboxes):
assert resbox is None or isinstance(resbox, Box)
- if (rop._OVF_FIRST <= opnum <= rop._OVF_LAST and
- self.last_exc_value_box is None and
- self._all_constants_varargs(argboxes)):
- return resbox.constbox()
# record the operation
profiler = self.staticdata.profiler
profiler.count_ops(opnum, Counters.RECORDED_OPS)
More information about the pypy-commit
mailing list