Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r67532:fe8d08ae6823
Date: 2013-10-23 08:41 -0700
http://bitbucket.org/pypy/pypy/changeset/fe8d08ae6823/
Log: merged upstream
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -111,3 +111,6 @@
.. branch: incremental-gc
Added the new incminimark GC which performs GC in incremental steps
+
+.. branch: fast_cffi_list_init
+fastpath for cffi.new("long[]")
diff --git a/pypy/module/_cffi_backend/newtype.py
b/pypy/module/_cffi_backend/newtype.py
--- a/pypy/module/_cffi_backend/newtype.py
+++ b/pypy/module/_cffi_backend/newtype.py
@@ -117,13 +117,17 @@
SF_MSVC_BITFIELDS = 1
SF_GCC_ARM_BITFIELDS = 2
+SF_GCC_BIG_ENDIAN = 4
if sys.platform == 'win32':
DEFAULT_SFLAGS = SF_MSVC_BITFIELDS
-elif rffi_platform.getdefined('__arm__', ''):
- DEFAULT_SFLAGS = SF_GCC_ARM_BITFIELDS
else:
- DEFAULT_SFLAGS = 0
+ if rffi_platform.getdefined('__arm__', ''):
+ DEFAULT_SFLAGS = SF_GCC_ARM_BITFIELDS
+ else:
+ DEFAULT_SFLAGS = 0
+ if sys.byteorder == 'big':
+ DEFAULT_SFLAGS |= SF_GCC_BIG_ENDIAN
@unwrap_spec(name=str)
def new_struct_type(space, name):
@@ -325,6 +329,9 @@
prev_bitfield_free -= fbitsize
field_offset_bytes = boffset / 8 - ftype.size
+ if sflags & SF_GCC_BIG_ENDIAN:
+ bitshift = 8 * ftype.size - fbitsize- bitshift
+
fld = ctypestruct.W_CField(ftype, field_offset_bytes,
bitshift, fbitsize)
fields_list.append(fld)
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py
b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -2949,8 +2949,6 @@
_test_bitfield_details(flag=2)
def test_bitfield_as_big_endian():
- if '__pypy__' in sys.builtin_module_names:
- py.test.skip("no big endian machine supported on pypy for now")
_test_bitfield_details(flag=4)
diff --git a/pypy/module/rctime/test/test_rctime.py
b/pypy/module/rctime/test/test_rctime.py
--- a/pypy/module/rctime/test/test_rctime.py
+++ b/pypy/module/rctime/test/test_rctime.py
@@ -139,6 +139,10 @@
assert rctime.ctime(t) != rctime.asctime(rctime.gmtime(t))
ltime = rctime.localtime()
assert rctime.asctime(tuple(ltime)) == rctime.asctime(ltime)
+ try:
+ assert rctime.asctime((12345,) + (0,) * 8).split()[-1] == '12345'
+ except ValueError:
+ pass # some OS (ie POSIXes besides Linux) reject year > 9999
def test_accept2dyear_access(self):
import time as rctime
@@ -146,7 +150,8 @@
accept2dyear = rctime.accept2dyear
del rctime.accept2dyear
try:
- assert rctime.asctime((12345,) + (0,) * 8).split()[-1] == '12345'
+ # with year >= 1900 this shouldn't need to access accept2dyear
+ assert rctime.asctime((2000,) + (0,) * 8).split()[-1] == '2000'
finally:
rctime.accept2dyear = accept2dyear
diff --git a/pypy/tool/pypyjit.py b/pypy/tool/pypyjit.py
--- a/pypy/tool/pypyjit.py
+++ b/pypy/tool/pypyjit.py
@@ -28,15 +28,16 @@
config.translation.backendopt.inline_threshold = 0.1
config.translation.gc = 'boehm'
config.translating = True
+config.translation.rweakref = False
set_opt_level(config, level='jit')
config.objspace.allworkingmodules = False
config.objspace.usemodules.pypyjit = True
config.objspace.usemodules.array = False
-config.objspace.usemodules._weakref = True
+config.objspace.usemodules._weakref = False
config.objspace.usemodules._sre = False
config.objspace.usemodules._lsprof = False
#
-config.objspace.usemodules._ffi = True
+config.objspace.usemodules._ffi = False
config.objspace.usemodules.micronumpy = False
#
set_pypy_opt_level(config, level='jit')
@@ -101,7 +102,7 @@
from rpython.jit.codewriter.codewriter import CodeWriter
CodeWriter.debug = True
- from rpython.jit.tl.pypyjit_child import run_child
+ from pypy.tool.pypyjit_child import run_child
run_child(globals(), locals())
diff --git a/pypy/tool/pypyjit_demo.py b/pypy/tool/pypyjit_demo.py
--- a/pypy/tool/pypyjit_demo.py
+++ b/pypy/tool/pypyjit_demo.py
@@ -1,27 +1,20 @@
-import pypyjit
-pypyjit.set_param(threshold=200)
-kwargs = {"z": 1}
+def g(i):
+ k = 0
+ while k < 3:
+ k += 1
+ return i + 1
-def f(*args, **kwargs):
- result = g(1, *args, **kwargs)
- return result + 2
+def f(x):
+ for i in range(10000):
+ t = (1, 2, i)
+ i = g(i)
+ x == t
-def g(x, y, z=2):
- return x - y + z
-
-def main():
- res = 0
- i = 0
- while i < 10000:
- res = f(res, z=i)
- g(1, res, **kwargs)
- i += 1
- return res
try:
- print main()
+ f((1, 2, 3))
except Exception, e:
print "Exception: ", type(e)
diff --git a/rpython/jit/metainterp/heapcache.py
b/rpython/jit/metainterp/heapcache.py
--- a/rpython/jit/metainterp/heapcache.py
+++ b/rpython/jit/metainterp/heapcache.py
@@ -6,7 +6,7 @@
def __init__(self):
self.reset()
- def reset(self):
+ def reset(self, reset_virtuals=True):
# contains boxes where the class is already known
self.known_class_boxes = {}
# store the boxes that contain newly allocated objects, this maps the
@@ -14,7 +14,8 @@
# escaped the trace or not (True means the box never escaped, False
# means it did escape), its presences in the mapping shows that it was
# allocated inside the trace
- self.new_boxes = {}
+ if reset_virtuals:
+ self.new_boxes = {}
# Tracks which boxes should be marked as escaped when the key box
# escapes.
self.dependencies = {}
diff --git a/rpython/jit/metainterp/pyjitpl.py
b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -2058,7 +2058,7 @@
duplicates[box] = None
def reached_loop_header(self, greenboxes, redboxes, resumedescr):
- self.heapcache.reset()
+ self.heapcache.reset(reset_virtuals=False)
duplicates = {}
self.remove_consts_and_duplicates(redboxes, len(redboxes),
diff --git a/rpython/jit/metainterp/test/test_ajit.py
b/rpython/jit/metainterp/test/test_ajit.py
--- a/rpython/jit/metainterp/test/test_ajit.py
+++ b/rpython/jit/metainterp/test/test_ajit.py
@@ -3359,6 +3359,26 @@
assert res == main(1)
self.check_resops(call=0, getfield_gc=0)
+ def test_isvirtual_call_assembler(self):
+ driver = JitDriver(greens = ['code'], reds = ['n'])
+
+ @look_inside_iff(lambda t1, t2: isvirtual(t1))
+ def g(t1, t2):
+ return t1[0] == t2[0]
+
+ def f(code, n):
+ while n > 0:
+ driver.can_enter_jit(code=code, n=n)
+ driver.jit_merge_point(code=code, n=n)
+ t = (1, 2, n)
+ if code:
+ f(0, 3)
+ g(t, (1, 2, n))
+ n -= 1
+
+ self.meta_interp(f, [1, 10], inline=True)
+ self.check_resops(call=0, call_may_force=0, call_assembler=2)
+
def test_reuse_elidable_result(self):
driver = JitDriver(reds=['n', 's'], greens = [])
def main(n):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit