RFR: 8330851: C2: More efficient TypeFunc creation [v5]

Vladimir Ivanov vlivanov at openjdk.org
Thu Jan 9 05:45:08 UTC 2025


On Tue, 24 Dec 2024 05:52:39 GMT, Amit Kumar <amitkumar at openjdk.org> wrote:

>> src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp line 438:
>> 
>>> 436: 
>>> 437: const TypeFunc* ShenandoahBarrierSetC2::write_ref_field_pre_Type() {
>>> 438:   return OptoRuntime::write_ref_field_pre_Type();
>> 
>> Please, keep them local to `ShenandoahBarrierSetC2`. Otherwise, you need to guard it with `INCLUDE_SHENANDOAHGC` there.
>
>> Otherwise, you need to guard it with INCLUDE_SHENANDOAHGC there.
> 
> @iwanowww Should I do this ? Because at least we have to have make a call, initialization call, from shared space otherwise we can't cache it. 
> 
> I can do some refactoring and that first call I can guard with `INCLUDE_SHENANDOAHGC`

Good point. 

I still think it's cleaner to keep type factories local (including `BarrierSetC2::clone_type()`). GC interface could provide an API point to call from `Type::Initialize_shared()` to trigger GC-specific initialization. 

If it turns out to be too cumbersome to implement, I'd just leave GC-specific code intact and handle it as a separate RFE. `OptoRuntime` changes already justify the enhancement and look good to me.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21782#discussion_r1906013441


More information about the hotspot-compiler-dev mailing list