[pypy-commit] pypy py3.5: Fix some tests

arigo pypy.commits at gmail.com
Tue Jun 13 04:32:03 EDT 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r91601:609a3cdf9cf7
Date: 2017-06-13 10:20 +0200
http://bitbucket.org/pypy/pypy/changeset/609a3cdf9cf7/

Log:	Fix some tests

diff --git a/pypy/module/pypyjit/test_pypy_c/model.py b/pypy/module/pypyjit/test_pypy_c/model.py
--- a/pypy/module/pypyjit/test_pypy_c/model.py
+++ b/pypy/module/pypyjit/test_pypy_c/model.py
@@ -253,6 +253,7 @@
 
 
 class OpMatcher(object):
+    DUMMY = 1000
 
     def __init__(self, ops, id=None):
         self.ops = ops
@@ -283,6 +284,13 @@
         #
         if line.strip() == 'guard_not_invalidated?':
             return 'guard_not_invalidated', None, [], '...', False
+        if line.strip() == 'dummy_get_utf8?':
+            cls.DUMMY += 1
+            return ('getfield_gc_r',
+                    'p%d' % cls.DUMMY,
+                    ['ConstPtr(ptr%d)' % cls.DUMMY],
+                    '<FieldP pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__utf8 .>',
+                    False)
         # find the resvar, if any
         if ' = ' in line:
             resvar, _, line = line.partition(' = ')
diff --git a/pypy/module/pypyjit/test_pypy_c/test_call.py b/pypy/module/pypyjit/test_pypy_c/test_call.py
--- a/pypy/module/pypyjit/test_pypy_c/test_call.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_call.py
@@ -81,7 +81,7 @@
         assert log.opnames(ops) == ["getfield_gc_r"]
         #
         assert entry_bridge.match_by_id('call', """
-            p30 = getfield_gc_r(ConstPtr(ptr29), descr=<FieldP pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__utf8 .>)
+            dummy_get_utf8?
             p38 = call_r(ConstClass(_ll_1_threadlocalref_get__Ptr_GcStruct_objectLlT_Signed), #, descr=<Callr . i EF=1 OS=5>)
             p99 = getfield_gc_r(p38, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_sys_exc_operror .*>)
             p39 = getfield_gc_r(p38, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_topframeref .*>)
@@ -443,7 +443,7 @@
             i22 = getfield_gc_i(p12, descr=<FieldS pypy.objspace.std.intobject.W_IntObject.inst_intval .*>)
             i24 = int_lt(i22, 5000)
             guard_true(i24, descr=...)
-            p21 = getfield_gc_r(ConstPtr(ptr20), descr=<FieldP pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__utf8 .>)
+            dummy_get_utf8?
             guard_not_invalidated(descr=...)
             p29 = call_r(ConstClass(_ll_1_threadlocalref_get__Ptr_GcStruct_objectLlT_Signed), #, descr=<Callr . i EF=1 OS=5>)
             p99 = getfield_gc_r(p29, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_sys_exc_operror .*>)
diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py b/pypy/module/pypyjit/test_pypy_c/test_misc.py
--- a/pypy/module/pypyjit/test_pypy_c/test_misc.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py
@@ -321,7 +321,7 @@
         loop, = log.loops_by_id("globalread", is_entry_bridge=True)
         assert loop.match_by_id("globalread", """
             # only a dead read
-            p26 = getfield_gc_r(ConstPtr(ptr25), descr=<FieldP pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__utf8 .>)
+            dummy_get_utf8?
         """)
 
     def test_eval(self):
diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py b/pypy/module/pypyjit/test_pypy_c/test_string.py
--- a/pypy/module/pypyjit/test_pypy_c/test_string.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_string.py
@@ -57,7 +57,6 @@
         assert loop.match("""
             i88 = int_lt(i83, i36)
             guard_true(i88, descr=...)
-            p90 = getfield_gc_r(ConstPtr(ptr89), descr=<FieldP pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__utf8 .>)
             guard_not_invalidated(descr=...)
             i92 = int_eq(i83, %d)
             i94 = call_i(ConstClass(ll_int_py_mod__Signed_Signed), i83, i46, descr=<Calli . ii EF=0 OS=14>)
@@ -66,7 +65,6 @@
             i97 = int_ge(i94, i53)
             guard_false(i97, descr=...)
             i98 = strgetitem(p52, i94)
-            p100 = getfield_gc_r(ConstPtr(ptr99), descr=<FieldP pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__utf8 .>)
             p101 = force_token()
             p103 = newstr(1)
             strsetitem(p103, 0, i98)
@@ -83,7 +81,6 @@
             p116 = call_r(ConstClass(ll_build_trampoline__), p104, descr=<Callr . r EF=5>)
             guard_no_exception(descr=...)
             guard_nonnull(p116, descr=...)
-            p118 = getfield_gc_r(ConstPtr(ptr117), descr=<FieldP pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__utf8 .>)
             guard_not_invalidated(descr=...)
             i119 = int_ge(i94, i46)
             guard_false(i119, descr=...)
@@ -113,9 +110,7 @@
         assert loop.match("""
             i11 = int_lt(i6, i7)
             guard_true(i11, descr=...)
-            p70 = getfield_gc_r(ConstPtr(ptr69), descr=<FieldP pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__utf8 .>)
             guard_not_invalidated(descr=...)
-            p72 = getfield_gc_r(ConstPtr(ptr71), descr=<FieldP pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__utf8 .>)
             i13 = int_eq(i6, %d)         # value provided below
 
             # "mod 10" block:
diff --git a/pypy/module/pypyjit/test_pypy_c/test_struct.py b/pypy/module/pypyjit/test_pypy_c/test_struct.py
--- a/pypy/module/pypyjit/test_pypy_c/test_struct.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_struct.py
@@ -34,6 +34,7 @@
             # on little endian machines, we take the fast path and store the
             # value using gc_store_indexed
             assert loop.match_by_id("pack", """
+                dummy_get_utf8?
                 guard_not_invalidated(descr=...)
                 # struct.pack
                 %s
@@ -42,6 +43,7 @@
             """ % extra)
         else:
             assert loop.match_by_id("pack", """
+                dummy_get_utf8?
                 guard_not_invalidated(descr=...)
                 # struct.pack
                 %s
@@ -56,6 +58,8 @@
 
         if sys.byteorder == 'little':
             assert loop.match_by_id("unpack", """
+                dummy_get_utf8?
+                dummy_get_utf8?
                 # struct.unpack
                 i91 = gc_load_indexed_i(p88, 0, 1, _, -4)
             """)
@@ -64,6 +68,8 @@
             # a char buffer and then use load gc to read the integer,
             # here manual shifting is applied
             assert loop.match_by_id("unpack", """
+                dummy_get_utf8?
+                dummy_get_utf8?
                 # struct.unpack
                 i95 = int_lshift(i90, 8)
                 i96 = int_or(i88, i95)
@@ -92,6 +98,7 @@
         if sys.byteorder == 'little':
             loop, = log.loops_by_filename(self.filepath)
             assert loop.match_by_id('pack', """
+                dummy_get_utf8?
                 guard_not_invalidated(descr=...)
                 # struct.pack
                 p85 = newstr(8)
@@ -101,6 +108,7 @@
             """ % extra)
 
             assert loop.match_by_id('unpack', """
+                dummy_get_utf8?
                 # struct.unpack
                 i90 = gc_load_indexed_i(p88, 0, 1, _, -4)
                 i91 = gc_load_indexed_i(p88, 4, 1, _, -4)
@@ -183,7 +191,9 @@
         assert log.result == main(1000)
         loop, = log.loops_by_filename(self.filepath)
         assert loop.match_by_id('pack_into', """\
+            dummy_get_utf8?
             guard_not_invalidated(descr=...)
+            dummy_get_utf8?
             p68 = getfield_gc_r(p14, descr=<FieldP pypy.objspace.std.bytearrayobject.W_BytearrayObject.inst__data \d+>)
             i69 = getfield_gc_i(p68, descr=<FieldS list.length \d+>)
             i70 = getfield_gc_i(p14, descr=<FieldS pypy.objspace.std.bytearrayobject.W_BytearrayObject.inst__offset \d+>)


More information about the pypy-commit mailing list