RFR: 8318837: javac generates wrong ldc instruction for dynamic constant loads

Vicente Romero vromero at openjdk.org
Wed Oct 25 18:13:34 UTC 2023


On Wed, 25 Oct 2023 17:39:24 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> This PR fixes how javac loads dynamic variable symbols in `Gen` - currently, either a `ldc` or `ldc_w` is emitted. This is problematic, as, depending on the type of the dynamic constant, in some cases `ldc2_w` might be required (e.g. if the type of the constant is either `long` or `double`).
> 
> I've updated the existing compiler condy test to check which `ldc` opcode is emitted for the various constants. I've also verified that the updated test fails w/o the changes in this patch.

looks good

side: given that you are in the neighborhood :) does it make sense to fold the cases for: `ldc2w` and `ldc2` at: `Code::emitop2`?

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

Marked as reviewed by vromero (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/16367#pullrequestreview-1697963249
PR Comment: https://git.openjdk.org/jdk/pull/16367#issuecomment-1779800622


More information about the compiler-dev mailing list