-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[ARM32/RyuJIT] Enable passing struct argument that use stack only #11541
[ARM32/RyuJIT] Enable passing struct argument that use stack only #11541
Conversation
Enable passing struct argument when it uses stack only. Cannot pass splitted struct argument that uses stack and register(s) yet.
cc/ @dotnet/arm32-contrib Example
Before
Aftergenerated code to call
|
Fix formatting
Fix formatting error
src/jit/codegenarmarch.cpp
Outdated
{ | ||
return; | ||
} | ||
#endif // _TARGET_ARM_ |
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.
This doesn't look necessary (or desirable).
However, it looks like there is an existing bug where nextType/nextAttr below is accessed even if remainingSize==0. That could be fixed by pushing these declarations within the first if
, and then deleting the
nextType = compiler->getJitGCType(gcPtrs[nextIndex]);
nextAttr = emitTypeSize(nextType);
at the end of the first if
.
src/jit/codegenarmarch.cpp
Outdated
unsigned gcPtrCount; // The count of GC pointers in the struct | ||
BYTE* gcPtrs = nullptr; | ||
BYTE gcPtrArray[MAX_ARG_REG_COUNT] = {}; // TYPE_GC_NONE = 0 | ||
|
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.
For simplicity, you could just always initialize gcPtrs to gcPtrArray:
BYTE gcPtrArray[MAX_ARG_REG_COUNT] = {}; // TYPE_GC_NONE = 0
BYTE* gcPtrs = gcPtrArray;
There is code in Lowering::TreeNodeInfoInitPutArgStk() that is specific to ARM64 that needs adjusting:
For arm32, you only need one internal register. |
#else // _TARGET_ARM_ | ||
gcPtrs = treeNode->gtGcPtrs; | ||
gcPtrCount = treeNode->gtNumSlots; | ||
#endif // _TARGET_ARM_ | ||
} |
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.
Can you explain why this is ARM32-specific? Why does ARM64 do something different here?
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.
treeNode->gtGcPtrs
and treeNode->gtNumSlots
can be used when FEATURE_PUT_STRUCT_ARG_STK
is set, but ARM64 is not use this feature.
- Remove redundant GC type assignment in genPutArgStk - Fix internal register count for ARM32: 2 -> 1
Fix formatting
@BruceForstall Fixed it by applying your review. PTAL |
#else // _TARGET_ARM_ | ||
// For a >= 4 byte structSize we will generate a ldr and str instruction each loop | ||
// ldr r2, [r0] | ||
// str r2, [sp, #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.
How about str r2, [sp, #4]
?
Because we are going to increase offset by TARGET_POINTER_SIZE
for ARM32 here.
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.
Or does the offset start from 16 and increase by 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.
I think it's not important what the offset value is. It is just example. This offset value isn't offset of this struct argument. It means stack offset in all of arguments for method.
@dotnet-bot test this please |
@dotnet-bot test Windows_NT arm64 Checked |
@dotnet-bot test Tizen armel Cross Debug Build |
Enable passing struct argument when it uses stack only.
Cannot pass splitted struct argument that uses stack and register(s) yet.
related issue: #10722