Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r48340:9b572a41522b
Date: 2011-10-22 07:27 -0700
http://bitbucket.org/pypy/pypy/changeset/9b572a41522b/
Log: mark a few functions in {str, unicode}.format as being unroll_safe.
"{} {}".format(i, i) now generates very nice code
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
@@ -120,6 +120,8 @@
out.append_slice(s, last_literal, end)
return out.build()
+ # This is only ever called if we're already unrolling _do_build_string
+ @jit.unroll_safe
def _parse_field(self, start, end):
s = self.template
# Find ":" or "!"
@@ -149,6 +151,7 @@
i += 1
return s[start:end], None, end
+ @jit.unroll_safe
def _get_argument(self, name):
# First, find the argument.
space = self.space
@@ -207,6 +210,7 @@
raise OperationError(space.w_IndexError, w_msg)
return self._resolve_lookups(w_arg, name, i, end)
+ @jit.unroll_safe
def _resolve_lookups(self, w_obj, name, start, end):
# Resolve attribute and item lookups.
space = self.space
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit