-
Notifications
You must be signed in to change notification settings - Fork 571
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i#7113 decode cache: Add analyzer library for decode_cache_t (#7114)
Adds a new drmemtrace_decode_cache library to cache information about decoded instructions using decode_cache_t. This can be used by analysis tools that need to decode the instr encodings in the trace, to avoid overhead of redundant decodes which can get expensive, and also to avoid duplication of various related logic. The library allows the tools to decide what information they need to cache and add implementation for how to obtain it. Also, it uses instr_noalloc_t when possible to reduce heap usage and allocation/deallocation overhead. If the trace does not include embedded encodings or if the user wants to get encodings from the app binaries using module_mapper_t instead, they can provide the module file path to the init API on the decode_cache_t object. decode_cache_t keeps a single initialized module_mapper_t at any time, which is shared between all decode_cache_t objects (even the ones of different template types); this is done by tracking the count of active objects that use the module mapper. decode_cache_t provides the clear_cache() API which can be used in parallel_shard_exit() to keep memory consumption in check by freeing up cached decode info that may not be needed for result computation in later print_results() which has to wait until all shards are done. Refactors the invariant checker and opcode mix tools to use this library. Modifies add_encodings_to_memrefs to support a mode where encodings are not set in the generated test memrefs but only the instr addr and size fields are set. Makes the opcode cache in opcode_mix_t per-shard instead of per-worker. Decode info must not be cached per-worker as that may cause stale encodings for non-first shards processed by the worker. This means the worker init and worker exit APIs can be removed now from opcode_mix_t. Adds decode_cache_test and opcode_mix_test unit tests that verify operation of the decode_cache_t. Issue: #7113
- Loading branch information
1 parent
6549e88
commit 3c6c167
Showing
13 changed files
with
1,574 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.