Integrated: 8342458: More consistent constant instruction handling

Chen Liang liach at openjdk.org
Thu Oct 31 14:03:37 UTC 2024


On Mon, 28 Oct 2024 15:29:33 GMT, Chen Liang <liach at openjdk.org> wrote:

> There are currently some issues with our handling of "load constant" instructions: namely, there is some problem with writing unbounded/external constants and handling of entry index changes, that we currently generate invalid bytecode for condy loading double/long that has index over 255.
> 
> This patch propose the following solution:
> 1. We write the instruction as-is, without changes, if we are writing a compatible constant pool entry, such as from shared-CP transformation or explicitly using CodeBuilder's constant pool + instruction factory.
> 2. Otherwise, we convert the instruction from/to ldc/ldc_w depends on if the instruction is encodable with ldc. ldc2_w can always be preserved by this rule.
> 
> Test changes verify the fix for the said condy issue and the intended adaption behaviors.

This pull request has now been integrated.

Changeset: 3ccd2f75
Author:    Chen Liang <liach at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/3ccd2f757d069c16147b331a90b1590c8ad4ae24
Stats:     154 lines in 3 files changed: 79 ins; 9 del; 66 mod

8342458: More consistent constant instruction handling

Reviewed-by: asotona

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

PR: https://git.openjdk.org/jdk/pull/21743


More information about the core-libs-dev mailing list