-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix ARM and AArch64 and Win64 ABI #18689
Conversation
Tentatively added backport pending label since this fixes a bug. The change isn't entirely trivial though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you have a chance to test this on PPC? Otherwise I can run the tests.
#if JL_LLVM_VERSION >= 30600 | ||
jl_ExecutionEngine->getDataLayout(); | ||
#else | ||
*jl_ExecutionEngine->getDataLayout(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation?
#if JL_LLVM_VERSION >= 30600 | ||
jl_ExecutionEngine->getDataLayout(); | ||
#else | ||
*jl_ExecutionEngine->getDataLayout(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation?
(void)sz; | ||
return 16; | ||
#elif defined(_CPU_ARM_) || defined(_CPU_PPC_) | ||
return rtsz < 4 : 8 : 16; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be (rtsz < 4) ? 8 : 16;
I have never seen the syntax cond : x : y;
return 8; | ||
// szclass 12 | ||
if (sz < 8) | ||
return 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment why this is 4
might be helpful. It seems counter-intuitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is
// szclass 12
c57d988
to
8e270ea
Compare
No, I don't have hardware. I also haven't tested on ARM yet but will do soon. |
8e270ea
to
3adfeeb
Compare
win64 appveyor failure is in ccall, looks related |
Also add related ccall test and test both mutable and immutable types.
3adfeeb
to
9680aca
Compare
I'm wondering if it's because of the change in codegen or tests. |
Looks like the new test triggers a bug on win64 ABI. It'll probably take some time before I can debug this since my windows VM is not working ATM. |
For |
That test is exercising the Win64 ABI issues mentioned at #14215 (comment) |
.... ok, that's why we don't have a test for this.... I added the test because this is the unambiguous case that we need a memory cast between different sizes on both ARM and AArch64. |
9680aca
to
1cac126
Compare
1cac126
to
dd603f0
Compare
Win64 ccall tests should pass now according to local test. |
Local ARM tests also passed. |
lgtm. we still need to fix the win32 and x64 ABIs for the issues mentioned in the comment linked above, and elsewhere. but it this passes, there's no reason to hold this up. |
local PPC tests are hanging. Give me a bit of time to see if this is the cause |
The AArch64 (and likely ARM) requires certain arguments to be effectively casting through memory to a larger size before passing as argument or returning. From AAPCS64
and
These are modeled by LLVM as an array type of the the element type being a register size integer (
i64
on AArch64,i32
on ARM) so the cast through memory should handle this case.The commit also added an assertion to make sure we are not storing an object larger then the GC allocation size and fix the store alignment for small objects that are not 16bytes aligned on 32bit.
The argument passing is not changed since we are always storing a smaller value to a larger slot which should be fine.
Add a few
ccall
test for the related cases.Also test both mutable and immutable types since they follows different code path in codegen. (The issue would have trigger a
ccall
test failure ifimmutable
types were used in the tests).I noticed the issue since it triggers a failure in the recently added
VecElement
test incore