Author: Maciej Fijalkowski <[email protected]>
Branch: optresult-unroll
Changeset: r79253:1e0e6b76cf77
Date: 2015-08-27 13:54 +0200
http://bitbucket.org/pypy/pypy/changeset/1e0e6b76cf77/
Log: yay pass test_string
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
@@ -764,6 +764,12 @@
def check_resops(self, expected=None, omit_finish=True, **check):
insns = {}
+ if 'call' in check:
+ assert check.pop('call') == 0
+ check['call_i'] = check['call_r'] = check['call_f'] =
check['call_n'] = 0
+ if 'call_pure' in check:
+ assert check.pop('call_pure') == 0
+ check['call_pure_i'] = check['call_pure_r'] = check['call_pure_f']
= 0
for loop in self.get_all_loops():
insns = loop.summary(adding_insns=insns, omit_finish=omit_finish)
return self._check_insns(insns, expected, check)
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
@@ -149,6 +149,11 @@
cell_token = jump_op.getdescr()
if not inline_short_preamble or len(cell_token.target_tokens) == 1:
return self.jump_to_preamble(cell_token, jump_op, info)
+ # force all the information that does not go to the short
+ # preamble at all
+ self.optimizer.force_at_end_of_preamble()
+ for a in jump_op.getarglist():
+ self.optimizer.force_box_for_end_of_preamble(a)
vs = self.jump_to_existing_trace(jump_op)
if vs is None:
return info, self.optimizer._newoperations[:]
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
@@ -653,4 +653,3 @@
def visit_varraystruct(self, arraydescr, length, fielddescrs):
return VArrayStructStateInfo(arraydescr, fielddescrs)
-
diff --git a/rpython/jit/metainterp/test/test_string.py
b/rpython/jit/metainterp/test/test_string.py
--- a/rpython/jit/metainterp/test/test_string.py
+++ b/rpython/jit/metainterp/test/test_string.py
@@ -166,10 +166,11 @@
return 42
self.meta_interp(f, [6, 7])
if _str is str:
- self.check_resops(call_pure=0, copystrcontent=4,
- strsetitem=0, call=2, newstr=2)
+ self.check_resops(call_pure_i=0, call_pure_r=0, copystrcontent=4,
+ strsetitem=0, call_n=2, newstr=2)
else:
- self.check_resops(call_pure=0, unicodesetitem=0, call=2,
+ self.check_resops(call_pure_i=0, call_pure_r=0,
+ unicodesetitem=0, call_n=2,
copyunicodecontent=4, newunicode=2)
def test_strconcat_escape_str_char(self):
@@ -189,10 +190,12 @@
return 42
self.meta_interp(f, [6, 7])
if _str is str:
- self.check_resops(call_pure=0, copystrcontent=2, strsetitem=2,
- call=2, newstr=2)
+ self.check_resops(call_pure_i=0, call_pure_r=0,
+ copystrcontent=2, strsetitem=2,
+ call_n=2, newstr=2)
else:
- self.check_resops(call_pure=0, unicodesetitem=2, call=2,
+ self.check_resops(call_pure_i=0, call_pure_r=0,
+ unicodesetitem=2, call_n=2,
copyunicodecontent=2, newunicode=2)
def test_strconcat_escape_char_str(self):
@@ -212,10 +215,11 @@
return 42
self.meta_interp(f, [6, 7])
if _str is str:
- self.check_resops(call_pure=0, copystrcontent=2,
- strsetitem=2, call=2, newstr=2)
+ self.check_resops(call_pure_i=0, call_pure_r=0, copystrcontent=2,
+ strsetitem=2, call_n=2, newstr=2)
else:
- self.check_resops(call_pure=0, unicodesetitem=2, call=2,
+ self.check_resops(call_pure_i=0, unicodesetitem=2,
+ call_n=2,
copyunicodecontent=2, newunicode=2)
def test_strconcat_escape_char_char(self):
@@ -235,9 +239,9 @@
self.meta_interp(f, [6, 7])
if _str is str:
self.check_resops(call_pure=0, copystrcontent=0,
- strsetitem=4, call=2, newstr=2)
+ strsetitem=4, call_n=2, newstr=2)
else:
- self.check_resops(call_pure=0, unicodesetitem=4, call=2,
+ self.check_resops(call_pure=0, unicodesetitem=4, call_n=2,
copyunicodecontent=0, newunicode=2)
def test_strconcat_escape_str_char_str(self):
@@ -258,9 +262,9 @@
self.meta_interp(f, [6, 7])
if _str is str:
self.check_resops(call_pure=0, copystrcontent=4, strsetitem=2,
- call=2, newstr=2)
+ call_n=2, newstr=2)
else:
- self.check_resops(call_pure=0, unicodesetitem=2, call=2,
+ self.check_resops(call_pure=0, unicodesetitem=2, call_n=2,
copyunicodecontent=4, newunicode=2)
def test_strconcat_guard_fail(self):
@@ -512,7 +516,7 @@
return 0
self.meta_interp(f, [0])
- self.check_resops(call=7)
+ self.check_resops(call_r=2, call_i=5)
def test_join_chars(self):
jitdriver = JitDriver(reds=['a', 'b', 'c', 'i'], greens=[])
@@ -688,8 +692,9 @@
return n
res = self.meta_interp(f, [10], backendopt=True)
assert res == 0
- self.check_resops(call=6, # (ll_append_res0, ll_append_0_2,
ll_build)
- # * 2 unroll
+ self.check_resops(call_n=4, call_r=2,
+ # (ll_append_res0, ll_append_0_2, ll_build)
+ # * 2 unroll
cond_call=0)
def test_stringbuilder_append_len2_2(self):
@@ -710,7 +715,8 @@
return n
res = self.meta_interp(f, [10], backendopt=True)
assert res == 0
- self.check_resops(call=4, # (ll_append_res0, ll_build) * 2 unroll
+ self.check_resops(call_n=2, call_r=2,
+ # (ll_append_res0, ll_build) * 2 unroll
cond_call=0)
def test_stringbuilder_append_slice_1(self):
@@ -727,7 +733,7 @@
return n
res = self.meta_interp(f, [10], backendopt=True)
assert res == 0
- self.check_resops(call=6, cond_call=0,
+ self.check_resops(call_n=4, call_r=2, cond_call=0,
copyunicodecontent=0)
def test_stringbuilder_append_slice_2(self):
@@ -785,7 +791,8 @@
return n
res = self.meta_interp(f, [10], backendopt=True)
assert res == 0
- self.check_resops(call=4) # (_ll_append_multiple_char, build) * 2
+ self.check_resops(call_n=2, call_r=2)
+ # (_ll_append_multiple_char, build) * 2
def test_stringbuilder_bug1(self):
jitdriver = JitDriver(reds=['n', 's1'], greens=[])
@@ -901,7 +908,8 @@
# loop is not safe to remove; see 56eebe9dd813. We can still
# remove the call to ll_str, because that cannot raise anything
# else than MemoryError.
- self.check_resops(unicodesetitem=2, newunicode=2, call=5,
+ self.check_resops(unicodesetitem=2, newunicode=2, call_n=2,
+ call_r=3,
copyunicodecontent=2, unicodegetitem=0)
def test_str2unicode_fold(self):
@@ -920,7 +928,7 @@
m -= 1
return 42
self.meta_interp(f, [6, 7])
- self.check_resops(call_pure=0, unicodesetitem=0, call=2,
+ self.check_resops(call_pure=0, unicodesetitem=0, call_n=2,
newunicode=0, unicodegetitem=0,
copyunicodecontent=0)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit