On Thu, 16 Feb 2023 12:55:06 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

>> Adam Sotona has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   added 4-byte Unicode text to Utf8EntryTest
>
> src/java.base/share/classes/jdk/internal/classfile/impl/SplitConstantPool.java
>  line 217:
> 
>> 215:                 }
>> 216:             };
>> 217:             // Doing a full scan here yields fall-off-the-cliff 
>> performance results,
> 
> Understanding checkpoint: the parent is a class reader, which holds some 
> class bytes. The class reader is set up in a way that constant pool entries 
> are read "on-demand" - that is, if I ask the class reader "give me CP entry 
> 42", the classreader will only build that entry (assuming 42 is a valid 
> index) and give me back that entry. Also, the class reader will save the read 
> constant in an internal array, to avoid re-reading the classfile bytes 
> multiple times.
> 
> So, what this code here does is: when we create an entry map, we populate the 
> map with the entries from the parent reader - but we only add entries that 
> were already looked up (e.g. we do not bother reading _all_ entries, and 
> adding all of them to the entry map).
> 
> But, when `findEntry` is called, if we see that we can't find the entry, and 
> we know that there might be constant pool entries from the parent reader 
> still unread, we force a full scan of the parent reader pool and try again.
> 
> Correct?

Right, it is a multi-stage inflation, where partial-only inflation improves 
performance of frequent use cases significantly and full scan is a fall-back.

-------------

PR: https://git.openjdk.org/jdk/pull/10982

Reply via email to