Author vstinner
Recipients nascheme, serhiy.storchaka, vstinner
Date 2020-02-07.18:45:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1581101100.19.0.363291998073.issue39573@roundup.psfhosted.org>
In-reply-to
Content
> You have merged so much PRs today. What they do?

I merged changes which prepares CPython code base to make PyObject opaque. I only merged changes which should have no impact on performance, but prepare the API to make the structure opaque.

Right now, Py_SET_REFNCT() stills access directly to PyObject.ob_refcnt. But it becomes possible to make Py_SET_REFNCT() an opaque function call.

Do you see any issue with the changes that I already merged? Using PGO+LTO, static inline functions should be as efficient as the previous code using Py_REFCNT() & cie macros.


> PyObject cannot just be made an opaque structure. The user code reads and writes its fields directly and via macros. This change would break working code.

I'm trying to modifying the limited C API to make it possible: all access to PyObject fields should go through macros or function calls. The question is now how which fields are accessed and how.


> We can encourage the user code to prepare to making PyObject an opaque structure. We need to provide a stable C API for access of PyObject fields for this.

For the short term, I don't plan to make PyObject opaque, so I don't plan to enforce usage of Py_TYPE(), Py_SET_REFCNT(), etc.


> Note that there is a performance penalty of using functions instead of direct access, so you should have very good reasons to do this.

Yeah, replacing Py_REFCNT() macro with an opaque function call is likely to have an impact on performance. It should be properly measure, I'm well aware of that, I already wrote it in a previous comment ;-) I don't plan to push change such right now. And I will wait for the review of my peers (like you) for such change ;-)
History
Date User Action Args
2020-02-07 18:45:00vstinnersetrecipients: + vstinner, nascheme, serhiy.storchaka
2020-02-07 18:45:00vstinnersetmessageid: <1581101100.19.0.363291998073.issue39573@roundup.psfhosted.org>
2020-02-07 18:45:00vstinnerlinkissue39573 messages
2020-02-07 18:45:00vstinnercreate