#
c6799a68 |
| 27-Jul-2020 |
Rafael Auler <rafaelauler@fb.com> |
[BOLT] Fix stack alignment for runtime lib
Summary: Right now, the SAVE_ALL sequence executed upon entry of both of our runtime libs (hugify and instrumentation) will cause the stack to not be align
[BOLT] Fix stack alignment for runtime lib
Summary: Right now, the SAVE_ALL sequence executed upon entry of both of our runtime libs (hugify and instrumentation) will cause the stack to not be aligned at a 16B boundary because it saves 15 8-byte regs. Change the code sequence to adjust for that. The compiler may generate code that assumes the stack is aligned by using movaps instructions, which will crash.
(cherry picked from FBD22744307)
show more ...
|
#
9bd71615 |
| 02-May-2020 |
Xun Li <xun@fb.com> |
Adding automatic huge page support
Summary: This patch enables automated hugify for Bolt. When running Bolt against a binary with -hugify specified, Bolt will inject a call to a runtime library func
Adding automatic huge page support
Summary: This patch enables automated hugify for Bolt. When running Bolt against a binary with -hugify specified, Bolt will inject a call to a runtime library function at the entry of the binary. The runtime library calls madvise to map the hot code region into a 2M huge page. We support both new kernel with THP support and old kernels. For kernels with THP support we simply make a madvise call, while for old kernels, we first copy the code out, remap the memory with huge page, and then copy the code back. With this change, we no longer need to manually call into hugify_self and precompile it with --hot-text. Instead, we could simply combine --hugify option with existing optimizations, and at runtime it will automatically move hot code into 2M pages.
Some details around the changes made: 1. Add an command line option to support --hugify. --hugify will automatically turn on --hot-text to get the proper hot code symbols. However, running with both --hugify and --hot-text is not allowed, since --hot-text is used on binaries that has precompiled call to hugify_self, which contradicts with the purpose of --hugify. 2. Moved the common utility functions out of instr.cpp to common.h, which will also be used by hugify.cpp. Added a few new system calls definitions. 3. Added a new class that inherits RuntimeLibrary, and implemented the necessary emit and link logic for hugify. 4. Added a simple test for hugify.
(cherry picked from FBD21384529)
show more ...
|