summaryrefslogtreecommitdiff
path: root/tools/cpp-define-generator
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2021-12-01 17:09:08 +0000
committer David Srbecky <dsrbecky@google.com> 2022-01-15 22:04:52 +0000
commitfa40e6e318b21d4a1885a6ffea6efc3c0b5cc1cd (patch)
treeea74f6947c5c6caaaf7a6fb3ece3369aec3a62c3 /tools/cpp-define-generator
parentc5f41cd1a39472dbe2480c09a1ce20aeced2a9f6 (diff)
Add thread-shared interpreter cache
The thread-local interpreter cache handles around 75% of method/field lookups from the interpreter. Add thread-shared interpreter cache which can be much bigger (since we pay the memory just once rather then per thread). This increases the cache hit rate to 90%. This effectively halves the amount of time we spend in 'NterpGetMethod' (including DexCache lookups), which is the single most expensive method during startup. Furthermore, it also reduces the amount of time we spend resolving methods by around 25% since DexCache entries get evicted less often. The shared cache increases memory use by 256k per process, so also reduce the fixed-size DexCache fields array, which balances it back. Test: test.py --host Change-Id: I3cd369613d47de117ab69d5bee00d4cf89b87913
Diffstat (limited to 'tools/cpp-define-generator')
-rw-r--r--tools/cpp-define-generator/thread.def7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/cpp-define-generator/thread.def b/tools/cpp-define-generator/thread.def
index ec8e28b977..07ca8841f8 100644
--- a/tools/cpp-define-generator/thread.def
+++ b/tools/cpp-define-generator/thread.def
@@ -30,11 +30,12 @@ ASM_DEFINE(THREAD_ID_OFFSET,
ASM_DEFINE(THREAD_INTERPRETER_CACHE_OFFSET,
art::Thread::InterpreterCacheOffset<art::kRuntimePointerSize>().Int32Value())
ASM_DEFINE(THREAD_INTERPRETER_CACHE_SIZE_LOG2,
- art::Thread::InterpreterCacheSizeLog2())
+ art::WhichPowerOf2(art::InterpreterCache::kThreadLocalSize))
ASM_DEFINE(THREAD_INTERPRETER_CACHE_SIZE_MASK,
- (sizeof(art::InterpreterCache::Entry) * (art::InterpreterCache::kSize - 1)))
+ (sizeof(art::InterpreterCache::Entry) * (art::InterpreterCache::kThreadLocalSize - 1)))
ASM_DEFINE(THREAD_INTERPRETER_CACHE_SIZE_SHIFT,
- 2)
+ (art::WhichPowerOf2(sizeof(art::InterpreterCache::Entry)) -
+ art::InterpreterCache::kHashShift))
ASM_DEFINE(THREAD_IS_GC_MARKING_OFFSET,
art::Thread::IsGcMarkingOffset<art::kRuntimePointerSize>().Int32Value())
ASM_DEFINE(THREAD_LOCAL_ALLOC_STACK_END_OFFSET,