[pypy-svn] pypy default: simplify the JIT fast path for max
cfbolz
commits-noreply at bitbucket.org
Thu Mar 10 11:09:06 CET 2011
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch:
Changeset: r42489:f52161d466dd
Date: 2011-03-10 11:04 +0100
http://bitbucket.org/pypy/pypy/changeset/f52161d466dd/
Log: simplify the JIT fast path for max
diff --git a/pypy/module/__builtin__/functional.py b/pypy/module/__builtin__/functional.py
--- a/pypy/module/__builtin__/functional.py
+++ b/pypy/module/__builtin__/functional.py
@@ -11,7 +11,6 @@
from pypy.rlib.rarithmetic import r_uint, intmask
from pypy.rlib.objectmodel import specialize
from inspect import getsource, getfile
-from pypy.rlib.jit import unroll_safe
from pypy.rlib.rbigint import rbigint
@@ -135,7 +134,6 @@
return space.newlist(res_w)
- at unroll_safe
@specialize.arg(2)
def min_max(space, args, implementation_of):
if implementation_of == "max":
@@ -145,13 +143,12 @@
args_w = args.arguments_w
if len(args_w) == 2 and not args.keywords:
- # Unrollable case
- w_max_item = None
- for w_item in args_w:
- if w_max_item is None or \
- space.is_true(compare(w_item, w_max_item)):
- w_max_item = w_item
- return w_max_item
+ # simple case, suitable for the JIT
+ w_arg0, w_arg1 = args_w
+ if space.is_true(compare(w_arg0, w_arg1)):
+ return w_arg0
+ else:
+ return w_arg1
else:
return min_max_loop(space, args, implementation_of)
More information about the Pypy-commit
mailing list