Question about tearing and buffered primitive classes

Nick Gasson nick.gasson at arm.com
Thu Apr 1 07:54:29 UTC 2021


Hi Tobias,

Thanks for the feedback.

On 01/04/21 15:25 pm, Tobias Hartmann wrote:
>
> Yes, I think this is the correct fix:
>
>> diff --git a/src/hotspot/share/c1/c1_GraphBuilder.cpp b/src/hotspot/share/c1/c1_GraphBuilder.cpp
>> index ead767f596d7..ac7e4ce5f06d 100644
>> --- a/src/hotspot/share/c1/c1_GraphBuilder.cpp
>> +++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp
>> @@ -1617,7 +1617,7 @@ void GraphBuilder::method_return(Value x, bool ignore_return) {
>> 
>>    // The conditions for a memory barrier are described in Parse::do_exits().
>>    bool need_mem_bar = false;
>> -  if (method()->is_object_constructor() &&
>> +  if ((method()->is_object_constructor() || method()->is_static_init_factory()) &&
>>         (scope()->wrote_final() ||
>>           (AlwaysSafeConstructors && scope()->wrote_fields()) ||
>>           (support_IRIW_for_not_multiple_copy_atomic_cpu && scope()->wrote_volatile()))) {
>
> The is_static_init_factory check is simply missing there.
>

I'll make a PR for this shortly.  Do you think C2's Parse::do_exits()
needs the same fix?  At the moment it only checks
is_object_constructor_or_class_initializer().  (Is there a reason C1
doesn't insert the barrier for class initialisers?)

--
Thanks,
Nick


More information about the valhalla-dev mailing list