if (this.MethodBeingCompiled.IsNativeCallable)
{
#if READYTORUN
- if (targetArchitecture == TargetArchitecture.X86
- && _compilation.TypeSystemContext.Target.OperatingSystem == TargetOS.Windows)
+ if (targetArchitecture == TargetArchitecture.X86)
{
throw new RequiresRuntimeJitException("ReadyToRun: Methods with NativeCallableAttribute not implemented");
}
pResult->methodFlags = FilterNamedIntrinsicMethodAttribs(pResult->methodFlags, methodToCall);
var targetDetails = _compilation.TypeSystemContext.Target;
- if (targetDetails.Architecture == TargetArchitecture.X86
- && targetDetails.OperatingSystem == TargetOS.Windows
- && targetMethod.IsNativeCallable)
+ if (targetDetails.Architecture == TargetArchitecture.X86 && targetMethod.IsNativeCallable)
{
throw new RequiresRuntimeJitException("ReadyToRun: References to methods with NativeCallableAttribute not implemented");
}
jmp C_FUNC(ThePreStub)
LEAF_END PrecodeFixupThunk, _TEXT
-NESTED_ENTRY UMThunkStubRareDisable, _TEXT, NoHandler
- push eax
- push ecx
-
- sub esp, 12
- push eax // Push the UMEntryThunk
- push ecx // Push thread
- CHECK_STACK_ALIGNMENT
- call C_FUNC(UMThunkStubRareDisableWorker)
- add esp, 12
-
- pop ecx
- pop eax
- ret
-NESTED_END UMThunkStubRareDisable, _TEXT
-
//
// Used to get the current instruction pointer value
//
if (thread->PreemptiveGCDisabled())
ReversePInvokeBadTransition();
- thread->DisablePreemptiveGC();
frame->currentThread = thread;
+
+ thread->DisablePreemptiveGC();
+}
+
+NOINLINE static void JIT_ReversePInvokeEnterRare2(ReversePInvokeFrame* frame)
+{
+ frame->currentThread->RareDisablePreemptiveGC();
}
EXTERN_C void JIT_ReversePInvokeEnter(ReversePInvokeFrame* frame)
if (thread != NULL
&& !thread->PreemptiveGCDisabled())
{
+ frame->currentThread = thread;
+
// Manually inline the fast path in Thread::DisablePreemptiveGC().
thread->m_fPreemptiveGCDisabled.StoreWithoutBarrier(1);
if (g_TrapReturningThreads.LoadWithoutBarrier() == 0)
{
- frame->currentThread = thread;
return;
}
+
+ JIT_ReversePInvokeEnterRare2(frame);
+ return;
}
JIT_ReversePInvokeEnterRare(frame);
pResult->accessType = IAT_VALUE;
-// Also see GetBaseCompileFlags() below for an additional check.
-#if defined(TARGET_X86) && defined(TARGET_WINDOWS) && !defined(CROSSGEN_COMPILE)
+#if defined(TARGET_X86) && !defined(CROSSGEN_COMPILE)
// Deferring X86 support until a need is observed or
// time permits investigation into all the potential issues.
+ // https://github.com/dotnet/runtime/issues/33582
if (pMD->HasNativeCallableAttribute())
{
pResult->addr = (void*)COMDelegate::ConvertToCallback(pMD);
{
pResult->addr = (void*)pMD->GetMultiCallableAddrOfCode();
}
-
#else
-
pResult->addr = (void*)pMD->GetMultiCallableAddrOfCode();
-
-#endif // !(TARGET_X86 && TARGET_WINDOWS) || CROSSGEN_COMPILE
+#endif
EE_TO_JIT_TRANSITION();
}
}
}
-#if !defined(TARGET_X86) || !defined(TARGET_WINDOWS)
+#if !defined(TARGET_X86)
if (ftn->HasNativeCallableAttribute())
flags.Set(CORJIT_FLAGS::CORJIT_FLAG_REVERSE_PINVOKE);
-#endif // !TARGET_X86 || !TARGET_WINDOWS
+#endif // !TARGET_X86
return flags;
}
}
#endif
-#if defined(TARGET_X86) && defined(TARGET_WINDOWS)
+#ifdef TARGET_X86
if (GetCompileInfo()->IsNativeCallableMethod(m_currentMethodHandle))
{
if (m_zapper->m_pOpt->m_verbose)
m_zapper->Warning(W("ReadyToRun: Methods with NativeCallableAttribute not implemented\n"));
ThrowHR(E_NOTIMPL);
}
-#endif // (TARGET_X86) && defined(TARGET_WINDOWS)
+#endif // TARGET_X86
if (m_pImage->m_stats)
{
}
#endif
-#if defined(TARGET_X86) && defined(TARGET_WINDOWS)
+#ifdef TARGET_X86
if (GetCompileInfo()->IsNativeCallableMethod(pResult->hMethod))
{
if (m_zapper->m_pOpt->m_verbose)
m_zapper->Warning(W("ReadyToRun: References to methods with NativeCallableAttribute not implemented\n"));
ThrowHR(E_NOTIMPL);
}
-#endif // (TARGET_X86) && defined(TARGET_WINDOWS)
+#endif // TARGET_X86
if (flags & CORINFO_CALLINFO_KINDONLY)
return;