Author: Hakan Ardo <[email protected]>
Branch: jit-duplicated_short_boxes
Changeset: r46940:dd9ad57ee821
Date: 2011-08-31 11:28 +0200
http://bitbucket.org/pypy/pypy/changeset/dd9ad57ee821/
Log: prevent short_boxes from blowing up too much
diff --git a/pypy/jit/metainterp/optimizeopt/virtualstate.py
b/pypy/jit/metainterp/optimizeopt/virtualstate.py
--- a/pypy/jit/metainterp/optimizeopt/virtualstate.py
+++ b/pypy/jit/metainterp/optimizeopt/virtualstate.py
@@ -531,6 +531,8 @@
allops = None
for i in range(len(op.getarglist())):
arg = op.getarg(i)
+ if len(self.duplicates) > 5:
+ debug_print("Refusing to duplicate short box %d times." %
len(self.duplicates))
if arg in self.duplicates:
if not allops:
allops = [op]
diff --git a/pypy/jit/tl/pypyjit_demo.py b/pypy/jit/tl/pypyjit_demo.py
--- a/pypy/jit/tl/pypyjit_demo.py
+++ b/pypy/jit/tl/pypyjit_demo.py
@@ -2,22 +2,16 @@
pypyjit.set_param(threshold=200)
-def main(a, b):
- i = sa = 0
- while i < 300:
- if a > 0: # Specialises the loop
- pass
- if b < 2 and b > 0:
- pass
- if (a >> b) >= 0:
- sa += 1
- if (a << b) > 2:
- sa += 10000
- i += 1
- return sa
+def f(n):
+ pairs = [(0.0, 1.0), (2.0, 3.0)] * n
+ mag = 0
+ for (x1, x2) in pairs:
+ dx = x1 - x2
+ mag += ((dx * dx ) ** (-1.5))
+ return n
try:
- print main(2, 1)
+ print f(301)
except Exception, e:
print "Exception: ", type(e)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit