RFR: 8338544: Dedicated Array class descriptor implementation

Jorn Vernee jvernee at openjdk.org
Fri Oct 4 19:50:37 UTC 2024


On Fri, 4 Oct 2024 18:24:37 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/constant/ArrayClassDescImpl.java line 116:
>> 
>>> 114:         sb.append(componentDesc);
>>> 115:         return sb.toString();
>>> 116:     }
>> 
>> Is there really that much benefit in lazily computing the descriptor? `ReferenceClassDescImpl` doesn't do this either... Maybe we can keep things simple and initialize the descriptor in the constructor?
>
> This laziness is actually the main reason I had this implementation: In stack map generation, we need to compute the array descriptors of many types yet not using them in the end; the string computation involved a lot of allocations, especially with frequent `arrayType()` and `componentType()` calls.

Ok, thanks. That's useful information.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20665#discussion_r1788238762


More information about the core-libs-dev mailing list