You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RyuJIT: Missing zeroing of upper bits for small struct used in Volatile.Read #10941
i.e. the callee does not make any assumptions about the upper bits in this case.
As an aside is there any documentation on the ABI used in the JIT for cases like this? In other words, is the caller or callee right here?
You can see that the arg0 argument was promoted and its promoted ubyte field is V02. Since it's a small type struct field vNormalizeOnLoad() should return true. And it very likely does that but probably morph does not insert the necessary zero extending cast. Or something else removes the cast.
LclVar nodes that are used by GT_ADDR are marked with GTF_DONT_CSE cause their meaning is completely different in address context
Then there's the code that folds IND(ADDR(LCLVAR)) to LCLVAR. This one removes GTF_DONT_CSE but copies it from the indir, which happens to have it set. Haven't checked why, probably because it's volatile. Doesn't really matter, the fact is that it can happen.
The resulting Lclvar node is re-morphed, that should take care of adding the normalize on load cast. Except that it does not because:
Activity
jakobbotsch commentedon Aug 22, 2018
I initially thought the problem was that the call in
Mainsign extends the argument instead of zero extending it, but changing M7 to:gives instead:
i.e. the callee does not make any assumptions about the upper bits in this case.
As an aside is there any documentation on the ABI used in the JIT for cases like this? In other words, is the caller or callee right here?
mikedn commentedon Aug 22, 2018
Probably another normalize on load mess up:
You can see that the arg0 argument was promoted and its promoted ubyte field is V02. Since it's a small type struct field
vNormalizeOnLoad()should return true. And it very likely does that but probably morph does not insert the necessary zero extending cast. Or something else removes the cast.mikedn commentedon Aug 22, 2018
Heh,
GT_ADDRcrap.GT_ADDRare marked withGTF_DONT_CSEcause their meaning is completely different in address contextIND(ADDR(LCLVAR))toLCLVAR. This one removesGTF_DONT_CSEbut copies it from the indir, which happens to have it set. Haven't checked why, probably because it's volatile. Doesn't really matter, the fact is that it can happen.That is, it assumes that
GTF_DONT_CSEon a LclVar implies that it's in address context and of course, then the cast is not needed.No comment.
mikedn commentedon Sep 8, 2018
Ideally we'd get rid of
GT_ADDR(#19875). That may take a while though so perhaps we need some simple fix for this. If such a fix exists.