Author: Armin Rigo <ar...@tunes.org> Branch: use-mmap Changeset: r85578:c645b576c5ad Date: 2016-07-06 15:14 +0200 http://bitbucket.org/pypy/pypy/changeset/c645b576c5ad/
Log: Trying to use mmap() for memory allocations done by the RPython GC diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py --- a/pypy/module/cpyext/api.py +++ b/pypy/module/cpyext/api.py @@ -613,7 +613,7 @@ }.items(): GLOBALS['%s#%s' % (cpyname, pypy_decl)] = ('PyTypeObject*', pypyexpr) - for cpyname in '''PyMethodObject PyListObject PyLongObject + for cpyname in '''PyMethodObject PyListObject PyDictObject PyClassObject'''.split(): FORWARD_DECLS.append('typedef struct { PyObject_HEAD } %s' % (cpyname, )) diff --git a/pypy/module/cpyext/include/longintrepr.h b/pypy/module/cpyext/include/longintrepr.h --- a/pypy/module/cpyext/include/longintrepr.h +++ b/pypy/module/cpyext/include/longintrepr.h @@ -1,1 +1,28 @@ -/* empty */ +#ifndef Py_LONGINTREPR_H +#define Py_LONGINTREPR_H + +/* + Should not be used, but is, by a few projects out there. +*/ +#include <stdint.h> + + +#define PYLONG_BITS_IN_DIGIT 30 +typedef uint32_t digit; +typedef int32_t sdigit; +typedef uint64_t twodigits; +typedef int64_t stwodigits; +#define PyLong_SHIFT 30 +#define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */ +#define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */ + +#define PyLong_BASE ((digit)1 << PyLong_SHIFT) +#define PyLong_MASK ((digit)(PyLong_BASE - 1)) + +/* b/w compatibility with Python 2.5 */ +#define SHIFT PyLong_SHIFT +#define BASE PyLong_BASE +#define MASK PyLong_MASK + + +#endif diff --git a/pypy/module/cpyext/longobject.py b/pypy/module/cpyext/longobject.py --- a/pypy/module/cpyext/longobject.py +++ b/pypy/module/cpyext/longobject.py @@ -9,6 +9,14 @@ from rpython.rlib.rarithmetic import intmask +PyLongObjectStruct = lltype.ForwardReference() +PyLongObject = lltype.Ptr(PyLongObjectStruct) +Digits = rffi.CArray(PyObject) +PyTupleObjectFields = PyObjectFields + \ + (("ob_size", Py_ssize_t), ("ob_item", lltype.Ptr(ObjectItems))) +cpython_struct("PyTupleObject", PyTupleObjectFields, PyTupleObjectStruct) + + PyLong_Check, PyLong_CheckExact = build_type_checkers("Long") @cpython_api([lltype.Signed], PyObject) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit