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

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Oct 26 10:14:08 UTC 2023


On Thu, 26 Oct 2023 03:19:54 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`?

This turned out to be a very good suggestion, thanks! While doing it, I realized that we already had a method (`Types::constantType`) to get the `Type` of a constant, so the new method I added to `LoadableConstant` is not really required (and I have now removed it).

In the end I left the names as they are, beacuse, while confusing, when looking at `emitOp` they kind of make sense - e.g. 1/2 is used to denote the number of operand bytes. So at least it's self-consistent :-)

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

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


More information about the compiler-dev mailing list