RFR: 8341028: Do not use lambdas or method refs for verifyConstantPool
Chen Liang
liach at openjdk.org
Thu Sep 26 13:44:36 UTC 2024
On Thu, 26 Sep 2024 13:30:07 GMT, David M. Lloyd <duke at openjdk.org> wrote:
> Currently, `ParserVerifier#verifyConstantPool` uses a `switch` to produce a `Runnable`, which is consumed by a `Consumer<Runnable>` (instantiated within a loop) which runs the task inside if a `try`/`catch`. We can eliminate a number of lambdas and method references, plus some allocation pressure, in this code by simplifying it so that the `switch` is itself run directly within the `try`/`catch`.
src/java.base/share/classes/jdk/internal/classfile/impl/verifier/ParserVerifier.java line 99:
> 97: imre.owner().asSymbol();
> 98: imre.typeSymbol();
> 99: verifyMethodName(imre.name().stringValue());
With the new try-catch, say if all lines end up erroneous, we will only get 1 error instead of 3 like before.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21209#discussion_r1777104036
More information about the core-libs-dev
mailing list