RFR: 8313332: Simplify lazy jmethodID cache in InstanceKlass [v3]
Daniel D. Daugherty
dcubed at openjdk.org
Wed Apr 3 23:55:01 UTC 2024
On Wed, 3 Apr 2024 23:05:24 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> This change simplifies the code that grows the jmethodID cache in InstanceKlass. Instead of lazily, when there's a rare request for a jmethodID for an obsolete method, the jmethodID cache is grown during the RedefineClasses safepoint. The InstanceKlass's jmethodID cache is lazily allocated when there's a jmethodID allocated, so not every InstanceKlass has a cache, but the growth now only happens in a safepoint. This code will become racy with the potential change for deallocating jmethodIDs.
>>
>> Tested with tier1-4, vmTestbase/nsk/jvmti java/lang/instrument tests (in case they're not in tier1-4).
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix spacing and punctuation. make log_info into log_debug.
Thanks for the fixes. There are a couple that you missed.
src/hotspot/share/oops/instanceKlass.cpp line 2313:
> 2311: size_t size = idnum_allocated_count();
> 2312: assert(size > (size_t)idnum, "should already have space");
> 2313: jmeths = NEW_C_HEAP_ARRAY(jmethodID, size+1, mtClass);
nit: spaces around operator `+`
src/hotspot/share/oops/instanceKlass.cpp line 2346:
> 2344: // Allocate a larger one and copy entries to the new one.
> 2345: // They've already been updated to point to new methods where applicable (i.e., not obsolete).
> 2346: jmethodID* new_cache = NEW_C_HEAP_ARRAY(jmethodID, size+1, mtClass);
nit: spaces around operator `+`
-------------
Marked as reviewed by dcubed (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/18549#pullrequestreview-1978305784
PR Review Comment: https://git.openjdk.org/jdk/pull/18549#discussion_r1550653423
PR Review Comment: https://git.openjdk.org/jdk/pull/18549#discussion_r1550653504
More information about the serviceability-dev
mailing list