RFR: 8340587: Optimize StackMapGenerator$Frame::checkAssignableTo
Chen Liang
liach at openjdk.org
Mon Sep 23 02:14:20 UTC 2024
On Sun, 22 Sep 2024 13:20:01 GMT, Shaojin Wen <swen at openjdk.org> wrote:
> Optimize checkAssignableTo to avoid clone when stackSize is 0, and use clone instead of Array.copyOf to avoid compression and then expansion
src/java.base/share/classes/jdk/internal/classfile/impl/StackMapGenerator.java line 1102:
> 1100: target.localsSize = localsSize;
> 1101: if (stackSize > 0) {
> 1102: target.stack = Arrays.copyOf(stack, stackSize);
Do you think we should use `.clone()` to avoid `getClass` checks and to avoid extra array growing in case the new stack/local immediately grows due to instructions after target?
Also I think you can do `localsSize > 0` check for locals assignment too.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21121#discussion_r1770557300
More information about the core-libs-dev
mailing list