Fix passing Vector3s from the interpreter to native code #119020
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently if you pass a VT argument with a size that is not a multiple of 8, the interp->native transition will misalign its stack offset and start loading garbage into registers after it processes the VT. The native->interp transition is handled correctly because the Store_Ref_XXX helpers already align offsets. The Load_Ref_Reg helpers don't do alignment, unlike Load_Stack_Ref which does.
This PR tweaks the callstub generator so that when generating a list of load routines, it aligns up the size of any VTs to maintain the alignment of the stack offsets. This is unnecessary for stack refs but harmless there. Store routines are left alone.
This PR also adds a new DOTNET_InterpHaltOnCall environment var that lets you make the interpreter assert when compiling calls to a specific method. It was helpful to have this when investigating this issue.
This fixes an issue in JIT\SIMD\Vector3Interop_ro\Vector3Interop_ro (but it still doesn't pass, due to a GC hole much later in the test)