Repository navigation
The x86 path for UnmanagedCallersOnlyAttribute should be improved. #33582
Description
The making public of NativeCallableAttributeUnmanagedCallersOnlyAttribute done in #33005, provided some additional optimizations. However the Windows-x86 path was deemed lower priority so wasn't optimized. There are various locations where the Windows-x86 platform opted out of the optimization.
Examples:
runtime/src/coreclr/src/vm/jitinterface.cpp
Lines 9212 to 9224 in a1af0f2
| #if defined(TARGET_X86) && defined(TARGET_WINDOWS) && !defined(CROSSGEN_COMPILE) | |
| // Deferring X86 support until a need is observed or | |
| // time permits investigation into all the potential issues. | |
| if (pMD->HasNativeCallableAttribute()) | |
| { | |
| pResult->addr = (void*)COMDelegate::ConvertToCallback(pMD); | |
| } | |
| else | |
| { | |
| pResult->addr = (void*)pMD->GetMultiCallableAddrOfCode(); | |
| } | |
| #else |
runtime/src/coreclr/src/vm/jitinterface.cpp
Lines 12389 to 12392 in a1af0f2
| #if !defined(TARGET_X86) || !defined(TARGET_WINDOWS) | |
| if (ftn->HasNativeCallableAttribute()) | |
| flags.Set(CORJIT_FLAGS::CORJIT_FLAG_REVERSE_PINVOKE); | |
| #endif // !TARGET_X86 || !TARGET_WINDOWS |
runtime/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs
Lines 2887 to 2891 in a1af0f2
| if (targetArchitecture == TargetArchitecture.X86 | |
| && _compilation.TypeSystemContext.Target.OperatingSystem == TargetOS.Windows) | |
| { | |
| throw new RequiresRuntimeJitException("ReadyToRun: Methods with NativeCallableAttribute not implemented"); | |
| } |
runtime/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs
Lines 1663 to 1669 in a1af0f2
| var targetDetails = _compilation.TypeSystemContext.Target; | |
| if (targetDetails.Architecture == TargetArchitecture.X86 | |
| && targetDetails.OperatingSystem == TargetOS.Windows | |
| && targetMethod.IsNativeCallable) | |
| { | |
| throw new RequiresRuntimeJitException("ReadyToRun: References to methods with NativeCallableAttribute not implemented"); | |
| } |
Activity
[-]The Windows x86 path for NativeCallableAttribute should be improved.[/-][+]The x86 path for NativeCallableAttribute should be improved.[/+]jkotas commentedon Mar 29, 2020
Generalizing the issue to both Windows and Linux. It turns our both Windows x86 and Linux x86 need work.
AaronRobinsonMSFT commentedon Mar 30, 2020
See #34251 (comment) for Linux x86 issues.
jkotas commentedon Apr 6, 2020
See #34548 for (subset of) places that are affected.
[-]The x86 path for NativeCallableAttribute should be improved.[/-][+]The x86 path for UnmanagedCallersOnlyAttribute should be improved.[/+]AaronRobinsonMSFT commentedon Dec 5, 2020
@jkoritzinsky I assume some of the work you are doing is addressing this.
jkoritzinsky commentedon Dec 5, 2020
Kind of. I’ll make sure to link to this issue as I do the work related to it.
jkoritzinsky commentedon Apr 5, 2021
Fixed by #46238