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

Tobias Hartmann thartmann at openjdk.org
Fri Dec 19 09:36:20 UTC 2025


On Fri, 19 Dec 2025 09:02:38 GMT, Marc Chevalier <mchevalier at openjdk.org> wrote:

>> I was suggesting that we should do what mainline does if `!InlineTypePassFieldsAsArgs`, would that make sense?
>> 
>> I.e. do `store_check(masm, dst.base(), dst);`
>
> 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!

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

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


More information about the valhalla-dev mailing list