[pypy-commit] pypy unroll-if-alt: use unroll_iff
cfbolz
noreply at buildbot.pypy.org
Tue Sep 20 15:51:41 CEST 2011
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: unroll-if-alt
Changeset: r47366:6ed4f8df93ce
Date: 2011-09-20 15:51 +0200
http://bitbucket.org/pypy/pypy/changeset/6ed4f8df93ce/
Log: use unroll_iff
diff --git a/pypy/objspace/std/newformat.py b/pypy/objspace/std/newformat.py
--- a/pypy/objspace/std/newformat.py
+++ b/pypy/objspace/std/newformat.py
@@ -65,13 +65,9 @@
space.wrap("Recursion depth exceeded"))
level -= 1
s = self.template
- # It would be quite nice to use @jit.unroll_iff(), but that interferes
- # with the ctr_location specialization of the class.
- if jit.isconstant(s):
- return self._do_build_string_unroll(start, end, level, out, s)
- else:
- return self._do_build_string(start, end, level, out, s)
+ return self._do_build_string(start, end, level, out, s)
+ @jit.unroll_iff(lambda self, start, end, level, out, s: jit.isconstant(s))
def _do_build_string(self, start, end, level, out, s):
space = self.space
last_literal = i = start
@@ -124,11 +120,6 @@
out.append_slice(s, last_literal, end)
return out.build()
- f = sourcetools.func_with_new_name(_do_build_string,
- "_do_build_string_unroll")
- _do_build_string_unroll = jit.unroll_safe(f)
- del f
-
def _parse_field(self, start, end):
s = self.template
# Find ":" or "!"
More information about the pypy-commit
mailing list