RFR: Uses keep_alive_barrier to keep deduped char array alive
Roman Kennke
rkennke at redhat.com
Wed Oct 11 19:53:50 UTC 2017
Am 11.10.2017 um 21:50 schrieb Zhengyu Gu:
>>>>
>>> Ok, let me clear my thoughts here.
>>>
>>> If we do SATB barrier, that will ensure existing_value alive.
>> In G1, and Shenandoah (but only during conc-mark, not during
>> conc-partial).
>>> However, if we do keep_alive_barrier, the existing_value could be
>>> evacuated, but we still hold old oop here, right? then we can end up
>>> dead oop after recycle?
>> No, because there cannot be a safepoint between keep_alive_barrier()
>> and subsequent uses. We may hold a pointer to a from-space object,
>> but that should be ok if all subsequent uses do their barriers right.
>> There is only one subsequent use before the oop goes out of scope,
>> and that is
>>
>> java_lang_String::set_value(java_string, typeArrayOop(existing_value));
>>
>> which does the correct barrier (i.e. storeval-barrier). Everything
>> should be fine.
> Okay, I see. Thanks for the explanation.
>
> Updated webrev:
> http://cr.openjdk.java.net/~zgu/shenandoah/strdedup_keep_alive/webrev.01/
It is ok, but I'd just drop the if-else on UseShenandoahGC and
unconditionally call oopDesc::bs()->keep_alive_barrier(...) that will do
the right thing for G1 too!
Roman
More information about the shenandoah-dev
mailing list