RFR: 8342458: More consistent constant instruction handling
Adam Sotona
asotona at openjdk.org
Thu Oct 31 07:32:28 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.
Looks good to me.
-------------
Marked as reviewed by asotona (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/21743#pullrequestreview-2407172677
More information about the core-libs-dev
mailing list