On Fri, 19 Dec 2025 08:56:27 GMT, Tobias Hartmann <[email protected]> wrote:

>> I don't understand why it's not a problem on mainline, tho. And I agree it's 
>> weird. I've looked, but it's hard to investigate why something works rather 
>> than not (on a somewhat diverging codebase). I spent some time on that, but 
>> eventually decided it's not that critical, as long as we have a way to make 
>> it work for Valhalla too.
>
> 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?

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

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

Reply via email to