[pypy-commit] pypy optresult: write a very simple test and fix it until it passes
fijal
noreply at buildbot.pypy.org
Tue Feb 24 16:57:38 CET 2015
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: optresult
Changeset: r76106:9c7babe1f395
Date: 2015-02-24 17:55 +0200
http://bitbucket.org/pypy/pypy/changeset/9c7babe1f395/
Log: write a very simple test and fix it until it passes
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
@@ -612,23 +612,17 @@
orig_op.set_forwarded(op)
return op
+ def force_box(self, op):
+ return self.get_box_replacement(op)
+
def ensure_imported(self, value):
pass
- @specialize.argtype(0)
def get_constant_box(self, box):
+ box = self.get_box_replacement(box)
if isinstance(box, Const):
return box
- try:
- value = self.values[box]
- self.ensure_imported(value)
- except KeyError:
- return None
- if value.is_constant():
- constbox = value.box
- assert isinstance(constbox, Const)
- return constbox
- return None
+ #self.ensure_imported(value)
def get_newoperations(self):
self.flush()
@@ -734,16 +728,10 @@
orig_op = op
op = self.replace_op_with(op, op.getopnum())
for i in range(op.numargs()):
- arg = op.getarg(i)
- try:
- value = self.values[arg]
- except KeyError:
- pass
- else:
- self.ensure_imported(value)
- newbox = value.force_box(self)
- if arg is not newbox:
- op.setarg(i, newbox)
+ arg = self.force_box(op.getarg(i))
+ #self.ensure_imported(value)
+ # newbox = value.force_box(self)
+ op.setarg(i, arg)
self.metainterp_sd.profiler.count(jitprof.Counters.OPT_OPS)
if op.is_guard():
self.metainterp_sd.profiler.count(jitprof.Counters.OPT_GUARDS)
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -115,6 +115,21 @@
class BaseTestOptimizeBasic(BaseTestBasic):
+ def test_very_simple(self):
+ ops = """
+ [i]
+ i0 = int_sub(i, 1)
+ guard_value(i0, 0) [i0]
+ jump(i0)
+ """
+ expected = """
+ [i]
+ i0 = int_sub(i, 1)
+ guard_value(i0, 0) [i0]
+ jump(0)
+ """
+ self.optimize_loop(ops, expected)
+
def test_simple(self):
ops = """
[i]
More information about the pypy-commit
mailing list