[pypy-commit] pypy virtual-raw-mallocs: use ldexp instead of pow, to make sure that the raw_malloc optimization works also with integers type. Failing so far
antocuni
noreply at buildbot.pypy.org
Thu Dec 20 17:58:29 CET 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: virtual-raw-mallocs
Changeset: r59527:804ffa6e4a14
Date: 2012-12-20 17:51 +0100
http://bitbucket.org/pypy/pypy/changeset/804ffa6e4a14/
Log: use ldexp instead of pow, to make sure that the raw_malloc
optimization works also with integers type. Failing so far
diff --git a/pypy/module/pypyjit/test_pypy_c/test_ffi.py b/pypy/module/pypyjit/test_pypy_c/test_ffi.py
--- a/pypy/module/pypyjit/test_pypy_c/test_ffi.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_ffi.py
@@ -182,28 +182,29 @@
libm = _cffi_backend.load_library(libm_name)
BDouble = _cffi_backend.new_primitive_type("double")
- BPow = _cffi_backend.new_function_type([BDouble, BDouble], BDouble)
- pow = libm.load_function(BPow, 'pow')
+ BInt = _cffi_backend.new_primitive_type("int")
+ BPow = _cffi_backend.new_function_type([BDouble, BInt], BDouble)
+ ldexp = libm.load_function(BPow, 'ldexp')
i = 0
res = 0
while i < 300:
- tmp = pow(2, 3) # ID: cfficall
+ tmp = ldexp(1, 3) # ID: cfficall
res += tmp
i += 1
BLong = _cffi_backend.new_primitive_type("long")
- pow_addr = int(_cffi_backend.cast(BLong, pow))
- return pow_addr, res
+ ldexp_addr = int(_cffi_backend.cast(BLong, ldexp))
+ return ldexp_addr, res
#
libm_name = get_libm_name(sys.platform)
log = self.run(main, [libm_name])
- pow_addr, res = log.result
+ ldexp_addr, res = log.result
assert res == 8.0 * 300
loop, = log.loops_by_filename(self.filepath)
- if 'ConstClass(pow)' in repr(loop): # e.g. OS/X
- pow_addr = 'ConstClass(pow)'
+ if 'ConstClass(ldexp)' in repr(loop): # e.g. OS/X
+ ldexp_addr = 'ConstClass(ldexp)'
assert loop.match_by_id('cfficall', """
...
- f1 = call_release_gil(..., descr=<Callf 8 ff EF=6 OS=62>)
+ f1 = call_release_gil(..., descr=<Callf 8 fi EF=6 OS=62>)
...
""")
ops = loop.ops_by_id('cfficall')
@@ -214,4 +215,3 @@
# so far just check that call_release_gil() is produced.
# later, also check that the arguments to call_release_gil()
# are constants
-
More information about the pypy-commit
mailing list