RFR: 8356075: Support Shenandoah GC in JVMCI [v2]

Aleksey Shipilev shade at openjdk.org
Mon May 5 16:50:46 UTC 2025


On Mon, 5 May 2025 15:49:32 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

>> src/hotspot/share/gc/shenandoah/shenandoahRuntime.hpp line 42:
>> 
>>> 40:   static void pre_barrier(JavaThread* thread, oopDesc* orig) {
>>> 41:     write_ref_field_pre(orig, thread);
>>> 42:   }
>> 
>> So, why not export `write_ref_field_pre`, instead of introducing this new method? Style/cleanliness, or something else? I am asking, because every time we add a new stub here, we would need to record it in `AOTCache` tables for Leyden benefit.
>
> It's about the argument ordering. Graal expects the Thread* to be prependend, while other JITs call it with the Thread* appended. I guess we could change other JIT calls to also prepend the thread, or change the interface to not pass the Thread* at all. I chose to follow G1 and export both variants.

Oh, so this matches `JVMCIRuntime::write_barrier_pre` for G1 (weird place to have it, but oh well). 

Does Graal need the `Thread*` argument?

I think this method is only called when SATB buffer is full. So the performance of this method is likely not affected by getting the current thread down in caller. So I think it would be more straight-forward to sharpen `ShenandoahRuntime::write_ref_field_pre` by dropping `Thread*` and then exporting that. Maybe also under the `SR::write_barrier_pre` name to be even more consistent for everything else.

Maybe @JohnTortugo wants to clean up more mess in C2 related to this :)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25001#discussion_r2073800305


More information about the graal-dev mailing list