Add global DexFile cache.

System DEX files are likely to be loaded many times in system-wide
profiling (once per process).  Add cache to avoid the duplication.

This CL reduces the size of mapped DexFiles from 5GB to 1GB
in my local test run (perfetto system-wide profile).

Since each DEX file also has reasonably large PC to method lookup
table at ART side, this also reduces heap memory usage.
(from 10MB to 5MB in the same perfetto system-wide profile)

Since the creation of the ART method lookup table involves linear
scan of all methods, this also reduces initial CPU cost.

Test: libunwindstack_unit_test
Test: measure effect on system-wide profiling
Change-Id: I91d0987689601be6a888f91d835ecc87ca881ab9
2 files changed
tree: eabf6119f4db80bb13a7acbbc4515236c73da704
  1. libbacktrace/
  2. libunwindstack/
  3. Android.bp
  4. OWNERS
  5. PREUPLOAD.cfg