RFR: 8370405: C2: mismatched store from MergeStores wrongly scalarized in allocation elimination [v2]

Doug Simon dnsimon at openjdk.org
Thu Oct 30 07:59:05 UTC 2025


On Wed, 29 Oct 2025 14:29:54 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> This is to support Truffle where `long` and `double` fields can be encoded in `int[]` arrays. It's a bit like https://bugs.openjdk.org/browse/JDK-8231756 where fields are encoded in `byte[]` arrays. @tkrodriguez or @woess can you please confirm we still need this.
>
> @dougxc @tkrodriguez @woess Can we guard some of the logic in `#if INCLUDE_JVMCI` though?

Yes, guarding this with `#if INCLUDE_JVMCI` is fine.

More background thanks to @woess:

This is [just how we encode long/double constants in an int array in the debug info](https://github.com/oracle/graal/blob/4cc7e42d1422e8502172d599216d7a0b6d263d52/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/core/gen/DebugInfoBuilder.java#L167). While for the `byte[]` case, we put illegal/marker values in the remaining slots, for the `int[]` case we put a int 0 constant into the second slot, when we store a long constant + illegal pair. In the debug info, this is reversed so that the second slot is actually [the low part](https://github.com/openjdk/jdk/blob/17fd801b24162dfbac6d4e63ef5048a0fb146074/src/hotspot/share/runtime/deoptimization.cpp#L1396), i.e. the long constant, and the first slot would then contain the int 0 constant (as checked by `sv->field_at(i)->is_constant_int()`). The illegal marker (added [here](https://github.com/openjdk/jdk/commit/12f8b52fb8b4741b5a0087223ca11c210a561038#diff-6de46252a64a081f101658db197dbe77ac35313688971c5aa51700aa0772c9e1R113)) could b
 e used instead to be consistent with what we do in the isVirtualByteArray case but changing that now probably isn’t worth it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27997#discussion_r2476745599


More information about the hotspot-compiler-dev mailing list