Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r64744:661d7f7624dc
Date: 2013-06-03 20:41 -0700
http://bitbucket.org/pypy/pypy/changeset/661d7f7624dc/
Log: Inline into rbigint so that comparisons can be constant folded.
diff --git a/pypy/module/pypyjit/policy.py b/pypy/module/pypyjit/policy.py
--- a/pypy/module/pypyjit/policy.py
+++ b/pypy/module/pypyjit/policy.py
@@ -118,7 +118,7 @@
def look_inside_function(self, func):
mod = func.__module__ or '?'
- if mod == 'rpython.rlib.rbigint' or mod == 'rpython.rlib.rlocale' or
mod == 'rpython.rlib.rsocket':
+ if mod == 'rpython.rlib.rlocale' or mod == 'rpython.rlib.rsocket':
return False
if mod.startswith('pypy.interpreter.astcompiler.'):
return False
diff --git a/pypy/module/pypyjit/test/test_policy.py
b/pypy/module/pypyjit/test/test_policy.py
--- a/pypy/module/pypyjit/test/test_policy.py
+++ b/pypy/module/pypyjit/test/test_policy.py
@@ -8,7 +8,7 @@
def test_bigint():
from rpython.rlib.rbigint import rbigint
- assert not pypypolicy.look_inside_function(rbigint.lt.im_func)
+ assert pypypolicy.look_inside_function(rbigint.lt.im_func)
def test_rlocale():
from rpython.rlib.rlocale import setlocale
diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py
b/pypy/module/pypyjit/test_pypy_c/test_misc.py
--- a/pypy/module/pypyjit/test_pypy_c/test_misc.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py
@@ -74,7 +74,6 @@
jump(..., descr=...)
""")
-
def test_mixed_type_loop(self):
def main(n):
i = 0.0
@@ -94,7 +93,6 @@
jump(..., descr=...)
""")
-
def test_cached_pure_func_of_equal_fields(self):
def main(n):
class A(object):
@@ -196,7 +194,6 @@
jump(..., descr=...)
""")
-
def test_chain_of_guards(self):
src = """
class A(object):
@@ -220,7 +217,6 @@
loops = log.loops_by_filename(self.filepath)
assert len(loops) == 1
-
def test_unpack_iterable_non_list_tuple(self):
def main(n):
import array
@@ -258,7 +254,6 @@
jump(..., descr=...)
""")
-
def test_dont_trace_every_iteration(self):
def main(a, b):
i = sa = 0
@@ -289,7 +284,6 @@
assert log.result == 300 * (-10 % -20)
assert log.jit_summary.tracing_no == 1
-
def test_overflow_checking(self):
"""
This test only checks that we get the expected result, not that any
@@ -298,7 +292,8 @@
def main():
import sys
def f(a,b):
- if a < 0: return -1
+ if a < 0:
+ return -1
return a-b
#
total = sys.maxint - 2147483647
@@ -309,7 +304,6 @@
#
self.run_and_check(main, [])
-
def test_global(self):
log = self.run("""
i = 0
@@ -404,3 +398,14 @@
# the following assertion fails if the loop was cancelled due
# to "abort: vable escape"
assert len(log.loops_by_id("exc_info")) == 1
+
+ def test_long_comparison(self):
+ def main(n):
+ while n:
+ 12345L > 123L # ID: long_op
+ n -= 1
+
+ log = self.run(main, [300])
+ loop, = log.loops_by_id("long_op")
+ assert log.match("""
+ """)
diff --git a/rpython/rtyper/lltypesystem/rstr.py
b/rpython/rtyper/lltypesystem/rstr.py
--- a/rpython/rtyper/lltypesystem/rstr.py
+++ b/rpython/rtyper/lltypesystem/rstr.py
@@ -332,7 +332,7 @@
newstr = s2.malloc(len1 + len2)
newstr.copy_contents_from_str(s1, newstr, 0, 0, len1)
else:
- newstr = s1.malloc(len1 + len2)
+ newstr = s1.malloc(len1 + len2)
newstr.copy_contents(s1, newstr, 0, 0, len1)
if typeOf(s2) == Ptr(STR):
newstr.copy_contents_from_str(s2, newstr, 0, len1, len2)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit