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

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Oct 25 23:52:41 UTC 2023

On Wed, 25 Oct 2023 18:10:40 GMT, Vicente Romero <vromero at openjdk.org> wrote:

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

I can - but, I realized when I wrote the patch that the naming of the constants is wrong. The JVMS only knows about these instructions:

* [ldc](https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.ldc)
* [ldc_w](https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.ldc_w)
* [ldc2_w](https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.ldc2_w)

While javac has `ldc`, `ldc2` and `ldc2_w`. So, I suspect javac's `ldc2` is really `ldc_w`. Should this be renamed too?


PR Comment: https://git.openjdk.org/jdk/pull/16367#issuecomment-1780208754

More information about the compiler-dev mailing list