[lworld] RFR: 8366717: [lworld] Cleanup defensive fixing of JDK-8365996 [v3]

Marc Chevalier mchevalier at openjdk.org
Wed Jan 7 10:18:34 UTC 2026


On Fri, 19 Dec 2025 09:33:45 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>> That is the else-branch, right? Right now we have
>> 
>> if (tmp3 != noreg) {
>>   __ mov(tmp3, dst.base());
>>   store_check(masm, tmp3, dst);
>> } else {
>>   // It's OK to corrupt the dst.base() register.
>>   store_check(masm, dst.base(), dst);
>> }
>> 
>> If I understand well, you're suggesting to write
>> 
>> if (InlineTypePassFieldsAsArgs) {
>>   if (tmp3 != noreg) {
>>     __ mov(tmp3, dst.base());
>>     store_check(masm, tmp3, dst);
>>   } else {
>>     // It's OK to corrupt the dst.base() register.
>>     store_check(masm, dst.base(), dst);
>>   }
>> } else {
>>   // as mainline
>>   store_check(masm, dst.base(), dst);
>> }
>> 
>> but to me, it looks equivalent to
>> 
>> 
>> if (InlineTypePassFieldsAsArgs && tmp3 != noreg) {
>>   __ mov(tmp3, dst.base());
>>   store_check(masm, tmp3, dst);
>> } else {
>>   // It's OK to corrupt the dst.base() register.
>>   store_check(masm, dst.base(), dst);
>> }
>> 
>> since both else-branch are identical.
>> 
>> And this, I experimentally found that it's failing quite a lot, with backtraces as I mentioned. Is there an obvious mistake in my logic I'm missing?
>
> Ah, you are right. I missed the outer `if (tmp3 != noreg) {` which is Valhalla specific. As we discussed off-thread, it would be good to get a better understanding of why this fails in Valhalla. Thanks a lot!

I've fixed and added an explanation of that in the the PR description.

The problem is that some new Valhalla-specific code is using `store_heap_oop` that is eventually calling `CardTableBarrierSetAssembler::oop_store_at` in a loop where corrupting `dst.base()` is problematic for following loop iterations. I've added some saving rather at the level of these loops.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1824#discussion_r2667841041


More information about the valhalla-dev mailing list