The making public of NativeCallableAttribute UnmanagedCallersOnlyAttribute 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:
|
#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 |
|
#if !defined(TARGET_X86) || !defined(TARGET_WINDOWS) |
|
if (ftn->HasNativeCallableAttribute()) |
|
flags.Set(CORJIT_FLAGS::CORJIT_FLAG_REVERSE_PINVOKE); |
|
#endif // !TARGET_X86 || !TARGET_WINDOWS |
|
if (targetArchitecture == TargetArchitecture.X86 |
|
&& _compilation.TypeSystemContext.Target.OperatingSystem == TargetOS.Windows) |
|
{ |
|
throw new RequiresRuntimeJitException("ReadyToRun: Methods with NativeCallableAttribute not implemented"); |
|
} |
|
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"); |
|
} |
The making public of
NativeCallableAttributeUnmanagedCallersOnlyAttributedone 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
runtime/src/coreclr/src/vm/jitinterface.cpp
Lines 12389 to 12392 in a1af0f2
runtime/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs
Lines 2887 to 2891 in a1af0f2
runtime/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs
Lines 1663 to 1669 in a1af0f2