aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Friedrich Bolz <cfbolz@gmx.de>2016-03-04 15:43:23 +0100
committerCarl Friedrich Bolz <cfbolz@gmx.de>2016-03-04 15:43:23 +0100
commit994f8ad93c2b8f76f4078d6acc13aecae7d47896 (patch)
tree3e30b559f84e04baa8ebeb7e84cce1b608adb16c /pypy/module
parenta somewhat messy improvement of re.sub. makes simple things 3x faster (not (diff)
downloadpypy-994f8ad93c2b8f76f4078d6acc13aecae7d47896.tar.gz
pypy-994f8ad93c2b8f76f4078d6acc13aecae7d47896.tar.bz2
pypy-994f8ad93c2b8f76f4078d6acc13aecae7d47896.zip
add a jit driver (unfortunately I can't use autoreds because of the green field
usage :-( )
Diffstat (limited to 'pypy/module')
-rw-r--r--pypy/module/_sre/interp_sre.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/pypy/module/_sre/interp_sre.py b/pypy/module/_sre/interp_sre.py
index 5546402e55..c1c07a6118 100644
--- a/pypy/module/_sre/interp_sre.py
+++ b/pypy/module/_sre/interp_sre.py
@@ -275,6 +275,22 @@ class W_SRE_Pattern(W_Root):
sublist_w = []
n = last_pos = 0
while not count or n < count:
+ sub_jitdriver.jit_merge_point(
+ self=self,
+ use_builder=use_builder,
+ filter_is_callable=filter_is_callable,
+ filter_type=type(w_filter),
+ ctx=ctx,
+ w_filter=w_filter,
+ strbuilder=strbuilder,
+ unicodebuilder=unicodebuilder,
+ filter_as_string=filter_as_string,
+ filter_as_unicode=filter_as_unicode,
+ count=count,
+ w_string=w_string,
+ n=n, last_pos=last_pos, sublist_w=sublist_w
+ )
+ space = self.space
if not searchcontext(space, ctx):
break
if last_pos < ctx.match_start:
@@ -329,6 +345,16 @@ class W_SRE_Pattern(W_Root):
space.newlist(sublist_w))
return w_item, n
+sub_jitdriver = jit.JitDriver(
+ reds="""count n last_pos
+ ctx w_filter
+ strbuilder unicodebuilder
+ filter_as_string
+ filter_as_unicode
+ w_string sublist_w
+ self""".split(),
+ greens=["filter_is_callable", "use_builder", "filter_type", "ctx.pattern"])
+
def _sub_append_slice(ctx, space, use_builder, sublist_w,
strbuilder, unicodebuilder, start, end):