[pypy-svn] r66706 - pypy/branch/pyjitpl5/pypy/jit/metainterp/test
arigo at codespeak.net
arigo at codespeak.net
Thu Jul 30 20:34:07 CEST 2009
Author: arigo
Date: Thu Jul 30 20:34:06 2009
New Revision: 66706
Modified:
pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimizeopt.py
Log:
Make most tests in test_optimizeopt also actually test optimizefindnode
for free.
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimizeopt.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimizeopt.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimizeopt.py Thu Jul 30 20:34:06 2009
@@ -6,6 +6,7 @@
from pypy.jit.metainterp.test.test_optimizefindnode import (LLtypeMixin,
OOtypeMixin,
BaseTest)
+from pypy.jit.metainterp.optimizefindnode import PerfectSpecializationFinder
from pypy.jit.metainterp.optimizeopt import optimize_loop_1
from pypy.jit.metainterp.history import AbstractDescr, ConstInt
from pypy.jit.metainterp import resume, executor, compile
@@ -96,10 +97,22 @@
expected.operations,
remap)
- def optimize_loop(self, ops, spectext, optops, boxkinds=None, **values):
+ def optimize_loop(self, ops, spectext, optops,
+ boxkinds=None, checkspecnodes=True, **values):
loop = self.parse(ops, boxkinds=boxkinds)
loop.setvalues(**values)
- loop.specnodes = self.unpack_specnodes(spectext)
+ #
+ if checkspecnodes:
+ # verify that 'spectext' is indeed what optimizefindnode would
+ # compute for this loop
+ perfect_specialization_finder = PerfectSpecializationFinder()
+ perfect_specialization_finder.find_nodes_loop(loop)
+ self.check_specnodes(loop.specnodes, spectext)
+ else:
+ # for cases where we want to see how optimizeopt behaves with
+ # combinations different from the one computed by optimizefindnode
+ loop.specnodes = self.unpack_specnodes(spectext)
+ #
assert loop.operations[-1].opnum == rop.JUMP
loop.operations[-1].jump_target = loop
#
@@ -463,7 +476,7 @@
jump(i, i1)
"""
self.optimize_loop(ops, 'Not, Virtual(node_vtable, valuedescr=Not)',
- expected)
+ expected, checkspecnodes=False)
def test_virtual_2(self):
ops = """
@@ -531,7 +544,7 @@
self.optimize_loop(ops, '''Virtual(node_vtable),
Virtual(node_vtable),
Not''',
- expected,
+ expected, checkspecnodes=False,
i1=1, i2=0, i3=1, i4=0, i5=1, i6=0,
i7=1, i8=0, i9=1, i10=0, i11=1, i12=0)
#
More information about the Pypy-commit
mailing list