RFR: 8357689: Refactor JVMCI to enable replay compilation in Graal
Andrej Pečimúth
duke at openjdk.org
Mon Jul 7 13:07:56 UTC 2025
On Tue, 27 May 2025 12:10:29 GMT, Doug Simon <dnsimon at openjdk.org> wrote:
>> This PR introduces a few minor JVMCI refactorings to make replay compilation possible in the Graal compiler.
>
> src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/BytecodeFrame.java line 397:
>
>> 395: * @return a copy of the slot kinds array
>> 396: */
>> 397: public JavaKind[] getSlotKinds() {
>
> Keep in mind that `slotKinds` is being [converted](https://github.com/openjdk/jdk/pull/25442/files#diff-43834727ed7dcd5128c10238ba56963c7d8feb66578b036c75dcf734bfa2ec92R80) to a List. In that context, can we return the list without making a copy? Or is the caller expected to be able to mutate the return value?
Applied the changes provided by @mur47x111.
> src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/VirtualObject.java line 325:
>
>> 323: * values have not been initialized.
>> 324: */
>> 325: public JavaKind[] getSlotKinds() {
>
> Same comments as for BytecodeFrame.getSlotKinds. This applies to all other non-primitive array return values added by this PR.
I left `Object[]` as the return value of `EncodedSpeculationReason#getReason` since the array could contain null elements, preventing the use of an immutable list like everywhere else.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25433#discussion_r2189993024
PR Review Comment: https://git.openjdk.org/jdk/pull/25433#discussion_r2190003945
More information about the graal-dev
mailing list