-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constructing MD arrays in R2R code does not work on OSX/ARM64 #62747
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
@dotnet/jit-contrib - is this a JIT issue? |
For reference, the general marshalling of varargs is tracked in #48796 with specific discussion about the macOS/iOS ABI situation. |
I think this is a JIT issue. It looks like there's two JIT helpers for creating MDArrays. One that uses varargs and one that doesn't. For some reason it looks like the one that doesn't use varargs is only used in non-R2R or CoreRT scenarios: Usage of the non-varag helper: runtime/src/coreclr/jit/importer.cpp Line 7501 in 4a48840
Condition for the block containing the non-vararg helper call setup: runtime/src/coreclr/jit/importer.cpp Line 7446 in 4a48840
Usage of the vararg helper (in the else block for the above runtime/src/coreclr/jit/importer.cpp Line 7518 in 4a48840
The comment above the |
Especially if we are already bumping R2R version. |
+100 |
We're using a multidimensional array in ConsolePal.Unix.cs, so I think this is higher priority than we thought:
As a result, this is breaking all of the crossgen2 outerloop runs on macOS ARM64. I'll take a stab at fixing this to unblock the legs. |
#61938 exposed this issue.
We had other issues that could cause related test scenario (
TestGenericMDArrayBehavior
) to never run in R2R mode on OSX.#61938 makes R2R enabled more reliably on OSX, but now we see the test failing, so I disabled the scenario as a part of #61938.
I beleive the root cause is variadic JIT helper -
HCIMPL2VA(Object*, JIT_NewMDArr, CORINFO_CLASS_HANDLE classHnd, unsigned dwNumArgs)
.It looks like OSX/ARM64 has special ABI for variadic calls, but we call it just as a cdecl with extra arguments. As a result the helper reads garbage and allocating MD arrays fails.
We do not use this helper in regular JIT code. There is a comment that it may be worth switching R2R to non-variadic helper as well since it would be more portable. Perhaps it is time?
The text was updated successfully, but these errors were encountered: