RFR: 8301997: Move method resolution information out of the cpCache [v2]
Andrew Dinn
adinn at openjdk.org
Thu Oct 19 07:48:53 UTC 2023
On Wed, 18 Oct 2023 19:06:20 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:
>> src/hotspot/share/oops/cpCache.cpp line 643:
>>
>>> 641: oop ConstantPoolCache::appendix_if_resolved(int method_index) const {
>>> 642: ResolvedMethodEntry* method_entry = resolved_method_entry_at(method_index);
>>> 643: if (!method_entry->has_appendix())
>>
>> If you move the rest of the code in this method into the a new method `ResolvedMethodEntry::appendix_if_resolved()` then you can call that method from here and also call it in places where you have already looked up the `ResolvedMethodEntry` but are still indirecting through the cache method using an `index`.
>
> ResolvedMethodEntry doesn't know about the constant pool or the cache, so that means it will be unable to call `constant_pool()->resolved_reference_at(ref_index);`. Maybe an alternate solution would be to overload `appendix_if_resolved` so that it can take either `int method_index` or `ResolvedMethodEntry* method_entry` as arguments.
Doh! Yes, of course. Overloading will allow the repeated lookup to be avoided.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15455#discussion_r1365058940
More information about the hotspot-dev
mailing list