]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-101282: Apply BOLT optimizations to libpython for shared builds (#104709)
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 22 May 2023 11:45:20 +0000 (04:45 -0700)
committerGitHub <noreply@github.com>
Mon, 22 May 2023 11:45:20 +0000 (13:45 +0200)
commit5360cb3d5608ab375de6cd8c0b408459f3fa953a
treed6256db9d1a0db997b881d26a2ed774f43bd5ff9
parent729b252241966f464cc46e176fb854dbcc5296cb
gh-101282: Apply BOLT optimizations to libpython for shared builds (#104709)

Apply BOLT optimizations to libpython for shared builds. Most of the C
code is in libpython so it is critical to apply BOLT there fully realize
BOLT benefits.

This change also reworks how BOLT instrumentation is applied. It
effectively removes the readelf based logic added in gh-101525 and
replaces it with a mechanism that saves a copy of the pre-bolt binary
and restores that copy when necessary. This allows us to perform BOLT
optimizations without having to manually delete the output binary to
force a new bolt run.

Also:
- add a clean-bolt target for purging BOLT files and hook that up to the
  clean target
- .gitignore BOLT related files

Before and after this refactor, `make` will no-op after a previous run.
Both versions should also share common make DAG deficiencies where
targets fail to trigger as often as they need to or can trigger
prematurely in certain scenarios. e.g. after this change you may need to
`rm profile-bolt-stamp` to force a BOLT run because there aren't
appropriate non-phony targets for BOLT's make target to depend on.

To make it easier to iterate on custom BOLT settings, the flags to pass
to instrumentation and application are now defined in configure and can
be overridden by passing BOLT_INSTRUMENT_FLAGS and BOLT_APPLY_FLAGS.
.gitignore
Doc/using/configure.rst
Makefile.pre.in
Misc/NEWS.d/next/Build/2023-05-20-16-09-59.gh-issue-101282.FvRARb.rst [new file with mode: 0644]
configure
configure.ac