RFR: 8369039: JDK-8348611 caused regression in Javac-Hot-Generate [v3]

Claes Redestad redestad at openjdk.org
Wed Oct 8 13:26:00 UTC 2025


On Wed, 8 Oct 2025 02:53:35 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Archie Cobbs has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Do more desugaring of Stream and Optional.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/LintMapper.java line 180:
> 
>> 178: 
>> 179:         final LintRange rootRange;                              // the root LintRange (covering the entire source file)
>> 180:         final List<Span> unmappedDecls = new LinkedList<>();    // unmapped top-level declarations awaiting attribution
> 
> LinkedList has a ton of nodes, which translate to extra object headers, forward/backward pointers, and worse cache locality. To add N items, it requires O(N) allocations. In contrast, ArrayList requires O(log(N)) allocations (resizing) and is almost always better.

@archiecobbs measured a win. I haven't seen it in profiles but it could be that the code in `afterAttr` contribute to the case for `LinkedList` as it is set up to remove matching item from the list, likely at an early index. Which is one of the few things a `LinkedList` actually does better than an `ArrayList`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27651#discussion_r2413851059


More information about the compiler-dev mailing list