Skip to content

Commit 8df86ac

Browse files
eduardo-vpEduardo VelardeCopilot
authored
Reduce contention in UnwindInfoTable seen during high volume LCG method creation (#128619)
Contributes to #123124. Changes: - Adds an initial code pointer to `m_DynamicCodePointers` in `LCGMethodResolver`. In most cases the list will contain exactly one pointer but if it starts empty, it does a chunk allocation while taking a lock. The initial pointer avoids that unnecessary chunk allocation for most cases. - Adds a publish and pending lock per unwind info table rather than using global locks. - Reduces contention on the publish lock as it's not mandatory for every thread to take the publish lock now. Instead, threads wait for the flusher thread to finish and if it already published its entries, just returns. Otherwise, attempts to become the flusher thread. Several threads never take the publish lock as that work is deferred to other threads. - Uses swaps to sort pending tables when their size is <= 4. - Removes entries using binary search instead of linear search. - Adds a registration failed flag to early-return in `AddToUnwindInfoTable` to avoid taking locks unnecessarily. --------- Co-authored-by: Eduardo Velarde <evelardepola@microsoft.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent d56ee0b commit 8df86ac

4 files changed

Lines changed: 268 additions & 64 deletions

File tree

0 commit comments

Comments
 (0)