[issue38147] add macro for __builtin_unreachable

Sergey Fedoseev report at bugs.python.org
Thu Sep 19 11:27:43 EDT 2019


Sergey Fedoseev <fedoseev.sergey at gmail.com> added the comment:

> If you care of _PyLong_Copy() performance, you should somehow manually inline _PyLong_New() inside _PyLong_Copy().

It doesn't solve this:

> We could add a function that bypass that check, but in LTO build PyObject_MALLOC() is inlined into _PyLong_New() and it also checks the size. Adding Py_ASSUME((size_t)size <= MAX_LONG_DIGITS) allows to bypass both checks.

Here's example: https://github.com/sir-sigurd/cpython/commit/c8699d0c614a18d558216ae7d432107147c95c28.

I attach some disassembly from this example compiled with LTO, to demonstrate how the proposed macro affects generated code.

----------
Added file: https://bugs.python.org/file48614/disasm.txt

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38147>
_______________________________________


More information about the Python-bugs-list mailing list