RFR: 8338544: Dedicated Array class descriptor implementation

Chen Liang liach at openjdk.org
Wed Sep 25 18:54:03 UTC 2024


On Wed, 21 Aug 2024 20:25:07 GMT, Chen Liang <liach at openjdk.org> wrote:

> @cl4es discovered that Stack Map generation in ClassFile API uses `componentType` and `arrayType` for `aaload` `aastore` instructions, which are currently quite slow. We can split out array class descriptors from class or interfaces to support faster `arrayType` and `componentType` operations.
> 
> Tentative, as I currently have no way to measure the actual impact of this patch on the startup performance; however, this made the `ClassDesc` implementations much cleaner.

I know this requires a CSR; it's just not created due to this still being a draft.

The main purpose of this is still for speeding up stack map generation; the results are not confirmed yet, so this patch is on hold.

For megamorphic call site thing, the regular workload would be like:

if (c.isArray()) doArrayStuff(c);
if (c.isClassOrInterface()) doClassOrInterfaceStuff(c);

I think polymorphism is fine here, as after the check we usually go straight to perform type-specific operations like `componentType()`; or sometimes a method expects the input ClassDesc to be always primitive/class or interface/array, which won't lead to profile pollutions. This concern might be more valid for `descriptorString` I suppose.

Confirmed this is performance-wise neutral for startup. Ready for review.

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

PR Comment: https://git.openjdk.org/jdk/pull/20665#issuecomment-2313134513
PR Comment: https://git.openjdk.org/jdk/pull/20665#issuecomment-2374901141


More information about the core-libs-dev mailing list