RFR: 8331711: G1 doesn't need pre write barrier for stores from new allocated objects [v2]

Liang Mao lmao at openjdk.org
Wed May 8 06:13:53 UTC 2024


On Wed, 8 May 2024 05:30:04 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:

> I think that store capturing of initializing stores already removes most of the barriers of this category. We do that a bit later on. We find initializing stores onto newly allocated objects, and replace the store with barriers, with a store without barriers. That one usually elides a large portion of store barriers. Did you find any example where you have a newly allocated object with stores that are not initializing, hence not elided, which unnecessarily invoked a pre-write barrier, but not a post-write barrier? Just trying to find out what the problem space is, that this fixes.

Hi Erik,  I found examples not filtered by g1_can_remove_pre_barrier in testing. But I just did some statistics on SPECjbb2015 that if g1_can_remove_pre_barrier ran first it would elide most of the pre-barriers and "obj == kit->just_allocated_object"  only found very few remaining opportunities. If we run condition "obj == kit->just_allocated_object" first, it would cover ~30% opportunities. I think technically this PR should be correct but it's up to reviewers to decide if we practically need it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19098#discussion_r1593436110


More information about the hotspot-gc-dev mailing list