On Thu, 16 Feb 2023 12:46:09 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 271:
> 
>> 269: 
>> 270:     private <E extends PoolEntry> E internalAdd(E cpi, int hash) {
>> 271:         int newIndex = size-parentSize;
> 
> I'm not sure I get this. The new entry is constructed with an index set to 
> the pool size. That said, when we build the entry we don't yet know if the 
> entry is already in the pool. The EntryMap data structure seems to have logic 
> to detect duplicates (e.g. adding an already added entry is a no-op) - but 
> this method seems to (a) add the CP entry to the `newEntries` array anyway 
> and (b) happily return the entry with the index set to the pool size (which 
> might, or might not, be the correct final index). What am I missing?

Nevermind - this method is only called if the entry is not found (using 
`findEntry`) :-)

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

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

Reply via email to