[clang] [compiler-rt] [XRay] Add support for instrumentation of DSOs on x86_64 (PR #90959)
Jan Patrick Lehr via cfe-commits
cfe-commits at lists.llvm.org
Fri May 3 12:26:01 PDT 2024
================
@@ -80,29 +140,14 @@ void __xray_init() XRAY_NEVER_INSTRUMENT {
return;
}
- {
- SpinMutexLock Guard(&XRayInstrMapMutex);
- XRayInstrMap.Sleds = __start_xray_instr_map;
- XRayInstrMap.Entries = __stop_xray_instr_map - __start_xray_instr_map;
- if (__start_xray_fn_idx != nullptr) {
- XRayInstrMap.SledsIndex = __start_xray_fn_idx;
- XRayInstrMap.Functions = __stop_xray_fn_idx - __start_xray_fn_idx;
- } else {
- size_t CountFunctions = 0;
- uint64_t LastFnAddr = 0;
-
- for (std::size_t I = 0; I < XRayInstrMap.Entries; I++) {
- const auto &Sled = XRayInstrMap.Sleds[I];
- const auto Function = Sled.function();
- if (Function != LastFnAddr) {
- CountFunctions++;
- LastFnAddr = Function;
- }
- }
+ atomic_store(&XRayNumObjects, 0, memory_order_release);
+
+ // Pre-allocation takes up approx. 5kB for XRayMaxObjects=64.
+ XRayInstrMaps = allocateBuffer<XRaySledMap>(XRayMaxObjects);
+
+ __xray_register_sleds(__start_xray_instr_map, __stop_xray_instr_map,
----------------
jplehr wrote:
Why is the return value not checked?
https://github.com/llvm/llvm-project/pull/90959
More information about the cfe-commits
mailing list