RFR: 8341199: Use ClassFile's new API loadConstant(int)

David M. Lloyd duke at openjdk.org
Mon Sep 30 12:43:34 UTC 2024


On Mon, 30 Sep 2024 10:03:57 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> The new API loadConstant(int) can shorten the calling path and can replace ldc when the parameter is of int/Integer type.

I was also curious about a few other seemingly "obvious" small optimizations, like loading `-1L` as `iconst_m1; i2l` and a few other things like that. Some of these depend on whether you happen to already have a constant pool entry for a value, but some (like this example) are either equivalent or better (in size) under all circumstances.

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

PR Comment: https://git.openjdk.org/jdk/pull/21259#issuecomment-2383080027


More information about the core-libs-dev mailing list