Author vstinner
Recipients Aaron Hall, benjamin.peterson, mark.dickinson, serhiy.storchaka, thatiparthy, vstinner
Date 2018-10-25.11:29:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1540466969.92.0.788709270274.issue35059@psf.upfronthosting.co.za>
In-reply-to
Content
> 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 libraries.

Ok, I made more checks. In short, PR 10079 has no impact on the ABI compatibility.


I modified Py_STATIC_INLINE() to remove __attribute__((always_inline)).

In this case, the ./python binary contains multiple "instances" (what's the correct name for that?) of the "_Py_INCREF" inline function:
---
vstinner@apu$ readelf -sW ./python | c++filt -t |grep -E '(INC|DEC)REF'
    42: 000000000041f908    49 FUNC    LOCAL  DEFAULT   13 _Py_INCREF
    43: 000000000041f939   121 FUNC    LOCAL  DEFAULT   13 _Py_DECREF
   109: 00000000004234cb    49 FUNC    LOCAL  DEFAULT   13 _Py_INCREF
   ...
  5639: a486d    49 FUNC    LOCAL  DEFAULT   13 _Py_INCREF
  5786: a7abc    49 FUNC    LOCAL  DEFAULT   13 _Py_INCREF
  5801: a7f0f    49 FUNC    LOCAL  DEFAULT   13 _Py_INCREF
  ...
  8126: 00000000006011c5    49 FUNC    LOCAL  DEFAULT   13 _Py_INCREF
  8127: 00000000006011f6   121 FUNC    LOCAL  DEFAULT   13 _Py_DECREF
  8140: 0000000000601971    49 FUNC    LOCAL  DEFAULT   13 _Py_INCREF
  8141: 00000000006019a2   121 FUNC    LOCAL  DEFAULT   13 _Py_DECREF
  ...
---

These functions are *LOCAL*, I understand that they are not exported.


I also checked the _struct module:

vstinner@apu$ readelf -sW build/lib.linux-x86_64-3.8-pydebug/_struct.cpython-38dm-x86_64-linux-gnu.so | c++filt -t |grep -E '(INC|DEC)REF'
    40: 0000000000002e99    55 FUNC    LOCAL  DEFAULT   11 _Py_INCREF
    41: 0000000000002ed0   127 FUNC    LOCAL  DEFAULT   11 _Py_DECREF

Again, these functions are "LOCAL", not imported nor exported.

I undertand that _struct.so doesn't depend on libpython for INCREF/DECREF: it contains its own "implementation".
History
Date User Action Args
2018-10-25 11:29:29vstinnersetrecipients: + vstinner, mark.dickinson, benjamin.peterson, serhiy.storchaka, thatiparthy, Aaron Hall
2018-10-25 11:29:29vstinnersetmessageid: <1540466969.92.0.788709270274.issue35059@psf.upfronthosting.co.za>
2018-10-25 11:29:29vstinnerlinkissue35059 messages
2018-10-25 11:29:29vstinnercreate