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

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Oct 25 17:45:45 UTC 2023


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.

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

Commit messages:
 - Initial push

Changes: https://git.openjdk.org/jdk/pull/16367/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16367&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8318837
  Stats: 35 lines in 3 files changed: 23 ins; 1 del; 11 mod
  Patch: https://git.openjdk.org/jdk/pull/16367.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16367/head:pull/16367

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


More information about the compiler-dev mailing list