[pypy-svn] r78085 - in pypy/trunk/pypy/rlib/rsre: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Tue Oct 19 16:43:49 CEST 2010


Author: cfbolz
Date: Tue Oct 19 16:43:48 2010
New Revision: 78085

Modified:
   pypy/trunk/pypy/rlib/rsre/rsre_core.py
   pypy/trunk/pypy/rlib/rsre/test/test_zjit.py
Log:
(arigo, cfbolz, antocuni) this probably breaks translation, but makes sure that
the regex JIT actually optimize more


Modified: pypy/trunk/pypy/rlib/rsre/rsre_core.py
==============================================================================
--- pypy/trunk/pypy/rlib/rsre/rsre_core.py	(original)
+++ pypy/trunk/pypy/rlib/rsre/rsre_core.py	Tue Oct 19 16:43:48 2010
@@ -1,5 +1,5 @@
 import sys
-from pypy.rlib.debug import check_nonneg
+from pypy.rlib.debug import check_nonneg, make_sure_not_modified
 from pypy.rlib.unroll import unrolling_iterable
 from pypy.rlib.rsre import rsre_char
 from pypy.tool.sourcetools import func_with_new_name
@@ -469,6 +469,7 @@
     while True:
         op = ctx.pat(ppos)
         ppos += 1
+        make_sure_not_modified(ctx.pattern)
 
         #jit.jit_debug("sre_match", op, ppos, ptr)
         #

Modified: pypy/trunk/pypy/rlib/rsre/test/test_zjit.py
==============================================================================
--- pypy/trunk/pypy/rlib/rsre/test/test_zjit.py	(original)
+++ pypy/trunk/pypy/rlib/rsre/test/test_zjit.py	Tue Oct 19 16:43:48 2010
@@ -9,7 +9,6 @@
 def entrypoint1(r, string, repeat):
     r = array2list(r)
     string = hlstr(string)
-    make_sure_not_modified(r)
     match = None
     for i in range(repeat):
         match = rsre_core.match(r, string)
@@ -21,7 +20,6 @@
 def entrypoint2(r, string, repeat):
     r = array2list(r)
     string = hlstr(string)
-    make_sure_not_modified(r)
     match = None
     for i in range(repeat):
         match = rsre_core.search(r, string)
@@ -118,3 +116,8 @@
             r"Active\s+20\d\d-\d\d-\d\d\s+[[]\d+[]]([^[]+)",
             "Active"*20 + "Active 2010-04-07 [42] Foobar baz boz blah[43]")
         assert res == 6*20
+
+    def test_aorbstar(self):
+        res = self.meta_interp_match("(a|b)*a", "a" * 100)
+        assert res == 100
+        self.check_loops(guard_value=0)



More information about the Pypy-commit mailing list