[pypy-commit] pypy share-resume-info-frontend: start fighting with sharing guards on the frontend, give up for now
fijal
noreply at buildbot.pypy.org
Sat Oct 3 14:55:31 CEST 2015
Author: fijal
Branch: share-resume-info-frontend
Changeset: r79951:8f127bb6d398
Date: 2015-10-03 14:55 +0200
http://bitbucket.org/pypy/pypy/changeset/8f127bb6d398/
Log: start fighting with sharing guards on the frontend, give up for now
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
@@ -615,10 +615,13 @@
def __init__(self):
self.inputargs = None
self.operations = []
+ self.last_guard_valid = False
@specialize.argtype(3)
def record(self, opnum, argboxes, value, descr=None):
op = ResOperation(opnum, argboxes, descr)
+ if op.can_invalidate_guard_operation():
+ self.last_guard_valid = False
if value is None:
assert op.type == 'v'
elif isinstance(value, bool):
diff --git a/rpython/jit/metainterp/optimizeopt/optimizer.py b/rpython/jit/metainterp/optimizeopt/optimizer.py
--- a/rpython/jit/metainterp/optimizeopt/optimizer.py
+++ b/rpython/jit/metainterp/optimizeopt/optimizer.py
@@ -581,8 +581,7 @@
op = self.emit_guard_operation(op, pendingfields)
elif op.can_raise():
self.exception_might_have_happened = True
- if ((op.has_no_side_effect() or op.is_guard() or op.is_jit_debug() or
- op.is_ovf()) and not self.is_call_pure_pure_canraise(op)):
+ if not op.can_invalidate_guard_operation():
pass
else:
self._last_guard_op = None
@@ -649,14 +648,6 @@
def getlastop(self):
return self._really_emitted_operation
- def is_call_pure_pure_canraise(self, op):
- if not op.is_call_pure():
- return False
- effectinfo = op.getdescr().get_extra_info()
- if effectinfo.check_can_raise(ignore_memoryerror=True):
- return True
- return False
-
def replace_guard_op(self, old_op_pos, new_op):
old_op = self._newoperations[old_op_pos]
assert old_op.is_guard()
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
@@ -2046,7 +2046,9 @@
else:
guard_op = self.history.record(opnum, moreargs, None)
assert isinstance(guard_op, GuardResOp)
- self.capture_resumedata(guard_op, resumepc)
+ if not self.history.last_guard_valid:
+ self.capture_resumedata(guard_op, resumepc)
+ self.history.last_guard_valid = True
self.staticdata.profiler.count_ops(opnum, Counters.GUARDS)
# count
self.attach_debug_info(guard_op)
diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py
--- a/rpython/jit/metainterp/resoperation.py
+++ b/rpython/jit/metainterp/resoperation.py
@@ -322,6 +322,21 @@
def forget_value(self):
pass
+ def can_invalidate_guard_operation(self):
+ if ((self.has_no_side_effect() or self.is_guard() or self.is_jit_debug() or
+ self.is_ovf()) and not self.is_call_pure_pure_canraise()):
+ return False
+ return True
+
+ def is_call_pure_pure_canraise(self):
+ if not self.is_call_pure():
+ return False
+ effectinfo = self.getdescr().get_extra_info()
+ if effectinfo.check_can_raise(ignore_memoryerror=True):
+ return True
+ return False
+
+
# ===================
# Top of the hierachy
More information about the pypy-commit
mailing list