-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Enable FEATURE_STUBS_AS_IL for ARM/Linux #6500
Conversation
@@ -2593,15 +2593,6 @@ BOOL COMDelegate::NeedsWrapperDelegate(MethodDesc* pTargetMD) | |||
{ | |||
LIMITED_METHOD_CONTRACT; | |||
|
|||
#ifdef _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.
I do not think it is ok to just return false
for ARM from here. You should see crashes in delegate tests with this change. This change would need matching changes in arm\virtualcallstubcpu.hpp
and JIT.
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.
@jkotas Without this, I encountered UNREACHABLE
call as COMDelegate::GetSecureInvoke
is currently not implemented.
Could you let me know which changes are required for arm\virtualcallstubcpu.hpp
and JIT, or how to implement COMDelegate::GetSecureInvoke
?
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 believe that implementing COMDelegate::GetSecureInvoke
is easier. It should be implemented similar to how COMDelegate::GetMulticastInvoke
is implemented, except that there will be no loop. It should just re-push the arguments and call the actual target. The call to actual target generated by the JIT has to pass the indirection cell in R4. There will need be a new flag passed to the JIT to make it happen.
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.
Could you remove my email address from DW? I think this discussion does not
concern me.
Cheers
Julian
28 lip 2016 4:06 PM "Jan Kotas" [email protected] napisał(a):
In src/vm/comdelegate.cpp
#6500 (comment):@@ -2593,15 +2593,6 @@ BOOL COMDelegate::NeedsWrapperDelegate(MethodDesc* pTargetMD)
{
LIMITED_METHOD_CONTRACT;-#ifdef TARGET_ARM
I believe that implementing COMDelegate::GetSecureInvoke is easier. It
should be implemented similar to how COMDelegate::GetMulticastInvoke is
implemented, except that there will be no loop. It should just re-push the
arguments and call the actual target. The call to actual target generated
by the JIT has to pass the indirection cell in R4. There will need be a new
flag passed to the JIT to make it happen.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dotnet/coreclr/pull/6500/files/c7d62d06126218318efee2d7bf5ed0158ffb58d5#r72628027,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAA1nOgyJ-Ik3RQUtmQvlY0BKE3L3gPYks5qaLeBgaJpZM4JW0HY
.
It is the problem around NeedsWrapperDelegate that you have discovered as well. |
@jkotas I tried to build the following example in #3804:
Unfortunately, I got the following error message:
Is there any further change in .NET Core from then? |
There needs to be an extra |
@jkotas Thanks! It works. I'll check the issue with that example. |
@jkotas Recent PR allows me to execute the failing CoreFX unittests, but it still shows segfault on the above example. As I understood, the secure delegate invoke needs to set R4 as an indirection cell. I managed to generate the following jitted code via manipulating
Could you let me know what is the next step to enable secure delegate in ARM? |
The code needs to be similar to code generated for the manually generated secure delegate: Line 2942 in deb00ad
|
|
||
ILCodeStream *pCode = sl.NewCodeStream(ILStubLinker::kDispatch); | ||
|
||
DWORD dwReturnValNum = -1; |
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 special handling of return values should not be needed here. If you delete everything that has to do with dwReturnValNum
and fReturnVal
, everything should still work fine.
@jkotas Thanks!! I'll try. It seems that the code in |
Right, you do not have to worry about GS cookie for the IL stub. |
@dotnet-bot test Ubuntu x64 Checked Build and Test please |
@dotnet-bot test Windows_NT x64 Debug Build and Test please |
@dotnet-bot test Linux ARM Emulator Cross Debug Build please |
@dotnet-bot test Windows_NT x64 Release Priority 1 Build and Test please |
@dotnet-bot test Linux ARM Emulator Cross Debug Build please |
@jkotas It seems that the failure in Linux ARM Emulator Cross Debug Build is not related with this PR. Could you take a look? When I tested on ARM (softfp), this commit does not introduce any regression in CoreCLR unittests, but allows me to execute the CoreFX unittest of interest. |
The ARM emulator failure is likely caused by #6676 |
@@ -6473,6 +6473,11 @@ var_types Compiler::impImportCall(OPCODE opcode, | |||
/* Set the delegate flag */ | |||
call->gtCall.gtCallMoreFlags |= GTF_CALL_M_DELEGATE_INV; | |||
|
|||
if (callInfo->secureInvoke) | |||
{ | |||
call->gtCall.gtCallMoreFlags |= GTF_CALL_M_SECURE_DELEGATE_INV; |
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.
Nit 4 space indentation
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.
Oops, I'll revise it.
@dotnet/jit-contrib Could you please take a look at the JIT changes? |
@parjong Looks good to me modulo comments. |
@dotnet-bot test OSX x64 Checked Build and Test please |
@dotnet-bot test Ubuntu x64 Checked Build and Test please |
@dotnet-bot test Windows_NT x64 Debug Build and Test please |
@dotnet-bot test Ubuntu x64 Checked Build and Test please |
@dotnet-bot test OSX x64 Checked Build and Test please |
I think the change is good to go as is. We can look into making this better as part of larger JIT-EE interface refactoring once/if there is one (e.g. packing all fields on |
@jkotas fair enough. LGTM, then. |
Could you please resolve the conflicts (and squash to a single commit while you are on it)? |
21a3d66
to
38c7928
Compare
This commit enables FEATURE_STUBS_AS_IL for ARM/Linux. This commit tries to fix #6452.
@jkotas I revised PR per feedback. Please take a look. |
👍 |
:mips-interest |
This commit enables FEATURE_STUBS_AS_IL for ARM/Linux. This commit tries to fix dotnet/coreclr#6452. Commit migrated from dotnet/coreclr@6abfacb
This commit re-enables FEATURE_STUBS_AS_IL for ARM/Linux in order to fix #6452.
Currently, CoreCLR in ARM/Linux uses the stub function emitted by
ThumbEmitCallWithGenericInstantiationParameter
invm/arm/stubs.cpp
for some generic instantiation.As those stubs emitted by
ThumbEmitCallWithGenericInstantiationParameter
do not have entries in .ARM.exidx sections, libunwind falls backs on unstable frame parsing-based unwind method.As the stack frame of those stubs is not in the required form, unwind provides incorrect values, which results in the issue in #6452.
Furthermore, libunwind currently guarantees the correctness of PC and R11 (FP) when using frame parsing-based unwind method.
To workaround this issue, this commit attempts to re-enable FEATURE_STUBS_AS_IL which is turned off in #3804.
Please do NOT merge this as this PR may cause several side-effects (Its side-effect is currently under evaluation).