- Apr 22, 2021
-
-
Maksim Panchenko authored
(cherry picked from FBD27915725)
-
- Apr 18, 2021
-
-
Amir Ayupov authored
Summary: Addressing comments from the review for "Expand auto types". Use const reference in MCPlusBuilder for MCInstrDesc where the copy is not necessary. (cherry picked from FBD27844344)
-
- Apr 08, 2021
-
-
Amir Ayupov authored
Summary: Expanded auto types across BOLT semi-automatically with the aid of clangd LSP (cherry picked from FBD33289309)
-
Rafael Auler authored
Summary: We can't use a fragment of the old LibPath as an input to create a new one. (cherry picked from FBD27642728)
-
- Apr 07, 2021
-
-
Rafael Auler authored
Summary: We may have a CU with empty ranges, so accept errors coming from DWARFDie::getAddressRanges(). This happens when using tools that selectively strip debuginfo from the binary. (cherry picked from FBD27602731)
-
- Mar 19, 2021
-
-
Amir Ayupov authored
Summary: Refactor SectionPatches to avoid the use of extra map and a cast from StringRef to std::string. cherry-picked from FBD26756560 (cherry picked from FBD27490641)
-
- Mar 30, 2021
-
-
Amir Ayupov authored
Summary: The user may wish to run BOLT for printing statistics only (i.e. to check that the profile is valid). Add an option to run BOLT without writing any output file, similar to a dry run. This option is triggered by supplying -o with "/dev/null". (cherry picked from FBD29568632)
-
- Mar 24, 2021
-
-
Maksim Panchenko authored
Summary: During the initial indirect jump analysis, we used to assert that the discovered jump table type matched the pattern of the corresponding instruction sequence. E.g., for PIC jump table memory we expected the PIC jump table instruction sequence. The assertions were too conservative, as in the case of a mismatch we can mark the indirect jump as having an unknown control flow. That should be sufficient to either skip the function processing or rely on relocation information for possible recovery of the control flow. (cherry picked from FBD27255816)
-
- Mar 16, 2021
-
-
Rafael Auler authored
Summary: Fix a bug with instrumentation when trying to instrument functions that share a jump table with multiple indirect jumps. Usually, each indirect jump that uses a JT will have its own copy of it. When this does not happen, we need to duplicate the jump table safely, so we can split the edges correctly (each copy of the jump table may have different split edges). For this to happen, we need to correctly match the sequence of instructions that perform the indirect jump to identify the base address of the jump table and patch it to point to the new cloned JT. It was reported to us a case in which the compiler generated suboptimal code to do an indirect jump which our matcher failed to identify. Fixes facebookincubator/BOLT#126 (cherry picked from FBD27065579)
-
Maksim Panchenko authored
Summary: Whenever BOLT encounters a data reference in code, it tries to convert it into <Object+Offset> form. The primary reason behind this approach is to support read-only data-reordering optimization. However, with the current level of the linker and compiler support we don't have enough information to always correctly restore the original <Object+Offset>. E.g. with zero-sized symbols we have to speculate that the actual size of the underlying object extends to the next symbol. Most of the time, there will be an object pointed by a zero-sized symbol and even if we are guessing incorrectly, there will be no harm in creating references of such form. The problem happens when there's no object corresponding to the original symbol and the next object is an (unmarked) jump table: A: # <- zero-sized object .LJUMP_TABLE: .long <entry1> .long <entry2> .... .LB: .long 21 .LC: .long 42 The jump table will be moved and all references past it (up to the next named object) will be incorrectly updated. We should not speculate about the size of A in a case like that and treat all discovered data objects (and thus references) independently. (cherry picked from FBD27005660)
-
- Mar 10, 2021
-
-
Vladislav Khmelevsky authored
Summary: This PR introduces 2 new instrumentation options: 1. instrumentation-no-counters-clear: Discussed at https://github.com/facebookincubator/BOLT/issues/121 2. instrumentation-wait-forks: Since the instrumentation counters are mapped as MAP_SHARED it will be nice to add ability to wait until all forks of the parent process will die using tracking of process group. The last patch is just emitBinary code refactor. Vladislav Khmelevsky, Advanced Software Technology Lab, Huawei Pull Request resolved: https://github.com/facebookincubator/BOLT/pull/125 GitHub Author: Vladislav Khmelevskyi <Vladislav.Khmelevskyi@huawei.com> (cherry picked from FBD26919011)
-
- Mar 05, 2021
-
-
Maksim Panchenko authored
Summary: TBSS section is a "virtual" section that does not take memory or file space. Ignore it completely while adjusting section sizes. (cherry picked from FBD26824484)
-
- Feb 18, 2021
-
-
Vladislav Khmelevsky authored
Summary: NONE relocations should not be processed during dynamic relocations read process Vladislav Khmelevsky, Advanced Software Technology Lab, Huawei Pull Request resolved: https://github.com/facebookincubator/BOLT/pull/118 GitHub Author: Vladislav Khmelevsky <Vladislav.Khmelevskyi@huawei.com> (cherry picked from FBD26489881)
-
- Mar 18, 2021
-
-
Alexander Yermolovich authored
Summary: As titled. (cherry picked from FBD28112186)
-
Rafael Auler authored
Summary: As titled. (cherry picked from FBD28112137)
-
- Feb 18, 2021
-
-
Alexander Yermolovich authored
Summary: There is no real link between CU and TU, so relying on fact that address are the same, and we are updating all of them. (cherry picked from FBD28112114)
-
- Mar 16, 2021
-
-
Rafael Auler authored
Summary: Update license and fix headers for some files. (cherry picked from FBD28112041)
-
- Dec 02, 2020
-
-
Amir Ayupov authored
Summary: This commit is the first step in rebasing all of BOLT history in the LLVM monorepo. It also solves trivial build issues by updating BOLT codebase to use current LLVM. There is still work left in rebasing some BOLT features and in making sure everything is working as intended. History has been rewritten to put BOLT in the /bolt folder, as opposed to /tools/llvm-bolt. (cherry picked from FBD33289252)
-
- Jan 30, 2021
-
-
Alexander Shaposhnikov authored
Summary: Add support for reading profile on Mach-O. (cherry picked from FBD25777049)
-
- Jan 29, 2021
-
-
Alexander Shaposhnikov authored
Summary: Add support for dumping profile on MacOS. (cherry picked from FBD25751363)
-
Alexander Shaposhnikov authored
Summary: Add support for dumping counters on MacOS (cherry picked from FBD25750516)
-
Alexander Shaposhnikov authored
Summary: 1. Add support for __literal16 section in the instrumentation runtime library for MacOS. 2. Fix emitting __counters section. (cherry picked from FBD25746342)
-
- Jan 28, 2021
-
-
Sergey Pupyrev authored
Summary: a few minor updates in block reordering: - some refactoring to improve readability; - optimized chain splitting strategy to improve quality of layout and performance of the algorithm. (cherry picked from FBD25126220)
-
- Jan 21, 2021
-
-
Alexander Shaposhnikov authored
Summary: Enable intToStr et al. in the runtime library for MacOS. (cherry picked from FBD25745358)
-
Alexander Shaposhnikov authored
Summary: Use size_t for the first parameter of operator new. https://en.cppreference.com/w/cpp/memory/new/operator_new (cherry picked from FBD25750921)
-
- Jan 20, 2021
-
-
Amir Ayupov authored
(cherry picked from FBD25966797)
-
- Jan 11, 2021
-
-
Rafael Auler authored
Summary: When looking at perf.data's available binaries and their respective mmap'ed segments, match them with the input binary by looking at both aligned and non-aligned addresses. If we suppose the alignment is the mmap'ed page size, we may miss some cases and perf2bolt will refuse to proceed because it failed to match the input binary with a process recorded in perf.data. (cherry picked from FBD25732673)
-
- Dec 31, 2020
-
-
Rafael Auler authored
Summary: Add options for trading processing speed for binary performance. -lite-threshold-pct=<uint> Threshold (in percent) for selecting functions to process in lite mode. Higher threshold means fewer functions to process. E.g threshold of 90 means only top 10 percent of functions with profile will be processed. -lite-threshold-count=<uint> Similar to '-lite-threshold-pct' but specify threshold using absolute function call count. I.e. limit processing to functions executed at least the specified number of times. -no-scan Do not scan cold functions for external references (may result in slower binary). (cherry picked from FBD24739092)
-
- Dec 10, 2020
-
-
Rafael Auler authored
Summary: Test mistakenly used -debug output, which makes it fail on no-asserts build. (cherry picked from FBD25399449)
-
- Dec 04, 2020
-
-
Rafael Auler authored
Summary: This fixes a bug with shrink wrapping when trying to move push-pops in a function where we are not allowed to modify the stack layout for alignment reasons. In this bug, we failed to propagate alignment requirement upwards in the call graph from function A to B when: (1) there is a cycle in the call graph and (2) the distance from A to B is greater than 1 in the call graph and (3) there is a node in the path from A to B, not including A or B, that does not access parameters in the stack. (cherry picked from FBD25315977)
-
- Nov 20, 2020
-
-
Alexander Shaposhnikov authored
Summary: This diff is a preparation for dumping the profile generated by BOLT's instrumenation on MachO. 1/ Function "bolt_instr_fini" is placed into the predefined section "__fini" 2/ In the instrumentation pass we create a symbol "bolt_instr_fini" and replace the last global destructor with it. This is a temporary solution, in the future we need to register bolt_instr_fini in addition to the existing destructors without dropping the last one. (cherry picked from FBD25071864)
-
Alexander Shaposhnikov authored
Summary: Refactor syscall wrappers for OSX. (cherry picked from FBD25084642)
-
- Nov 18, 2020
-
-
Amir Ayupov authored
Summary: Fix corner case of insertion of updated CFI with unset `PrevBB`. Handle it in the same way as inserting past hot-cold split point. (cherry picked from FBD24943911)
-
Alexander Shaposhnikov authored
Summary: Link the instrumentation runtime on OSX. (cherry picked from FBD24390019)
-
- Nov 17, 2020
-
-
Maksim Panchenko authored
Summary: In BinaryContext::calculateEmittedSize(), after the temporary code emission, we have to perform a cleanup and mark all symbols used during the emission as undefined and unregistered (so that we can emit them again later). The cleanup is happening even for symbols that were referenced and not defined by emitted code. If all emitted symbols are local, there is no risk that one thread will define a symbol while some other thread will undefine it in its cleanup code. Such behavior is expected as local symbols can only be referenced within the containing function and each function is processed in one thread. However, secondary entry points have associated global symbols and if we emit them, then it is possible for a thread to undefine a symbol while the other thread had defined it and was in the process of emitting the fragment with it. In such case, a data race may happen and the thread that contains the definition of the symbol may define it twice causing a redefinition error. To avoid the data race, we skip the emission of secondary entry global symbols when emitting code used only for the size estimation. (cherry picked from FBD24986007)
-
- Nov 15, 2020
-
-
Sergey Pupyrev authored
Summary: A faster and better version of function reordering: - fixed a bug when some computed probabilities were negative; - changed an O(n^2) loop to a priority queue to find a candidate of chains to merge (cherry picked from FBD24571208)
-
- Nov 13, 2020
-
-
Amir Ayupov authored
Summary: Support jump tables belonging to split fragments with entries pointing back to parent functions. While skipping such families of functions, make sure to use the topmost fragment to ignore its fragments. (cherry picked from FBD24907438)
-
Amir Ayupov authored
Summary: In a jump table identification, register an invalid offset for jump table entries pointing to function fragments. These invalid offsets have no effect other than padding the jump table size, calculated as `max(OffsetEntries, Entries)`. Correct jump table size is required in strict mode (enabled by default in aggregation mode by `perf2bolt`) in accounting of all PC-relative relocations in data. Functions containing these jump tables with invalid offsets are marked to be ignored immediately afterwards in `populateJumpTables`. (cherry picked from FBD24897464)
-
Amir Ayupov authored
Summary: Added debug logging in/around `analyzeJumpTable`: - Dump jump table entries as they are being processed: ```BOLT-DEBUG: analyzeJumpTable in read_encoded_value_with_base/2(*2) * Checking 0x428ff40 -> OK: real entry * Checking 0x428ff44 -> OK: real entry * Checking 0x428ff48 -> OK: real entry * Checking 0x428ff4c -> OK: real entry * Checking 0x428ff50 -> OK: real entry * Checking 0x428ff54 -> OK: address in split fragment * Checking 0x428ff58 -> OK: address in split fragment * Checking 0x428ff5c -> OK: address in split fragment * Checking 0x428ff60 -> OK: address in split fragment * Checking 0x428ff64 -> OK: real entry * Checking 0x428ff68 -> OK: real entry * Checking 0x428ff6c -> OK: real entry * Checking 0x428ff70 -> OK: real entry BOLT-DEBUG: analyzeJumpTable in classify_object_over_fdes/1(*2) * Checking 0x428ff74 -> OK: real entry ... ``` - Dump skipped functions: ``` Skipping _ZNK6icu_676number4impl12RoundingImpl5applyERNS1_15DecimalQuantityER10UErrorCode.part.2/1(*2) family Ignoring _ZNK6icu_676number4impl12RoundingImpl5applyERNS1_15DecimalQuantityER10UErrorCode.part.2/1(*2) Ignoring _ZNK6icu_676number4impl12RoundingImpl5applyERNS1_15DecimalQuantityER10UErrorCode.part.2.cold.3/1(*2) Skipping _ZNK6icu_676number4impl12RoundingImpl5applyERNS1_15DecimalQuantityER10UErrorCode family Ignoring _ZNK6icu_676number4impl12RoundingImpl5applyERNS1_15DecimalQuantityER10UErrorCode Ignoring _ZNK6icu_676number4impl12RoundingImpl5applyERNS1_15DecimalQuantityER10UErrorCode.cold.4/1(*2) ``` - Dump values of unclaimed PC-relative relocations in data. (cherry picked from FBD24898172)
-
- Nov 11, 2020
-
-
Amir Ayupov authored
Summary: Minimized test case while preserving the CFG subgraph with an issue (cherry picked from FBD24871063)
-