[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2021-09-03 Thread STINNER Victor
STINNER Victor added the comment: See bpo-45094: "Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds". -- ___ Python tracker

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2020-06-17 Thread STINNER Victor
STINNER Victor added the comment: New changeset 07923f32b16ba39165a58a5f47e807ca04ae17aa by Victor Stinner in branch 'master': bpo-35059: Enhance _PyObject_GC_TRACK() macros (GH-20931) https://github.com/python/cpython/commit/07923f32b16ba39165a58a5f47e807ca04ae17aa --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2020-06-17 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +20110 pull_request: https://github.com/python/cpython/pull/20931 ___ Python tracker ___

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread Steve Dower
Steve Dower added the comment: Ah, you're right, it's only C++. My bad. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
STINNER Victor added the comment: > Could we have used function overloading to handle the different types? Rather than reintroducing the macro for the sake of the cast? Sorry, I don't know what is function overloading. Is it a C++ thing? Py_INCREF() must accept any type based on PyObject. At

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread Steve Dower
Steve Dower added the comment: Could we have used function overloading to handle the different types? Rather than reintroducing the macro for the sake of the cast? -- nosy: +steve.dower ___ Python tracker

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
STINNER Victor added the comment: Advantages of inline functions over C macros: https://mail.python.org/pipermail/python-dev/2018-November/155805.html There are multiple advantages: * Better development and debugging experience: tools understand inlined functions much better than C macros:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
STINNER Victor added the comment: I close the issue, it seems like all subtasks have been completed. Summary of the issue: * The following macros have been converted to static inline functions: - Py_INCREF(), Py_DECREF() - Py_XINCREF(), Py_XDECREF() - PyObject_INIT(),

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
STINNER Victor added the comment: > Drawbacks: Require a specific type can introduce compiler warnings if the > caller doesn't pass the proper type (PyObject* or PyVarObject*). > _Py_NewReference() and _Py_ForgetReference() seem to be properly used, but > not PyObject_INIT() and

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
STINNER Victor added the comment: New changeset b509d52083e156f97d6bd36f2f894a052e960f03 by Victor Stinner in branch 'master': bpo-35059: PyObject_INIT() casts to PyObject* (GH-10674) https://github.com/python/cpython/commit/b509d52083e156f97d6bd36f2f894a052e960f03 --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9930 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
STINNER Victor added the comment: I ran my benchmarks, I close the PR 10669 (replace static inline functions with macros). You should still be able to use it as patch: https://github.com/python/cpython/pull/10669.patch -- ___ Python tracker

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
STINNER Victor added the comment: "PyObject* PyObject_INIT(PyObject *op, PyTypeObject *typeobj)" and "PyVarObject* PyObject_INIT_VAR(PyVarObject *op, PyTypeObject *typeobj, Py_ssize_t size)" Don't cast their argument to PyObject*/PyVarObject* which can introduce new warnings when upgrading

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
STINNER Victor added the comment: Stefan Behnel wrote: https://mail.python.org/pipermail/python-dev/2018-November/155759.html """ It's also slower to compile, given that function inlining happens at a much later point in the compiler pipeline than macro expansion. The C compiler won't even

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
STINNER Victor added the comment: Unexpected cool effect of static inline functions (copy of my email): https://mail.python.org/pipermail/python-dev/2018-November/155747.html Le jeu. 15 nov. 2018 à 01:06, Gregory P. Smith a écrit : > I expect the largest visible impact may be that a profiler

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
STINNER Victor added the comment: I ran a coarse benchmark on the debug mode using PR 10669: I ran the full Python test suite. => I don't see any significant impact on performance. * C macros: PR 10669 * static inline functions: commit 3bb183d7fb83ad6a84ec13dea90f95d67be35c69 (PR 10669

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
STINNER Victor added the comment: New changeset e89607c0fc8d6edbf19c06ba42ff0f00e6c4273f by Victor Stinner in branch 'master': bpo-35059: NEWS entry for macros converted to inline funcs (GH-10671) https://github.com/python/cpython/commit/e89607c0fc8d6edbf19c06ba42ff0f00e6c4273f --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
STINNER Victor added the comment: I wrote a pull request to replace static inline functions with C macros: PR 10669. I ran a benchmark on speed.python.org server using the "performance" benchmark suite: http://pyperformance.readthedocs.io/ I understand that from the benchmark results that

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9925 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-23 Thread STINNER Victor
Change by STINNER Victor : Added file: https://bugs.python.org/file47943/2018-11-22_17-38-master-3bb183d7fb83-patch-10669.json.gz ___ Python tracker ___

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-22 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9922 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-22 Thread STINNER Victor
STINNER Victor added the comment: New changeset a42de742e7c20eeb64699b5785543fea65b2e8d3 by Victor Stinner in branch 'master': bpo-35059: Cast void* to PyObject* (GH-10650) https://github.com/python/cpython/commit/a42de742e7c20eeb64699b5785543fea65b2e8d3 --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-22 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9904 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9903 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
STINNER Victor added the comment: New changeset b37672daf61740fe1ff9d805f6d74bc5ef04012b by Victor Stinner in branch 'master': bpo-35059: Cleanup usage of Python macros (GH-10648) https://github.com/python/cpython/commit/b37672daf61740fe1ff9d805f6d74bc5ef04012b --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9902 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9901 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
STINNER Victor added the comment: New changeset 2ff8fb7639a86757c00a7cbbe7da418fffec3870 by Victor Stinner in branch 'master': bpo-35059: Add _PyObject_CAST() macro (GH-10645) https://github.com/python/cpython/commit/2ff8fb7639a86757c00a7cbbe7da418fffec3870 --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9900 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
STINNER Victor added the comment: New changeset 271753a27aca2e13275f0827080b915fb438107a by Victor Stinner in branch 'master': bpo-35059: Convert _PyObject_GC_TRACK() to inline function (GH-10643) https://github.com/python/cpython/commit/271753a27aca2e13275f0827080b915fb438107a --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9897, 9898, 9899 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9897 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9897, 9898 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
STINNER Victor added the comment: New changeset f1d002c1e094922b0f17a820f90ff102d68ab253 by Victor Stinner in branch 'master': bpo-35059: Enhance _PyObject_AssertFailed() (GH-10642) https://github.com/python/cpython/commit/f1d002c1e094922b0f17a820f90ff102d68ab253 --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9894, 9895 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9894 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-21 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9894, 9895, 9896 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-13 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-35230: "Remove _Py_REF_DEBUG_COMMA". -- ___ Python tracker ___ ___ Python-bugs-list

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-11-09 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I am collecting information on how different compilers behave with the `static inline`. I am checking the following compilers: ARM GCC AVR GCC CLANG X86_64 CLANG RISC-V ELLCC GCC X86_64 ICC x86_64 MIPS GCC MSP GCC POWERPC GCC AIX Compiler (xlc) SunPro

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-31 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9589 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-31 Thread Eric Snow
Change by Eric Snow : -- nosy: +eric.snow ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-30 Thread STINNER Victor
STINNER Victor added the comment: New changeset 3c09dca4b5de9fe8c8756251d02f49cf093b88c1 by Victor Stinner in branch 'master': bpo-35059: Convert _Py_Dealloc() to static inline function (GH-10223) https://github.com/python/cpython/commit/3c09dca4b5de9fe8c8756251d02f49cf093b88c1 --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-29 Thread STINNER Victor
STINNER Victor added the comment: New changeset 541497e6197268517b0d492856027774c43e0949 by Victor Stinner in branch 'master': bpo-35059: Convert Py_XINCREF() to static inline function (GH-10224) https://github.com/python/cpython/commit/541497e6197268517b0d492856027774c43e0949 --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-29 Thread STINNER Victor
STINNER Victor added the comment: TODO: Convert _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() macros to static inline functions, but there are inter-dependencies issues: see bpo-35081 and https://mail.python.org/pipermail/python-dev/2018-October/155592.html --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-29 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9538 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-29 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9537 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-29 Thread STINNER Victor
STINNER Victor added the comment: > bpo-35059: Remove Py_STATIC_INLINE() macro (GH-10216) Here you have Benjamin, it's gone :-) -- ___ Python tracker ___

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-29 Thread STINNER Victor
STINNER Victor added the comment: New changeset 542497aa9f71c664768c3d5b7398c03679d3a7e1 by Victor Stinner in branch 'master': bpo-35059: Remove Py_STATIC_INLINE() macro (GH-10216) https://github.com/python/cpython/commit/542497aa9f71c664768c3d5b7398c03679d3a7e1 --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-29 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9532 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-29 Thread STINNER Victor
STINNER Victor added the comment: New changeset 2aaf0c12041bcaadd7f2cc5a54450eefd7a6ff12 by Victor Stinner in branch 'master': bpo-35059: Convert Py_INCREF() to static inline function (GH-10079) https://github.com/python/cpython/commit/2aaf0c12041bcaadd7f2cc5a54450eefd7a6ff12 --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-28 Thread STINNER Victor
STINNER Victor added the comment: If my PR 10079 is merged without Py_STATIC_INLINE(), I will remove the macro. I'm not sure if we need an "always inline" macro or not. Note: I'm in favor of moving closer to the C language and not abusing __attribute__(...) :-) --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-28 Thread STINNER Victor
STINNER Victor added the comment: >> Py_STATIC_INLINE() is designed to replace a preprocessor macro with a >> function, when you care that the code is "always inlined". (Maybe the >> name is not perfect ;-)) > > "always inline" is different from "static inline". So, it's not appropriate >

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-28 Thread STINNER Victor
STINNER Victor added the comment: > I would like to see Py_LOCAL_INLINE removed, too, fwiw. Oh. Why? Do you want to directly use "static" and "static inline"? I guess that Py_LOCAL and Py_LOCAL_INLINE have been added to use __fastcall with MSVC. ... __fastcall is mostly interesting in x86

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-28 Thread Benjamin Peterson
Benjamin Peterson added the comment: On Fri, Oct 26, 2018, at 03:18, STINNER Victor wrote: > > STINNER Victor added the comment: > > Benjamin: > > Why do we need this Py_STATIC_INLINE macro? If you want to have one for > > enabling always inline, that's fine with me, since it's

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-35081: "Rename Include/internals/ to Include/pycore/" which is linked to this issue. -- ___ Python tracker ___

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread miss-islington
miss-islington added the comment: New changeset 7eac88afd2e39d05a0ed3bc8c0787a2e755a6072 by Miss Islington (bot) in branch '3.6': bpo-35059, libmpdec: Add missing EXTINLINE in mpdecimal.h (GH-10128) https://github.com/python/cpython/commit/7eac88afd2e39d05a0ed3bc8c0787a2e755a6072

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread miss-islington
miss-islington added the comment: New changeset 95cfb818eaffba41333d4bc93253f4e0c6237ca8 by Miss Islington (bot) in branch '3.7': bpo-35059, libmpdec: Add missing EXTINLINE in mpdecimal.h (GH-10128) https://github.com/python/cpython/commit/95cfb818eaffba41333d4bc93253f4e0c6237ca8

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread miss-islington
Change by miss-islington : -- pull_requests: +9466 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread miss-islington
Change by miss-islington : -- pull_requests: +9465 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread STINNER Victor
STINNER Victor added the comment: > Too bad: this change broke the compilation on AMD64 Windows7 SP1 3.x, AMD64 > Windows8 3.x and AMD64 Windows10 3.x: (...) I checked buildbots: my PR 10128 fixed all Windows buildbots, good. -- ___ Python

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread STINNER Victor
STINNER Victor added the comment: New changeset 3b1cba3701fd1321a9bdafa9e683f891369f0cfd by Victor Stinner in branch 'master': bpo-35059, libmpdec: Add missing EXTINLINE in mpdecimal.h (GH-10128) https://github.com/python/cpython/commit/3b1cba3701fd1321a9bdafa9e683f891369f0cfd --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9460 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread STINNER Victor
STINNER Victor added the comment: > bpo-35059, PCbuild: Expand inline funcs in Debug (GH-10094) > https://github.com/python/cpython/commit/a05bef4f5be1bcd0df63ec0eb88b64fdde593a86 Too bad: this change broke the compilation on AMD64 Windows7 SP1 3.x, AMD64 Windows8 3.x and AMD64 Windows10

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9459 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread STINNER Victor
STINNER Victor added the comment: New changeset a05bef4f5be1bcd0df63ec0eb88b64fdde593a86 by Victor Stinner in branch 'master': bpo-35059, PCbuild: Expand inline funcs in Debug (GH-10094) https://github.com/python/cpython/commit/a05bef4f5be1bcd0df63ec0eb88b64fdde593a86 --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread STINNER Victor
STINNER Victor added the comment: New changeset b4435e20a92af474f117b78b98ddc6f515363af5 by Victor Stinner in branch 'master': bpo-35059: Convert PyObject_INIT() to function (GH-10077) https://github.com/python/cpython/commit/b4435e20a92af474f117b78b98ddc6f515363af5 --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread STINNER Victor
STINNER Victor added the comment: Benjamin: > Why do we need this Py_STATIC_INLINE macro? If you want to have one for > enabling always inline, that's fine with me, since it's compiler-specific. For about the name, there is already Py_LOCAL_INLINE which also uses "static inline", but has a

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-26 Thread Benjamin Peterson
Benjamin Peterson added the comment: Why do we need this Py_STATIC_INLINE macro? If you want to have one for enabling always inline, that's fine with me, since it's compiler-specific. But the current Py_STATIC_INLINE macro seems to conflate linkage with always-inline behavior. --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-25 Thread STINNER Victor
STINNER Victor added the comment: New changeset 18618e652c56e61a134e596b315a13c7cb997a89 by Victor Stinner in branch 'master': bpo-35059: Add Py_STATIC_INLINE() macro (GH-10093) https://github.com/python/cpython/commit/18618e652c56e61a134e596b315a13c7cb997a89 --

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-25 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9427 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-25 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +9426 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-25 Thread STINNER Victor
STINNER Victor added the comment: Interesting article on inline/static inline and symbols: https://gist.github.com/htfy96/50308afc11678d2e3766a36aa60d5f75 -- ___ Python tracker

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-25 Thread STINNER Victor
STINNER Victor added the comment: > Is it guarantied that static inline functions will be inlined and will be not > called as external functions from the Python library? The latter would break > binary compatibility of extensions compiled with newer Python headers with > older binary Python

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-25 Thread STINNER Victor
STINNER Victor added the comment: > Is it guarantied that static inline functions will be inlined and will be not > called as external functions from the Python library? The latter would break > binary compatibility of extensions compiled with newer Python headers with > older binary Python

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Is it guarantied that static inline functions will be inlined and will be not called as external functions from the Python library? The latter would break binary compatibility of extensions compiled with newer Python headers with older binary Python

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-25 Thread STINNER Victor
STINNER Victor added the comment: Ok, I confirm that Py_XINCREF() is properly inlined in Py_IncRef() with the latest version of my PR 10079. I tested: * gcc -O0 * clang -O0 * MSVC: x64 build in Debug mode -- ___ Python tracker

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-25 Thread STINNER Victor
STINNER Victor added the comment: On Windows, a Debug build doesn't inline Py_INCREF/DECREF even if it uses __forceinline. I looked at the Py_IncRef() and Py_DecRef() assembly in Visual Studio using a breakpoint. Using /Ob1, Py_INCREF/DECREF are inlined as expected. I set this option in the

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-25 Thread STINNER Victor
STINNER Victor added the comment: I modified PR 10079 to add a Py_STATIC_INLINE(TYPE) macro: * Use __attribute__((always_inline)) with GCC and clang * Use __forceinline with MSVC Tests on Linux, example: "./configure --with-pydebug CC=clang CFLAGS="-O0" && make clean && make platform" *

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-25 Thread శ్రీనివాస్ రెడ్డి తాటిపర్తి
Change by Srinivas Reddy Thatiparthy(శ్రీనివాస్ రెడ్డి తాటిపర్తి) : -- nosy: +thatiparthy ___ Python tracker ___ ___

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-25 Thread STINNER Victor
STINNER Victor added the comment: I tested PR 10079 using gdb on Fedora 28 with GCC 8.1.1 to check if Py_INCREF/Py_DECREF functions are inlined. I understand that "static inline void Py_INCREF()" is *not* inline by gcc -O0, but it *is* inlined using gcc -Og which is the *default*

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-24 Thread Benjamin Peterson
Benjamin Peterson added the comment: Does this slow down debug builds at all? It probably will not end will if Py_INCREF is ever not inlined. -- nosy: +benjamin.peterson ___ Python tracker

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-24 Thread Aaron Hall
Change by Aaron Hall : -- nosy: +Aaron Hall ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-24 Thread STINNER Victor
STINNER Victor added the comment: Context: I was unhappy with _Py_NewReference() macro implementation when I had to modify it to fix a bug, bpo-35053. That's why I would like to convert it to a static inline function. -- ___ Python tracker

[issue35059] Convert Py_INCREF() and PyObject_INIT() to inlined functions

2018-10-24 Thread STINNER Victor
Change by STINNER Victor : -- title: Convert PyObject_INIT() and _Py_NewReference() to inlined functions -> Convert Py_INCREF() and PyObject_INIT() to inlined functions ___ Python tracker