[pypy-commit] pypy jit-leaner-frontend: do a hack in history to record the operations *earlier* than we have inputargs
fijal
pypy.commits at gmail.com
Wed Mar 9 07:13:33 EST 2016
Author: fijal
Branch: jit-leaner-frontend
Changeset: r82903:bd97c8e4e94b
Date: 2016-03-09 14:12 +0200
http://bitbucket.org/pypy/pypy/changeset/bd97c8e4e94b/
Log: do a hack in history to record the operations *earlier* than we have
inputargs
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
@@ -642,17 +642,26 @@
class History(object):
ends_with_jump = False
+ trace = None
def __init__(self):
self.descr_cache = {}
self.descrs = {}
self.consts = []
+ self._cache = []
def set_inputargs(self, inpargs):
from rpython.jit.metainterp.opencoder import Trace
self.trace = Trace(inpargs)
self.inputargs = inpargs
+ if self._cache:
+ # hack to record the ops *after* we know our inputargs
+ for op in self._cache:
+ newop = self.trace.record_op(op.getopnum(), op.getarglist(),
+ op.getdescr())
+ op.position = newop.position
+ self._cache = None
def length(self):
return self.trace._count
@@ -668,7 +677,11 @@
@specialize.argtype(3)
def record(self, opnum, argboxes, value, descr=None):
- op = self.trace.record_op(opnum, argboxes, descr)
+ if self.trace is None:
+ op = ResOperation(opnum, argboxes, -1, descr)
+ self._cache.append(op)
+ else:
+ op = self.trace.record_op(opnum, argboxes, descr)
if value is None:
assert op.type == 'v'
elif isinstance(value, bool):
diff --git a/rpython/jit/metainterp/opencoder.py b/rpython/jit/metainterp/opencoder.py
--- a/rpython/jit/metainterp/opencoder.py
+++ b/rpython/jit/metainterp/opencoder.py
@@ -63,7 +63,7 @@
if force_inputargs is not None:
self.inputargs = [rop.inputarg_from_tp(arg.type) for
arg in force_inputargs]
- self._inputargs = [None] * len(force_inputargs)
+ self._inputargs = [None] * len(trace.inputargs)
for i, arg in enumerate(force_inputargs):
if arg.position >= 0:
self._cache[arg.position] = self.inputargs[i]
diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py b/rpython/jit/metainterp/optimizeopt/unroll.py
--- a/rpython/jit/metainterp/optimizeopt/unroll.py
+++ b/rpython/jit/metainterp/optimizeopt/unroll.py
@@ -303,8 +303,7 @@
patchguardop = self.optimizer.patchguardop
for guard in extra_guards.extra_guards:
if isinstance(guard, GuardResOp):
- guard.rd_snapshot = patchguardop.rd_snapshot
- guard.rd_frame_info_list = patchguardop.rd_frame_info_list
+ guard.rd_resume_position = patchguardop.rd_resume_position
guard.setdescr(compile.ResumeAtPositionDescr())
self.send_extra_operation(guard)
except VirtualStatesCantMatch:
diff --git a/rpython/jit/metainterp/optimizeopt/virtualstate.py b/rpython/jit/metainterp/optimizeopt/virtualstate.py
--- a/rpython/jit/metainterp/optimizeopt/virtualstate.py
+++ b/rpython/jit/metainterp/optimizeopt/virtualstate.py
@@ -444,7 +444,7 @@
if other.level == LEVEL_UNKNOWN:
if (runtime_box and runtime_box.nonnull() and
self.known_class.same_constant(cpu.ts.cls_of_box(runtime_box))):
- op = ResOperation(rop.GUARD_NONNULL_CLASS, [box, self.known_class], None)
+ op = ResOperation(rop.GUARD_NONNULL_CLASS, [box, self.known_class])
extra_guards.append(op)
return
else:
@@ -452,7 +452,7 @@
elif other.level == LEVEL_NONNULL:
if (runtime_box and self.known_class.same_constant(
cpu.ts.cls_of_box(runtime_box))):
- op = ResOperation(rop.GUARD_CLASS, [box, self.known_class], None)
+ op = ResOperation(rop.GUARD_CLASS, [box, self.known_class])
extra_guards.append(op)
return
else:
@@ -476,7 +476,7 @@
return
raise VirtualStatesCantMatch("different constants")
if runtime_box is not None and self.constbox.same_constant(runtime_box.constbox()):
- op = ResOperation(rop.GUARD_VALUE, [box, self.constbox], None)
+ op = ResOperation(rop.GUARD_VALUE, [box, self.constbox])
extra_guards.append(op)
return
else:
More information about the pypy-commit
mailing list