Introduce address based index to ELF symbol table cache #939
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So far our symbol table cache had the symbols mapped into memory and then sorted references to them by the respective symbol's address, in a heap allocated array. This is conceptually fine, but it is an approach that is incompatible with future changes.
This change reworks the SymbolTableCache type as follows: 1) we to store the memory mapped symbols as-is; that is, we keep an
(unsorted) slice of the symbols around
2) we then build an additional index that is sorted by address on top of
that
In so doing we eliminate the need for keeping unnecessary references to the memory mapped data around. Further more, we could optimize the (heap allocated) index further, by using a smaller index size when the number of symbols is below certain maxima. Third, because symbol filtering now happens inside SymbolTableCache, we remove the duplication for filtering and sorting symbols for 32 and 64 bit, respectively. Lastly, because we no longer heap allocate an array of references, we can ditch the ElfN_BoxedSyms type, which was arguably a weird special case to have, entirely.