-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SharedCache] Use m_exportInfos
as an export list cache
#6197
base: dev
Are you sure you want to change the base?
Commits on Nov 25, 2024
-
[SharedCache] Use
m_exportInfos
as an export list cache`SharedCache::ParseExportTrie` is getting called a lot during DSC library loading and analysis. In large part due to the hot path `SharedCache::FindSymbolAtAddrAndApplyToAddr`. Its unnecessary for it to be being called more than once per DSC header as the export list symbol information is stored in `SharedCache::m_exportInfos`. This commit adds the function `SharedCache::GetExportListForHeader`, which will either return the header's list of symbol information cached in `SharedCache::m_exportInfos` or call `SharedCache::ParseExportTrie` and cache the results in `SharedCache::m_exportInfos`. This should also improve the execution time of `SharedCache::LoadAllSymbolsAndWait`. Further improvement here would be to add locking to `SharedCache::GetExportListForHeader` so that races don't result in redundant parsing of the export trie for the same header if multiple threads call `SharedCache::GetExportListForHeader` at the same time for the same header. This only really matters during initial loading because from what I can tell that parses all the export trie's anyway.
WeiN76LQh authored and WeiN76LQh committedNov 25, 2024 Configuration menu - View commit details
-
Copy full SHA for b7ccf06 - Browse repository at this point
Copy the full SHA b7ccf06View commit details
Commits on Nov 26, 2024
-
[SharedCache] Add parameter to
SharedCache::InitializeHeader
to che……ck if `m_exportInfos` was modified This probably makes more sense than the current solution of using execution of the callback parameter to determine if `m_exportInfos` was modified.
WeiN76LQh authored and WeiN76LQh committedNov 26, 2024 Configuration menu - View commit details
-
Copy full SHA for 64174ee - Browse repository at this point
Copy the full SHA 64174eeView commit details -
[SharedCache] Improve the types for
m_exportInfos
This commit changes 2 things; 1. `m_exportInfos` is now a map where its values are also a map rather than a vector of pairs. The reason for this is that `SharedCache::FindSymbolAtAddrAndApplyToAddr` is a hot path which does by far the most accesses to `m_exportInfos`. In that function it must find the correct symbol for a given address so a map lookup will be much quicker than iterating a vector. The other use cases of `m_exportInfos` would prefer a vector but they are executed very infrequently. 2. The symbols are stored in `m_exportInfos` as references to the `Symbol` type. This makes more sense because otherwise there is a lot of time spent converting to and from a `Symbol` type and a pair of `BNSymbolType` + a `std::string`.
WeiN76LQh authored and WeiN76LQh committedNov 26, 2024 Configuration menu - View commit details
-
Copy full SHA for 6edb250 - Browse repository at this point
Copy the full SHA 6edb250View commit details -
[SharedCache] Only setup undo actions and bulk modify in `SharedCache…
…::FindSymbolAtAddrAndApplyToAddr` if a symbol is found
WeiN76LQh authored and WeiN76LQh committedNov 26, 2024 Configuration menu - View commit details
-
Copy full SHA for 9e7d6e2 - Browse repository at this point
Copy the full SHA 9e7d6e2View commit details -
[SharedCache] Make
m_exportInfos
map's values ashared_ptr
This avoids expensive copying when returning a value from the map in `SharedCache::GetExportListForHeader`. Additionally it ensures that the value stays alive and at the same location in memory if `m_exportInfos` is modified and requires its storage to be re-allocated. I was unable to use a `unique_ptr` instead of a `shared_ptr` because of copy semantics with `m_exportInfos` in `ViewStateCacheStore`. I don't see things being any worse using `shared_ptr` instead of `unique_ptr` anyway and it means less code changes.
WeiN76LQh authored and WeiN76LQh committedNov 26, 2024 Configuration menu - View commit details
-
Copy full SHA for 202a792 - Browse repository at this point
Copy the full SHA 202a792View commit details -
[SharedCache] Remove commenting out of line from debugging
WeiN76LQh authored and WeiN76LQh committedNov 26, 2024 Configuration menu - View commit details
-
Copy full SHA for c83ec00 - Browse repository at this point
Copy the full SHA c83ec00View commit details