RFR: 8302780: Add support for vectorized arraycopy GC barriers [v2]

Albert Mingkun Yang ayang at openjdk.org
Fri Feb 24 11:23:07 UTC 2023


On Fri, 24 Feb 2023 11:00:55 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:

>> src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp line 218:
>> 
>>> 216:     fatal("No support for 8 bytes copy");
>>> 217: #endif
>>> 218:   }
>> 
>> I believe the intent would be clearer using `switch`.
>
> I tried both, but I actually found it less clear with switch as I then have to worry about a missing break; which would be accepted by the compiler and just yield subtly incorrect machine code. I'm open to doing switch though if you really do think it is more clear then. What do you think?

I think `switch` looks better; it's not that this code will be updated frequently, adding/removing cases. (Ofc, this is subjective.)


switch(byte) {
case 1: ...; break;
case 2: ...; break;
...
default: should-not-reach;
}

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

PR: https://git.openjdk.org/jdk/pull/12670


More information about the hotspot-dev mailing list