Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: Changeset: r71883:2c226c08373f Date: 2014-05-25 18:40 +0200 http://bitbucket.org/pypy/pypy/changeset/2c226c08373f/
Log: The "zero" parameter of lltype.malloc() is checked to be constant. This constraint has to be propagated up to scoped_alloc(), to generate specialized versions. diff --git a/rpython/rtyper/lltypesystem/lltype.py b/rpython/rtyper/lltypesystem/lltype.py --- a/rpython/rtyper/lltypesystem/lltype.py +++ b/rpython/rtyper/lltypesystem/lltype.py @@ -2178,9 +2178,9 @@ def ann_render_immortal(s_p, s_track_allocation=None): assert s_track_allocation is None or s_track_allocation.is_constant() -def _make_scoped_allocator(T): +def _make_scoped_allocator(T, zero): class ScopedAlloc: - def __init__(self, n=None, zero=False): + def __init__(self, n=None): if n is None: self.buf = malloc(T, flavor='raw', zero=zero) else: @@ -2204,8 +2204,8 @@ ...use array... ...it's freed now. """ - return _make_scoped_allocator(T)(n=n, zero=zero) -scoped_alloc._annspecialcase_ = 'specialize:arg(0)' + return _make_scoped_allocator(T, zero)(n=n) +scoped_alloc._annspecialcase_ = 'specialize:arg(0, 2)' def functionptr(TYPE, name, **attrs): if not isinstance(TYPE, FuncType): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit