[pypy-commit] pypy optresult: (fijal, arigo) push stuff
arigo
noreply at buildbot.pypy.org
Tue Feb 24 16:43:54 CET 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: optresult
Changeset: r76105:5240488a3374
Date: 2015-02-24 16:42 +0100
http://bitbucket.org/pypy/pypy/changeset/5240488a3374/
Log: (fijal, arigo) push stuff
diff --git a/rpython/jit/metainterp/optimizeopt/earlyforce.py b/rpython/jit/metainterp/optimizeopt/earlyforce.py
--- a/rpython/jit/metainterp/optimizeopt/earlyforce.py
+++ b/rpython/jit/metainterp/optimizeopt/earlyforce.py
@@ -14,7 +14,8 @@
def propagate_forward(self, op):
opnum = op.getopnum()
- if (opnum != rop.SETFIELD_GC and
+ if 0: # XXX
+ if (opnum != rop.SETFIELD_GC and
opnum != rop.SETARRAYITEM_GC and
opnum != rop.SETARRAYITEM_RAW and
opnum != rop.QUASIIMMUT_FIELD and
diff --git a/rpython/jit/metainterp/optimizeopt/intbounds.py b/rpython/jit/metainterp/optimizeopt/intbounds.py
--- a/rpython/jit/metainterp/optimizeopt/intbounds.py
+++ b/rpython/jit/metainterp/optimizeopt/intbounds.py
@@ -63,9 +63,9 @@
dispatch_bounds_ops(self, box)
def optimize_GUARD_TRUE(self, op):
- v = self.getvalue(op.getarg(0))
self.emit_operation(op)
- self.propagate_bounds_backward(op.getarg(0), v)
+ #v = self.getintbound(op.getarg(0))
+ #self.propagate_bounds_backward(op.getarg(0), v) XXX
optimize_GUARD_FALSE = optimize_GUARD_TRUE
optimize_GUARD_VALUE = optimize_GUARD_TRUE
diff --git a/rpython/jit/metainterp/optimizeopt/intutils.py b/rpython/jit/metainterp/optimizeopt/intutils.py
--- a/rpython/jit/metainterp/optimizeopt/intutils.py
+++ b/rpython/jit/metainterp/optimizeopt/intutils.py
@@ -45,12 +45,14 @@
return self.make_ge(other.add(1))
def make_constant(self, value):
+ XXXX # don't call me
self.has_lower = True
self.has_upper = True
self.lower = value
self.upper = value
def make_unbounded(self):
+ XXX # hum
self.has_lower = False
self.has_upper = False
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
@@ -10,7 +10,7 @@
from rpython.jit.metainterp.typesystem import llhelper
from rpython.tool.pairtype import extendabletype
from rpython.rlib.debug import debug_print
-from rpython.rlib.objectmodel import specialize
+from rpython.rlib.objectmodel import specialize, we_are_translated
""" The tag field on OptValue has a following meaning:
@@ -509,7 +509,6 @@
self.cpu = metainterp_sd.cpu
self.loop = loop
self.logops = LogOperations(metainterp_sd, False)
- self.values = {}
self.interned_refs = self.cpu.ts.new_ref_dict()
self.interned_ints = {}
self.resumedata_memo = resume.ResumeDataLoopMemo(metainterp_sd)
@@ -659,7 +658,12 @@
return newop
def make_constant(self, box, constbox):
- self.getvalue(box).make_constant(constbox)
+ assert isinstance(constbox, ConstInt)
+ box = self.get_box_replacement(box)
+ if not we_are_translated(): # safety-check
+ if box.get_forwarded() is not None:
+ assert box.get_forwarded().contains(constbox.getint())
+ box.set_forwarded(constbox)
def make_constant_int(self, box, intvalue):
self.make_constant(box, ConstInt(intvalue))
@@ -804,7 +808,7 @@
raise compile.giveup()
descr.store_final_boxes(op, newboxes, self.metainterp_sd)
#
- if op.getopnum() == rop.GUARD_VALUE:
+ if op.getopnum() == rop.GUARD_VALUE and 0: # XXX
val = self.getvalue(op.getarg(0))
if val in self.bool_boxes:
# Hack: turn guard_value(bool) into guard_true/guard_false.
diff --git a/rpython/jit/metainterp/optimizeopt/rewrite.py b/rpython/jit/metainterp/optimizeopt/rewrite.py
--- a/rpython/jit/metainterp/optimizeopt/rewrite.py
+++ b/rpython/jit/metainterp/optimizeopt/rewrite.py
@@ -248,9 +248,8 @@
self.optimizer.pure_reverse(op)
def optimize_guard(self, op, constbox, emit_operation=True):
- value = self.getvalue(op.getarg(0))
- if value.is_constant():
- box = value.box
+ box = self.get_box_replacement(op.getarg(0))
+ if box.is_constant():
assert isinstance(box, Const)
if not box.same_constant(constbox):
r = self.optimizer.metainterp_sd.logger_ops.repr_of_resop(op)
@@ -259,9 +258,9 @@
return
if emit_operation:
self.emit_operation(op)
- value.make_constant(constbox)
- if self.optimizer.optheap:
- self.optimizer.optheap.value_updated(value, self.getvalue(constbox))
+ self.make_constant(box, constbox)
+ #if self.optimizer.optheap: XXX
+ # self.optimizer.optheap.value_updated(value, self.getvalue(constbox))
def optimize_GUARD_ISNULL(self, op):
value = self.getvalue(op.getarg(0))
@@ -286,46 +285,46 @@
value.make_nonnull(self.optimizer)
def optimize_GUARD_VALUE(self, op):
- value = self.getvalue(op.getarg(0))
- if value.is_virtual():
- arg = value.get_constant_class(self.optimizer.cpu)
- if arg:
- addr = arg.getaddr()
- name = self.optimizer.metainterp_sd.get_name_from_address(addr)
- else:
- name = "<unknown>"
- raise InvalidLoop('A promote of a virtual %s (a recently allocated object) never makes sense!' % name)
- old_guard_op = value.get_last_guard(self.optimizer)
- if old_guard_op and not isinstance(old_guard_op.getdescr(),
- compile.ResumeAtPositionDescr):
- # there already has been a guard_nonnull or guard_class or
- # guard_nonnull_class on this value, which is rather silly.
- # replace the original guard with a guard_value
- if old_guard_op.getopnum() != rop.GUARD_NONNULL:
- # This is only safe if the class of the guard_value matches the
- # class of the guard_*_class, otherwise the intermediate ops might
- # be executed with wrong classes.
- previous_classbox = value.get_constant_class(self.optimizer.cpu)
- expected_classbox = self.optimizer.cpu.ts.cls_of_box(op.getarg(1))
- assert previous_classbox is not None
- assert expected_classbox is not None
- if not previous_classbox.same_constant(expected_classbox):
- r = self.optimizer.metainterp_sd.logger_ops.repr_of_resop(op)
- raise InvalidLoop('A GUARD_VALUE (%s) was proven to always fail' % r)
- descr = compile.ResumeGuardValueDescr()
- op = old_guard_op.copy_and_change(rop.GUARD_VALUE,
- args = [old_guard_op.getarg(0), op.getarg(1)],
- descr = descr)
- # Note: we give explicitly a new descr for 'op'; this is why the
- # old descr must not be ResumeAtPositionDescr (checked above).
- # Better-safe-than-sorry but it should never occur: we should
- # not put in short preambles guard_xxx and guard_value
- # on the same box.
- self.optimizer.replace_guard(op, value)
- descr.make_a_counter_per_value(op)
- # to be safe
- if isinstance(value, PtrOptValue):
- value.last_guard_pos = -1
+ ## value = self.getvalue(op.getarg(0))
+ ## if value.is_virtual():
+ ## arg = value.get_constant_class(self.optimizer.cpu)
+ ## if arg:
+ ## addr = arg.getaddr()
+ ## name = self.optimizer.metainterp_sd.get_name_from_address(addr)
+ ## else:
+ ## name = "<unknown>"
+ ## raise InvalidLoop('A promote of a virtual %s (a recently allocated object) never makes sense!' % name)
+ ## old_guard_op = value.get_last_guard(self.optimizer)
+ ## if old_guard_op and not isinstance(old_guard_op.getdescr(),
+ ## compile.ResumeAtPositionDescr):
+ ## # there already has been a guard_nonnull or guard_class or
+ ## # guard_nonnull_class on this value, which is rather silly.
+ ## # replace the original guard with a guard_value
+ ## if old_guard_op.getopnum() != rop.GUARD_NONNULL:
+ ## # This is only safe if the class of the guard_value matches the
+ ## # class of the guard_*_class, otherwise the intermediate ops might
+ ## # be executed with wrong classes.
+ ## previous_classbox = value.get_constant_class(self.optimizer.cpu)
+ ## expected_classbox = self.optimizer.cpu.ts.cls_of_box(op.getarg(1))
+ ## assert previous_classbox is not None
+ ## assert expected_classbox is not None
+ ## if not previous_classbox.same_constant(expected_classbox):
+ ## r = self.optimizer.metainterp_sd.logger_ops.repr_of_resop(op)
+ ## raise InvalidLoop('A GUARD_VALUE (%s) was proven to always fail' % r)
+ ## descr = compile.ResumeGuardValueDescr()
+ ## op = old_guard_op.copy_and_change(rop.GUARD_VALUE,
+ ## args = [old_guard_op.getarg(0), op.getarg(1)],
+ ## descr = descr)
+ ## # Note: we give explicitly a new descr for 'op'; this is why the
+ ## # old descr must not be ResumeAtPositionDescr (checked above).
+ ## # Better-safe-than-sorry but it should never occur: we should
+ ## # not put in short preambles guard_xxx and guard_value
+ ## # on the same box.
+ ## self.optimizer.replace_guard(op, value)
+ ## descr.make_a_counter_per_value(op)
+ ## # to be safe
+ ## if isinstance(value, PtrOptValue):
+ ## value.last_guard_pos = -1
constbox = op.getarg(1)
assert isinstance(constbox, Const)
self.optimize_guard(op, constbox)
diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py
--- a/rpython/jit/metainterp/resume.py
+++ b/rpython/jit/metainterp/resume.py
@@ -214,14 +214,19 @@
for i in range(length):
box = boxes[i]
box = optimizer.get_box_replacement(box)
- info = optimizer.getinfo(box, create=False)
if isinstance(box, Const):
tagged = self.getconst(box)
elif box in liveboxes:
tagged = liveboxes[box]
else:
- if info is not None and info.is_virtual():
+ if box.type == 'r':
+ xxx
+ info = optimizer.getinfo(box, create=False)
+ is_virtual = (info is not None and info.is_virtual())
+ else:
+ is_virtual = False
+ if is_virtual:
tagged = tag(v, TAGVIRTUAL)
v += 1
else:
More information about the pypy-commit
mailing list