[pypy-commit] pypy default: convert this test to optimizeopt
alex_gaynor
noreply at buildbot.pypy.org
Tue Apr 24 16:33:49 CEST 2012
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r54724:7e5daf087990
Date: 2012-04-24 10:33 -0400
http://bitbucket.org/pypy/pypy/changeset/7e5daf087990/
Log: convert this test to optimizeopt
diff --git a/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py
--- a/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -7,7 +7,7 @@
import pypy.jit.metainterp.optimizeopt.optimizer as optimizeopt
import pypy.jit.metainterp.optimizeopt.virtualize as virtualize
from pypy.jit.metainterp.optimize import InvalidLoop
-from pypy.jit.metainterp.history import AbstractDescr, ConstInt, BoxInt
+from pypy.jit.metainterp.history import AbstractDescr, ConstInt, BoxInt, get_const_ptr_for_string
from pypy.jit.metainterp import executor, compile, resume, history
from pypy.jit.metainterp.resoperation import rop, opname, ResOperation
from pypy.rlib.rarithmetic import LONG_BIT
@@ -5067,6 +5067,25 @@
"""
self.optimize_strunicode_loop(ops, expected)
+ def test_call_pure_vstring_const(self):
+ ops = """
+ []
+ p0 = newstr(3)
+ strsetitem(p0, 0, 97)
+ strsetitem(p0, 1, 98)
+ strsetitem(p0, 2, 99)
+ i0 = call_pure(123, p0, descr=nonwritedescr)
+ finish(i0)
+ """
+ expected = """
+ []
+ finish(5)
+ """
+ call_pure_results = {
+ (ConstInt(123), get_const_ptr_for_string("abc"),): ConstInt(5),
+ }
+ self.optimize_loop(ops, expected, call_pure_results)
+
class TestLLtype(BaseTestOptimizeBasic, LLtypeMixin):
pass
diff --git a/pypy/jit/metainterp/test/test_ajit.py b/pypy/jit/metainterp/test/test_ajit.py
--- a/pypy/jit/metainterp/test/test_ajit.py
+++ b/pypy/jit/metainterp/test/test_ajit.py
@@ -3022,27 +3022,6 @@
res = self.meta_interp(f, [32])
assert res == f(32)
- def test_elidable_vstring_const(self):
- myjitdriver = JitDriver(greens = ["n"], reds = ["i", "c"])
- @elidable
- def g(s):
- return s + "hello"
- @unroll_safe
- def make_str(n):
- return "".join(["a" for _ in range(n)])
- def f(n):
- i = 0
- c = 0
- while i < n:
- myjitdriver.jit_merge_point(n=n, i=i, c=c)
- s = make_str(n // 5)
- c += len(g(s))
- i += 1
- return c
- res = self.meta_interp(f, [10])
- assert res == 70
- self.check_resops({"int_lt": 2, "int_add": 4, "guard_true": 2, "jump": 1})
-
class TestOOtype(BasicTests, OOJitMixin):
More information about the pypy-commit
mailing list