RFR: 8334060: Implementation of Late Barrier Expansion for G1 [v15]

Amit Kumar amitkumar at openjdk.org
Fri Sep 6 10:43:54 UTC 2024


On Fri, 6 Sep 2024 09:40:56 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

>> Sorry, one maybe dumb question, hopefully matching the context here:
>> Is this whole handling also required if those references point to instances of enums? Or could we do some further optimizations in such cases? Or is that exactly what C2 is doing afterwards?
>
>> Sorry, one maybe dumb question, hopefully matching the context here: Is this whole handling also required if those references point to instances of enums? Or could we do some further optimizations in such cases? Or is that exactly what C2 is doing afterwards?
> 
> Hi, do you mean whether G1 requires barriers when writing enum instances into object fields, as in `storeEnum` in this example?
> 
> 
>   (...)
> 
>   public enum Day {MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY};
> 
>   static class MyObject {
>     Day day;
>   }
> 
>   public static void storeEnum(MyObject o, Day d) {
>     o.day = d;
>   }
> 
>   (...)
> 
>     MyObject o = new MyObject();
>     Day d = Day.TUESDAY;
>     storeEnum(o, d);
> 
>   (...)
> 
> 
> If so, the answer is yes: C2 treats this case as any other object write and generates GC barriers accordingly. Do you have any specific optimization in mind?

Hi @robcasloz, 
you can pick up s390x patch from here: https://github.com/offamitkumar/jdk/commit/6663433c4aa17925f699eaa8995cdc0cd78c0034

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

PR Comment: https://git.openjdk.org/jdk/pull/19746#issuecomment-2333779374


More information about the hotspot-dev mailing list