From 54a5ce9644a7df135dbaf67551c1e3fc9024bb78 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Mon, 21 Sep 2026 19:22:20 +0200 Subject: [PATCH 01/14] [wasm][coreclr] Dispatch R2R-compiled UnmanagedCallersOnly callbacks to their native entrypoint A partial R2R image can crossgen an [UnmanagedCallersOnly] callback to native code. The generated native->interpreter reverse thunk routed it unconditionally through ExecuteInterpretedMethodFromUnmanaged, which either handed a null interpreter body to the interpreter (fatal 'Unimplemented or invalid interpreter opcode') or, via InvokeManagedMethod, hit the interp->R2R 'null function or function signature mismatch' trap (dotnet/runtime#134200). Repro: the browser event loop calls the SystemJS_ExecuteBackgroundJobCallback export -> ThreadPool.BackgroundJobHandler, which is R2R-compiled under a partial image. Fix: the call-helpers generator now emits a direct-R2R dispatch in each reverse thunk - resolve the R2R native entrypoint via GetR2RNativeCodeForUnmanagedCallersOnly and call it with the native ABI, falling back to the interpreter only when there is no R2R body. GetUnmanagedCallersOnlyThunk is refactored onto the same shared helper. Regenerated the checked-in browser and wasi call helpers. --- .../PInvokeTableGenerator.cs | 21 +- .../vm/wasm/browser/callhelpers-reverse.cpp | 860 ++++++++++++++---- src/coreclr/vm/wasm/helpers.cpp | 42 +- .../vm/wasm/wasi/callhelpers-reverse.cpp | 796 +++++++++++++--- 4 files changed, 1398 insertions(+), 321 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs index db666466761c82..e119d753a0a255 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs @@ -246,6 +246,7 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) // The current approach has limitations with overloaded methods. extern "C" void LookupUnmanagedCallersOnlyMethodByName(const char* fullQualifiedTypeName, const char* methodName, MethodDesc** ppMD); extern "C" void ExecuteInterpretedMethodFromUnmanaged(MethodDesc* pMD, int8_t* args, size_t argSize, int8_t* ret, PCODE callerIp); + extern "C" void* GetR2RNativeCodeForUnmanagedCallersOnly(MethodDesc* pMD); """); @@ -286,6 +287,14 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) : string.Empty; string parametersDeclaration = string.Join(", ", parameterCTypes.Select((p, i) => $"{p} arg{i}")); string arguments = string.Join(", ", Enumerable.Range(0, parameterCount).Select(i => $"arg{i}")); + // A partial R2R image can compile an UnmanagedCallersOnly callback to native code. That R2R code + // is the directly-callable native entrypoint (same ABI as this wrapper's parameters), so dispatch + // to it and skip the interpreter/interp->R2R path entirely. + string r2rVar = $"r2rCode_{cb.EntrySymbol}"; + string paramTypesOnly = string.Join(", ", parameterCTypes); + string r2rDispatch = cb.IsVoid + ? $"((void(*)({paramTypesOnly})){r2rVar})({arguments});{w.NewLine} return;" + : $"return (({MapType(cb.ReturnType)}(*)({paramTypesOnly})){r2rVar})({arguments});"; string exportFunction = cb.IsExport ? $$""" @@ -301,13 +310,19 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) static MethodDesc* MD_{{cb.EntrySymbol}} = nullptr; static {{ MapType(cb.ReturnType)}} Call_{{cb.EntrySymbol}}({{parametersDeclaration}}) - {{{argsDeclaration}} + { // Lazy lookup of MethodDesc for the function export scenario. if (!MD_{{cb.EntrySymbol}}) { LookupUnmanagedCallersOnlyMethodByName("{{cb.TypeFullName}}, {{cb.AssemblyName}}", "{{cb.MethodName}}", &MD_{{cb.EntrySymbol}}); - }{{ - (!cb.IsVoid ? $"{w.NewLine}{w.NewLine} {MapType(cb.ReturnType)} result;" : "")}} + } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* {{r2rVar}} = GetR2RNativeCodeForUnmanagedCallersOnly(MD_{{cb.EntrySymbol}}); + if ({{r2rVar}} != nullptr) + { + {{r2rDispatch}} + }{{argsDeclaration}}{{ + (!cb.IsVoid ? $"{w.NewLine} {MapType(cb.ReturnType)} result;" : "")}} ExecuteInterpretedMethodFromUnmanaged(MD_{{cb.EntrySymbol}}, {{argsArgs}}, {{(cb.IsVoid ? "nullptr" : "(int8_t*)&result")}}, (PCODE)&Call_{{cb.EntrySymbol}});{{ (!cb.IsVoid ? $"{w.NewLine} return result;" : "")}} }{{exportFunction}} diff --git a/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp b/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp index 571bfb64e85cb7..b30d2db8e4db40 100644 --- a/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp +++ b/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp @@ -13,17 +13,25 @@ // The current approach has limitations with overloaded methods. extern "C" void LookupUnmanagedCallersOnlyMethodByName(const char* fullQualifiedTypeName, const char* methodName, MethodDesc** ppMD); extern "C" void ExecuteInterpretedMethodFromUnmanaged(MethodDesc* pMD, int8_t* args, size_t argSize, int8_t* ret, PCODE callerIp); +extern "C" void* GetR2RNativeCodeForUnmanagedCallersOnly(MethodDesc* pMD); static MethodDesc* MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "g__Callback|72_0", &MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } @@ -35,6 +43,13 @@ static void Call_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJo { LookupUnmanagedCallersOnlyMethodByName("System.Threading.ThreadPool, System.Private.CoreLib", "BackgroundJobHandler", &MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid != nullptr) + { + ((void(*)())r2rCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid)(); + return; + } ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid, nullptr, 0, nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); } @@ -46,13 +61,20 @@ extern "C" void SystemJS_ExecuteBackgroundJobCallback() static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid = nullptr; static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "BindAssemblyExports", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); + if (r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); } @@ -64,39 +86,60 @@ extern "C" void SystemInteropJS_BindAssemblyExports(void * arg0) static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.InitHelpers, System.Private.CoreLib", "CallClassConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallDefaultConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid = nullptr; static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "CallDelegate", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); + if (r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); } @@ -108,26 +151,40 @@ extern "C" void SystemInteropJS_CallDelegate(void * arg0) static MethodDesc* MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "CallEntryPoint", &MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, int32_t, void *))r2rCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid = nullptr; static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid(int32_t arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "CallJSExport", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); + if (r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid != nullptr) + { + ((void(*)(int32_t, void *))r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); } @@ -139,78 +196,120 @@ extern "C" void SystemInteropJS_CallJSExport(int32_t arg0, void * arg1) static MethodDesc* MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "CallStartupHook", &MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallToString", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid(void * arg0, int32_t arg1, uint32_t arg2, int64_t arg3, int64_t arg4, void * arg5, void * arg6) { - int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Diagnostics.Tracing.EventPipeEventProvider, System.Private.CoreLib", "Callback", &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, uint32_t, int64_t, int64_t, void *, void *))r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + return; + } + int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid = nullptr; static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "CompleteTask", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); + if (r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); } @@ -222,65 +321,98 @@ extern "C" void SystemInteropJS_CompleteTask(void * arg0) static MethodDesc* MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, int64_t arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "ConfigCallback", &MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); + if (r2rCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, int32_t, int64_t))r2rCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = nullptr; static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToNative", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32)(arg0, arg1); + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); @@ -290,130 +422,198 @@ static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Conve static MethodDesc* MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.LoaderAllocator, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, void * arg4, void * arg5) { - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.TypeLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + return; + } + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid(int32_t arg0, void * arg1, void * arg2, int32_t arg3, void * arg4, void * arg5, void * arg6) { - int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.IO.FileLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(int32_t, void *, void *, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + return; + } + int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid(int32_t arg0, void * arg1, void * arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateArgumentException", &MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(int32_t, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "CreateAssemblyName", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateRuntimeWrappedException", &MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTargetInvocationException", &MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTypeInitializationException", &MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Globalization.CalendarData, System.Private.CoreLib", "EnumCalendarInfoCallback", &MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "ExecuteInDefaultAppDomain", &MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32)(arg0, arg1, arg2); + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); @@ -423,52 +623,78 @@ static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAp static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetCodeInfo", &MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + return; + } + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "GetCustomMarshalerInstance", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetEHInfo", &MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "GetFunctionPointer", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); + } + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); @@ -478,52 +704,80 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "GetInterfaceImplementation", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetJitContext", &MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetLocalsSignature", &MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid = nullptr; static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "GetManagedStackTrace", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); + if (r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); } @@ -535,169 +789,258 @@ extern "C" void SystemInteropJS_GetManagedStackTrace(void * arg0) static MethodDesc* MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "GetResourceString", &MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetStringLiteral", &MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, int32_t arg3, void * arg4, void * arg5, void * arg6) { - int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.TypeNameResolver, System.Private.CoreLib", "GetTypeHelper", &MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + return; + } + int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "InitializeCommandLineArgs", &MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "InitializeDefaultContext", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Diagnostics.Tracing.EventSource, System.Private.CoreLib", "InitializeDefaultEventSources", &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, uint32_t arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Threading.Lock, System.Private.CoreLib", "InitializeForMonitor", &MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, uint32_t, void *))r2rCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "InternalPreserveStackTrace", &MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "InvokeArrayContentsConverter", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "IsInterfaceImplemented", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToUnmanaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = nullptr; static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, int32_t arg2, uint32_t arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.NativeLibrary, System.Private.CoreLib", "LoadLibraryCallbackStub", &MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *, int32_t, uint32_t, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4); + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); @@ -707,26 +1050,38 @@ static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeL static MethodDesc* MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "ManagedStartup", &MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewExternalTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32)(arg0, arg1); + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); @@ -736,13 +1091,18 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedExternalTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32)(arg0); + } + int64_t args[1] = { (int64_t)arg0 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); @@ -752,13 +1112,18 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedProxyTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32)(arg0); + } + int64_t args[1] = { (int64_t)arg0 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); @@ -768,13 +1133,18 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewProxyTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32)(arg0, arg1); + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); @@ -784,130 +1154,200 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnFirstChanceException", &MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnProcessExit", &MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnResourceResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "OnThreadExited", &MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnTypeResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnUnhandledException", &MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "ParseAsAssemblySpec", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid = nullptr; static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "ReleaseJSOwnedObjectByGCHandle", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); + if (r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); } @@ -919,65 +1359,98 @@ extern "C" void SystemInteropJS_ReleaseJSOwnedObjectByGCHandle(void * arg0) static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "Resolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveSatelliteAssembly", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, int32_t arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveSignature", &MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4, void * arg5) { - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveToken", &MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + return; + } + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = nullptr; static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDll", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32)(arg0, arg1, arg2); + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); @@ -987,13 +1460,18 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = nullptr; static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDllUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3); + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); @@ -1003,52 +1481,80 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhRethrow", &MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid(uint32_t arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowHwEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid != nullptr) + { + ((void(*)(uint32_t, void *))r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } @@ -1060,7 +1566,12 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( { LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "RunFinalizers", &MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); } - + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); + if (r2rCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 != nullptr) + { + return ((uint32_t(*)())r2rCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32)(); + } uint32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, nullptr, 0, (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); return result; @@ -1069,52 +1580,80 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( static MethodDesc* MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "Setup", &MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, void *))r2rCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StartAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "StartCallback", &MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StopAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); } @@ -1126,6 +1665,13 @@ static void Call_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler { LookupUnmanagedCallersOnlyMethodByName("System.Threading.TimerQueue, System.Private.CoreLib", "TimerHandler", &MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid != nullptr) + { + ((void(*)())r2rCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid)(); + return; + } ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid, nullptr, 0, nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); } diff --git a/src/coreclr/vm/wasm/helpers.cpp b/src/coreclr/vm/wasm/helpers.cpp index 998c970e90a5a6..c9d8a9c3c09ade 100644 --- a/src/coreclr/vm/wasm/helpers.cpp +++ b/src/coreclr/vm/wasm/helpers.cpp @@ -1704,35 +1704,53 @@ void* GetUnboxingStub(MethodDesc* pMD, MethodDesc** ppTargetMethodDesc, PCODE* p return unboxingStub; } -void* GetUnmanagedCallersOnlyThunk(MethodDesc* pMD) +// Returns the directly-callable R2R native entrypoint for an UnmanagedCallersOnly method, or NULL when the +// method has no native code (it runs interpreted). Probes for precompiled R2R code and publishes it into the +// portable entrypoint WITHOUT compiling interpreter byte code. Shared by GetUnmanagedCallersOnlyThunk and the +// generated reverse thunks so an R2R-compiled callback bypasses the interpreter (and the interp->R2R thunk) +// under partial R2R, calling its native entrypoint directly with the native ABI. +extern "C" void* GetR2RNativeCodeForUnmanagedCallersOnly(MethodDesc* pMD) { STANDARD_VM_CONTRACT; _ASSERTE(pMD != NULL); _ASSERTE(pMD->HasUnmanagedCallersOnlyAttribute()); - // Prefer R2R-compiled native code for UnmanagedCallersOnly methods since it is emitted - // with the native (unmanaged) calling convention and its R2R code is itself the directly-callable - // unmanaged entrypoint. Resolve the method's code first and, if it has native (R2R) code, return that - // entrypoint directly. The g_ReverseThunks interpreter fallback below is only required for methods - // that are executed by the interpreter (no native code), and is intentionally unused for R2R methods. PCODE entryPoint = pMD->GetPortableEntryPoint(); if (!PortableEntryPoint::HasNativeEntryPoint(entryPoint) && pMD->GetInterpreterCode() == NULL) { - // The method has not been prepared yet. Probe for precompiled R2R native code and, if present, - // publish it into the portable entrypoint WITHOUT compiling interpreter byte code. Purely - // interpreted methods are intentionally left unprepared here so that their byte code is generated - // lazily on first call through the reverse thunk below (better for startup). For R2R methods we - // run the prestub to perform the canonical full preparation; it finds the R2R code first and never - // falls back to compiling byte code. + // Purely interpreted methods are intentionally left unprepared here so that their byte code is + // generated lazily on first call through the reverse thunk (better for startup). For R2R methods the + // prestub performs the canonical preparation; it finds the R2R code first and never compiles byte code. if (pMD->TryPublishR2RCodeForUnmanagedCallersOnly()) { (void)pMD->DoPrestub(NULL /* MethodTable */, CallerGCMode::Preemptive); } + // The publish/prestub above can update the method's portable entrypoint; re-read it so the R2R + // native code just published is observed instead of the stale snapshot captured above. + entryPoint = pMD->GetPortableEntryPoint(); } if (PortableEntryPoint::HasNativeEntryPoint(entryPoint)) { return PortableEntryPoint::GetActualCode(entryPoint); } + return nullptr; +} + +void* GetUnmanagedCallersOnlyThunk(MethodDesc* pMD) +{ + STANDARD_VM_CONTRACT; + _ASSERTE(pMD != NULL); + _ASSERTE(pMD->HasUnmanagedCallersOnlyAttribute()); + + // Prefer R2R-compiled native code for UnmanagedCallersOnly methods since it is emitted with the native + // (unmanaged) calling convention and is itself the directly-callable unmanaged entrypoint. The + // g_ReverseThunks interpreter fallback below is only required for methods executed by the interpreter + // (no native code), and is intentionally unused for R2R methods. + void* r2rCode = GetR2RNativeCodeForUnmanagedCallersOnly(pMD); + if (r2rCode != nullptr) + { + return r2rCode; + } const ReverseThunkMapValue* value = LookupThunk(pMD); if (value == NULL) diff --git a/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp b/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp index dede69947952fb..e26cba0bad4ee6 100644 --- a/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp +++ b/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp @@ -13,173 +13,263 @@ // The current approach has limitations with overloaded methods. extern "C" void LookupUnmanagedCallersOnlyMethodByName(const char* fullQualifiedTypeName, const char* methodName, MethodDesc** ppMD); extern "C" void ExecuteInterpretedMethodFromUnmanaged(MethodDesc* pMD, int8_t* args, size_t argSize, int8_t* ret, PCODE callerIp); +extern "C" void* GetR2RNativeCodeForUnmanagedCallersOnly(MethodDesc* pMD); static MethodDesc* MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "g__Callback|72_0", &MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.InitHelpers, System.Private.CoreLib", "CallClassConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallDefaultConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "CallEntryPoint", &MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, int32_t, void *))r2rCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "CallStartupHook", &MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallToString", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, int64_t arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "ConfigCallback", &MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); + if (r2rCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, int32_t, int64_t))r2rCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = nullptr; static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToNative", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32)(arg0, arg1); + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); @@ -189,130 +279,198 @@ static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Conve static MethodDesc* MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.LoaderAllocator, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, void * arg4, void * arg5) { - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.TypeLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + return; + } + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid(int32_t arg0, void * arg1, void * arg2, int32_t arg3, void * arg4, void * arg5, void * arg6) { - int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.IO.FileLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(int32_t, void *, void *, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + return; + } + int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid(int32_t arg0, void * arg1, void * arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateArgumentException", &MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(int32_t, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "CreateAssemblyName", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateRuntimeWrappedException", &MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTargetInvocationException", &MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTypeInitializationException", &MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Globalization.CalendarData, System.Private.CoreLib", "EnumCalendarInfoCallback", &MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "ExecuteInDefaultAppDomain", &MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32)(arg0, arg1, arg2); + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); @@ -322,52 +480,78 @@ static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAp static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetCodeInfo", &MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + return; + } + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "GetCustomMarshalerInstance", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetEHInfo", &MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "GetFunctionPointer", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); + } + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); @@ -377,208 +561,318 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "GetInterfaceImplementation", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetJitContext", &MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetLocalsSignature", &MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "GetResourceString", &MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetStringLiteral", &MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, int32_t arg3, void * arg4, void * arg5, void * arg6) { - int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.TypeNameResolver, System.Private.CoreLib", "GetTypeHelper", &MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + return; + } + int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "InitializeCommandLineArgs", &MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "InitializeDefaultContext", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Diagnostics.Tracing.EventSource, System.Private.CoreLib", "InitializeDefaultEventSources", &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, uint32_t arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Threading.Lock, System.Private.CoreLib", "InitializeForMonitor", &MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, uint32_t, void *))r2rCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "InternalPreserveStackTrace", &MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "InvokeArrayContentsConverter", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "IsInterfaceImplemented", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToUnmanaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "LoadAssembly", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32)(arg0, arg1, arg2); + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); @@ -588,13 +882,18 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "LoadAssemblyAndGetFunctionPointer", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); + } + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); @@ -604,13 +903,18 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "LoadAssemblyBytes", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); + } + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); @@ -620,13 +924,18 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = nullptr; static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, int32_t arg2, uint32_t arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.NativeLibrary, System.Private.CoreLib", "LoadLibraryCallbackStub", &MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *, int32_t, uint32_t, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4); + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); @@ -636,26 +945,38 @@ static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeL static MethodDesc* MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "ManagedStartup", &MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewExternalTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32)(arg0, arg1); + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); @@ -665,13 +986,18 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedExternalTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32)(arg0); + } + int64_t args[1] = { (int64_t)arg0 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); @@ -681,13 +1007,18 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedProxyTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32)(arg0); + } + int64_t args[1] = { (int64_t)arg0 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); @@ -697,13 +1028,18 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = nullptr; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewProxyTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32)(arg0, arg1); + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); @@ -713,182 +1049,278 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnFirstChanceException", &MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnProcessExit", &MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnResourceResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "OnThreadExited", &MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnTypeResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnUnhandledException", &MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "ParseAsAssemblySpec", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "Resolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveSatelliteAssembly", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, int32_t arg2, void * arg3, void * arg4) { - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveSignature", &MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + return; + } + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4, void * arg5) { - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveToken", &MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + return; + } + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = nullptr; static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDll", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32)(arg0, arg1, arg2); + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); @@ -898,13 +1330,18 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = nullptr; static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDllUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3); + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); @@ -914,52 +1351,80 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhRethrow", &MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid(uint32_t arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowHwEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid != nullptr) + { + ((void(*)(uint32_t, void *))r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } @@ -971,7 +1436,12 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( { LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "RunFinalizers", &MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); } - + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); + if (r2rCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 != nullptr) + { + return ((uint32_t(*)())r2rCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32)(); + } uint32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, nullptr, 0, (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); return result; @@ -980,52 +1450,80 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( static MethodDesc* MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3) { - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "Setup", &MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, void *))r2rCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + return; + } + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StartAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + return; + } + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid(void * arg0) { - int64_t args[1] = { (int64_t)arg0 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "StartCallback", &MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid != nullptr) + { + ((void(*)(void *))r2rCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid)(arg0); + return; + } + int64_t args[1] = { (int64_t)arg0 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = nullptr; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid(void * arg0, void * arg1) { - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; - // Lazy lookup of MethodDesc for the function export scenario. if (!MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid) { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StopAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); } + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); + if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); + return; + } + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); } From 59cc1135b6a03982b09f27f9a96e0b11fb944202 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 23 Sep 2026 10:41:01 +0200 Subject: [PATCH 02/14] Cache R2R entrypoint lookup in reverse thunks; tidy fallback whitespace Addresses PR review: cache GetR2RNativeCodeForUnmanagedCallersOnly result in a per-callback static (like MD_*) so it runs at most once, and move the blank line to separate the R2R fast path from the interpreter fallback. --- .../PInvokeTableGenerator.cs | 13 +- .../vm/wasm/browser/callhelpers-reverse.cpp | 1047 ++++++++++++----- .../vm/wasm/wasi/callhelpers-reverse.cpp | 973 ++++++++++----- 3 files changed, 1409 insertions(+), 624 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs index e119d753a0a255..5413d4ae5eb00b 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs @@ -282,15 +282,15 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) // those instead. Every other type this emits reaches the slot unchanged through a cast. bool CarriesBits(int i) => parameterCTypes[i] is "float" or "double"; string argsDeclaration = parameterCount > 0 - ? $"\n int64_t args[{parameterCount}] = {{ {string.Join(", ", Enumerable.Range(0, parameterCount).Select(i => CarriesBits(i) ? "0" : $"(int64_t)arg{i}"))} }};\n" - + string.Concat(Enumerable.Range(0, parameterCount).Where(CarriesBits).Select(i => $" memcpy(&args[{i}], &arg{i}, sizeof(arg{i}));\n")) + ? $"\n\n int64_t args[{parameterCount}] = {{ {string.Join(", ", Enumerable.Range(0, parameterCount).Select(i => CarriesBits(i) ? "0" : $"(int64_t)arg{i}"))} }};" + + string.Concat(Enumerable.Range(0, parameterCount).Where(CarriesBits).Select(i => $"\n memcpy(&args[{i}], &arg{i}, sizeof(arg{i}));")) : string.Empty; string parametersDeclaration = string.Join(", ", parameterCTypes.Select((p, i) => $"{p} arg{i}")); string arguments = string.Join(", ", Enumerable.Range(0, parameterCount).Select(i => $"arg{i}")); // A partial R2R image can compile an UnmanagedCallersOnly callback to native code. That R2R code // is the directly-callable native entrypoint (same ABI as this wrapper's parameters), so dispatch // to it and skip the interpreter/interp->R2R path entirely. - string r2rVar = $"r2rCode_{cb.EntrySymbol}"; + string r2rVar = $"R2RCode_{cb.EntrySymbol}"; string paramTypesOnly = string.Join(", ", parameterCTypes); string r2rDispatch = cb.IsVoid ? $"((void(*)({paramTypesOnly})){r2rVar})({arguments});{w.NewLine} return;" @@ -308,6 +308,7 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) $$""" static MethodDesc* MD_{{cb.EntrySymbol}} = nullptr; + static void* {{r2rVar}} = (void*)(intptr_t)-1; static {{ MapType(cb.ReturnType)}} Call_{{cb.EntrySymbol}}({{parametersDeclaration}}) { @@ -317,7 +318,11 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) LookupUnmanagedCallersOnlyMethodByName("{{cb.TypeFullName}}, {{cb.AssemblyName}}", "{{cb.MethodName}}", &MD_{{cb.EntrySymbol}}); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* {{r2rVar}} = GetR2RNativeCodeForUnmanagedCallersOnly(MD_{{cb.EntrySymbol}}); + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if ({{r2rVar}} == (void*)(intptr_t)-1) + { + {{r2rVar}} = GetR2RNativeCodeForUnmanagedCallersOnly(MD_{{cb.EntrySymbol}}); + } if ({{r2rVar}} != nullptr) { {{r2rDispatch}} diff --git a/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp b/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp index b30d2db8e4db40..f128c0a2609b2a 100644 --- a/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp +++ b/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp @@ -16,6 +16,7 @@ extern "C" void ExecuteInterpretedMethodFromUnmanaged(MethodDesc* pMD, int8_t* a extern "C" void* GetR2RNativeCodeForUnmanagedCallersOnly(MethodDesc* pMD); static MethodDesc* MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -24,18 +25,23 @@ static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g_ LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "g__Callback|72_0", &MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *))r2rCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid)(arg0); + R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid != nullptr) + { + ((void(*)(void *))R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid() { // Lazy lookup of MethodDesc for the function export scenario. @@ -44,10 +50,14 @@ static void Call_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJo LookupUnmanagedCallersOnlyMethodByName("System.Threading.ThreadPool, System.Private.CoreLib", "BackgroundJobHandler", &MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid != nullptr) { - ((void(*)())r2rCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid)(); + ((void(*)())R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid)(); return; } ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid, nullptr, 0, nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); @@ -59,6 +69,7 @@ extern "C" void SystemJS_ExecuteBackgroundJobCallback() } static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid = nullptr; +static void* R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -67,14 +78,18 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "BindAssemblyExports", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); - if (r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); + } + if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid != nullptr) { - ((void(*)(void *))r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid)(arg0); + ((void(*)(void *))R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); } @@ -84,6 +99,7 @@ extern "C" void SystemInteropJS_BindAssemblyExports(void * arg0) } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -92,18 +108,23 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelp LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.InitHelpers, System.Private.CoreLib", "CallClassConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -112,18 +133,23 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallDefaultConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid = nullptr; +static void* R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -132,14 +158,18 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "CallDelegate", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); - if (r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); + } + if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid != nullptr) { - ((void(*)(void *))r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid)(arg0); + ((void(*)(void *))R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); } @@ -149,6 +179,7 @@ extern "C" void SystemInteropJS_CallDelegate(void * arg0) } static MethodDesc* MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -157,18 +188,23 @@ static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I3 LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "CallEntryPoint", &MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, int32_t, void *))r2rCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, int32_t, void *))R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid(int32_t arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -177,14 +213,18 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "CallJSExport", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); - if (r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); + } + if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid != nullptr) { - ((void(*)(int32_t, void *))r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(int32_t, void *))R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); } @@ -194,6 +234,7 @@ extern "C" void SystemInteropJS_CallJSExport(int32_t arg0, void * arg1) } static MethodDesc* MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -202,18 +243,23 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHo LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "CallStartupHook", &MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -222,18 +268,23 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallToString", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid(void * arg0, int32_t arg1, uint32_t arg2, int64_t arg3, int64_t arg4, void * arg5, void * arg6) { // Lazy lookup of MethodDesc for the function export scenario. @@ -242,18 +293,23 @@ static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEven LookupUnmanagedCallersOnlyMethodByName("System.Diagnostics.Tracing.EventPipeEventProvider, System.Private.CoreLib", "Callback", &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, int32_t, uint32_t, int64_t, int64_t, void *, void *))r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ((void(*)(void *, int32_t, uint32_t, int64_t, int64_t, void *, void *))R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); return; } - int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; + int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -262,18 +318,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -282,18 +343,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid = nullptr; +static void* R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -302,14 +368,18 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "CompleteTask", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); - if (r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *))r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid)(arg0); + R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); + } + if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid != nullptr) + { + ((void(*)(void *))R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); } @@ -319,6 +389,7 @@ extern "C" void SystemInteropJS_CompleteTask(void * arg0) } static MethodDesc* MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, int64_t arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -327,18 +398,23 @@ static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "ConfigCallback", &MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); - if (r2rCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, int32_t, int64_t))r2rCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, void *, int32_t, int64_t))R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -347,18 +423,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -367,18 +448,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -387,18 +473,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Convert LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -407,19 +498,24 @@ static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Conve LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToNative", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((void *(*)(void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32)(arg0, arg1); } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -428,18 +524,23 @@ static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create LookupUnmanagedCallersOnlyMethodByName("System.Reflection.LoaderAllocator, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -448,18 +549,23 @@ static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_ LookupUnmanagedCallersOnlyMethodByName("System.TypeLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + ((void(*)(void *, void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); return; } - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid(int32_t arg0, void * arg1, void * arg2, int32_t arg3, void * arg4, void * arg5, void * arg6) { // Lazy lookup of MethodDesc for the function export scenario. @@ -468,18 +574,23 @@ static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I LookupUnmanagedCallersOnlyMethodByName("System.IO.FileLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(int32_t, void *, void *, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(int32_t, void *, void *, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); return; } - int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; + int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid(int32_t arg0, void * arg1, void * arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -488,18 +599,23 @@ static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateArgumentException", &MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(int32_t, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(int32_t, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -508,18 +624,23 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAss LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "CreateAssemblyName", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -528,18 +649,23 @@ static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedExc LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateRuntimeWrappedException", &MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -548,18 +674,23 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationE LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTargetInvocationException", &MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -568,18 +699,23 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializatio LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTypeInitializationException", &MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -588,18 +724,23 @@ static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCa LookupUnmanagedCallersOnlyMethodByName("System.Globalization.CalendarData, System.Private.CoreLib", "EnumCalendarInfoCallback", &MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -608,19 +749,24 @@ static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAp LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "ExecuteInDefaultAppDomain", &MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32)(arg0, arg1, arg2); + R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32)(arg0, arg1, arg2); } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -629,18 +775,23 @@ static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_ LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetCodeInfo", &MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + ((void(*)(void *, void *, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); return; } - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -649,18 +800,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "GetCustomMarshalerInstance", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -669,18 +825,23 @@ static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I3 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetEHInfo", &MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -689,19 +850,24 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "GetFunctionPointer", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); + R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); } - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -710,18 +876,23 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "GetInterfaceImplementation", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -730,18 +901,23 @@ static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I3 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetJitContext", &MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -750,18 +926,23 @@ static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetLocalsSignature", &MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid = nullptr; +static void* R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -770,14 +951,18 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "GetManagedStackTrace", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); - if (r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *))r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid)(arg0); + R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); + } + if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid != nullptr) + { + ((void(*)(void *))R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); } @@ -787,6 +972,7 @@ extern "C" void SystemInteropJS_GetManagedStackTrace(void * arg0) } static MethodDesc* MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -795,18 +981,23 @@ static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32 LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "GetResourceString", &MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -815,18 +1006,23 @@ static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetStringLiteral", &MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, int32_t arg3, void * arg4, void * arg5, void * arg6) { // Lazy lookup of MethodDesc for the function export scenario. @@ -835,18 +1031,23 @@ static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTy LookupUnmanagedCallersOnlyMethodByName("System.Reflection.TypeNameResolver, System.Private.CoreLib", "GetTypeHelper", &MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, int32_t, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); return; } - int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; + int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -855,18 +1056,23 @@ static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLine LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "InitializeCommandLineArgs", &MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -875,18 +1081,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "InitializeDefaultContext", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid != nullptr) { - ((void(*)(void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid)(arg0); + ((void(*)(void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -895,18 +1106,23 @@ static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_I LookupUnmanagedCallersOnlyMethodByName("System.Diagnostics.Tracing.EventSource, System.Private.CoreLib", "InitializeDefaultEventSources", &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *))r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid)(arg0); + R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid != nullptr) + { + ((void(*)(void *))R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, uint32_t arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -915,18 +1131,23 @@ static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonit LookupUnmanagedCallersOnlyMethodByName("System.Threading.Lock, System.Private.CoreLib", "InitializeForMonitor", &MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, int32_t, uint32_t, void *))r2rCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, int32_t, uint32_t, void *))R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -935,18 +1156,23 @@ static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTr LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "InternalPreserveStackTrace", &MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -955,18 +1181,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArr LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "InvokeArrayContentsConverter", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -975,18 +1206,23 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "IsInterfaceImplemented", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -995,18 +1231,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1015,18 +1256,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToUnmanaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, int32_t arg2, uint32_t arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1035,19 +1281,24 @@ static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeL LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.NativeLibrary, System.Private.CoreLib", "LoadLibraryCallbackStub", &MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((void *(*)(void *, void *, int32_t, uint32_t, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *, int32_t, uint32_t, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4); } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1056,18 +1307,23 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartu LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "ManagedStartup", &MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1076,19 +1332,24 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewExternalTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32)(arg0, arg1); } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1097,19 +1358,24 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedExternalTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32)(arg0); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32)(arg0); } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1118,19 +1384,24 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedProxyTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32)(arg0); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32)(arg0); } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1139,19 +1410,24 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewProxyTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32)(arg0, arg1); } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1160,18 +1436,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1180,18 +1461,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1200,18 +1486,23 @@ static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnFirstChanceException", &MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1220,18 +1511,23 @@ static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetV LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnProcessExit", &MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid != nullptr) { - ((void(*)(void *))r2rCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid)(arg0); + ((void(*)(void *))R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1240,18 +1536,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnResourceResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1260,18 +1561,23 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "OnThreadExited", &MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1280,18 +1586,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnTypeResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1300,18 +1611,23 @@ static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnUnhandledException", &MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1320,18 +1636,23 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAs LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "ParseAsAssemblySpec", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid = nullptr; +static void* R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1340,14 +1661,18 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "ReleaseJSOwnedObjectByGCHandle", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); - if (r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *))r2rCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid)(arg0); + R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); + } + if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid != nullptr) + { + ((void(*)(void *))R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); } @@ -1357,6 +1682,7 @@ extern "C" void SystemInteropJS_ReleaseJSOwnedObjectByGCHandle(void * arg0) } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1365,18 +1691,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "Resolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1385,18 +1716,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveSatelliteAssembly", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1405,18 +1741,23 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveSignature", &MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, int32_t, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1425,18 +1766,23 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveToken", &MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, int32_t, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + ((void(*)(void *, int32_t, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); return; } - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1445,19 +1791,24 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDll", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((void *(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32)(arg0, arg1, arg2); + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32)(arg0, arg1, arg2); } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1466,19 +1817,24 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDllUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((void *(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3); } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1487,18 +1843,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1507,18 +1868,23 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetV LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhRethrow", &MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1527,18 +1893,23 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetV LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid(uint32_t arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1547,18 +1918,23 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_Re LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowHwEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(uint32_t, void *))r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid != nullptr) + { + ((void(*)(uint32_t, void *))R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = (void*)(intptr_t)-1; static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32() { // Lazy lookup of MethodDesc for the function export scenario. @@ -1567,10 +1943,14 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "RunFinalizers", &MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); - if (r2rCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 == (void*)(intptr_t)-1) { - return ((uint32_t(*)())r2rCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32)(); + R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 != nullptr) + { + return ((uint32_t(*)())R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32)(); } uint32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, nullptr, 0, (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); @@ -1578,6 +1958,7 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1586,18 +1967,23 @@ static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_ LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "Setup", &MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, int32_t, void *))r2rCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, int32_t, void *))R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1606,18 +1992,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StartAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1626,18 +2017,23 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I3 LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "StartCallback", &MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *))r2rCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid)(arg0); + R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid != nullptr) + { + ((void(*)(void *))R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1646,18 +2042,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StopAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid() { // Lazy lookup of MethodDesc for the function export scenario. @@ -1666,10 +2067,14 @@ static void Call_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler LookupUnmanagedCallersOnlyMethodByName("System.Threading.TimerQueue, System.Private.CoreLib", "TimerHandler", &MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid != nullptr) { - ((void(*)())r2rCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid)(); + ((void(*)())R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid)(); return; } ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid, nullptr, 0, nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); diff --git a/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp b/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp index e26cba0bad4ee6..c02f78ebcb3853 100644 --- a/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp +++ b/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp @@ -16,6 +16,7 @@ extern "C" void ExecuteInterpretedMethodFromUnmanaged(MethodDesc* pMD, int8_t* a extern "C" void* GetR2RNativeCodeForUnmanagedCallersOnly(MethodDesc* pMD); static MethodDesc* MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -24,18 +25,23 @@ static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g_ LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "g__Callback|72_0", &MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *))r2rCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid)(arg0); + R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid != nullptr) + { + ((void(*)(void *))R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -44,18 +50,23 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelp LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.InitHelpers, System.Private.CoreLib", "CallClassConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -64,18 +75,23 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallDefaultConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -84,18 +100,23 @@ static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I3 LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "CallEntryPoint", &MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, int32_t, void *))r2rCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, int32_t, void *))R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -104,18 +125,23 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHo LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "CallStartupHook", &MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -124,18 +150,23 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallToString", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -144,18 +175,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -164,18 +200,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, int64_t arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -184,18 +225,23 @@ static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "ConfigCallback", &MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); - if (r2rCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, int32_t, int64_t))r2rCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, void *, int32_t, int64_t))R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -204,18 +250,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -224,18 +275,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -244,18 +300,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Convert LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -264,19 +325,24 @@ static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Conve LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToNative", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((void *(*)(void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32)(arg0, arg1); } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -285,18 +351,23 @@ static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create LookupUnmanagedCallersOnlyMethodByName("System.Reflection.LoaderAllocator, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -305,18 +376,23 @@ static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_ LookupUnmanagedCallersOnlyMethodByName("System.TypeLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); return; } - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid(int32_t arg0, void * arg1, void * arg2, int32_t arg3, void * arg4, void * arg5, void * arg6) { // Lazy lookup of MethodDesc for the function export scenario. @@ -325,18 +401,23 @@ static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I LookupUnmanagedCallersOnlyMethodByName("System.IO.FileLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(int32_t, void *, void *, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ((void(*)(int32_t, void *, void *, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); return; } - int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; + int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid(int32_t arg0, void * arg1, void * arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -345,18 +426,23 @@ static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateArgumentException", &MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(int32_t, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(int32_t, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -365,18 +451,23 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAss LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "CreateAssemblyName", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -385,18 +476,23 @@ static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedExc LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateRuntimeWrappedException", &MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -405,18 +501,23 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationE LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTargetInvocationException", &MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -425,18 +526,23 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializatio LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTypeInitializationException", &MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -445,18 +551,23 @@ static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCa LookupUnmanagedCallersOnlyMethodByName("System.Globalization.CalendarData, System.Private.CoreLib", "EnumCalendarInfoCallback", &MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -465,19 +576,24 @@ static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAp LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "ExecuteInDefaultAppDomain", &MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32)(arg0, arg1, arg2); + R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32)(arg0, arg1, arg2); } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -486,18 +602,23 @@ static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_ LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetCodeInfo", &MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + ((void(*)(void *, void *, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); return; } - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -506,18 +627,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "GetCustomMarshalerInstance", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -526,18 +652,23 @@ static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I3 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetEHInfo", &MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -546,19 +677,24 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "GetFunctionPointer", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); + R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); } - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -567,18 +703,23 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "GetInterfaceImplementation", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -587,18 +728,23 @@ static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I3 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetJitContext", &MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -607,18 +753,23 @@ static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetLocalsSignature", &MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -627,18 +778,23 @@ static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32 LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "GetResourceString", &MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -647,18 +803,23 @@ static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetStringLiteral", &MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, int32_t arg3, void * arg4, void * arg5, void * arg6) { // Lazy lookup of MethodDesc for the function export scenario. @@ -667,18 +828,23 @@ static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTy LookupUnmanagedCallersOnlyMethodByName("System.Reflection.TypeNameResolver, System.Private.CoreLib", "GetTypeHelper", &MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, int32_t, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ((void(*)(void *, void *, int32_t, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); return; } - int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; + int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -687,18 +853,23 @@ static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLine LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "InitializeCommandLineArgs", &MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, int32_t, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -707,18 +878,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "InitializeDefaultContext", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid)(arg0); + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid != nullptr) + { + ((void(*)(void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -727,18 +903,23 @@ static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_I LookupUnmanagedCallersOnlyMethodByName("System.Diagnostics.Tracing.EventSource, System.Private.CoreLib", "InitializeDefaultEventSources", &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *))r2rCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid)(arg0); + R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid != nullptr) + { + ((void(*)(void *))R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, uint32_t arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -747,18 +928,23 @@ static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonit LookupUnmanagedCallersOnlyMethodByName("System.Threading.Lock, System.Private.CoreLib", "InitializeForMonitor", &MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, int32_t, uint32_t, void *))r2rCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, uint32_t, void *))R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -767,18 +953,23 @@ static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTr LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "InternalPreserveStackTrace", &MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -787,18 +978,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArr LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "InvokeArrayContentsConverter", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -807,18 +1003,23 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "IsInterfaceImplemented", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -827,18 +1028,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -847,18 +1053,23 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToUnmanaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -867,19 +1078,24 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "LoadAssembly", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32)(arg0, arg1, arg2); + R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32)(arg0, arg1, arg2); } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -888,19 +1104,24 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "LoadAssemblyAndGetFunctionPointer", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); + R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); } - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -909,19 +1130,24 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "LoadAssemblyBytes", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); + R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); } - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, int32_t arg2, uint32_t arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -930,19 +1156,24 @@ static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeL LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.NativeLibrary, System.Private.CoreLib", "LoadLibraryCallbackStub", &MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((void *(*)(void *, void *, int32_t, uint32_t, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *, int32_t, uint32_t, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4); } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -951,18 +1182,23 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartu LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "ManagedStartup", &MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -971,19 +1207,24 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewExternalTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32)(arg0, arg1); } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -992,19 +1233,24 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedExternalTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32)(arg0); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32)(arg0); } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1013,19 +1259,24 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedProxyTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32)(arg0); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32)(arg0); } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1034,19 +1285,24 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewProxyTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((int32_t(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 != nullptr) + { + return ((int32_t(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32)(arg0, arg1); } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; int32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1055,18 +1311,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1075,18 +1336,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1095,18 +1361,23 @@ static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnFirstChanceException", &MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1115,18 +1386,23 @@ static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetV LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnProcessExit", &MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid != nullptr) { - ((void(*)(void *))r2rCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid)(arg0); + ((void(*)(void *))R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1135,18 +1411,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnResourceResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1155,18 +1436,23 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "OnThreadExited", &MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1175,18 +1461,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnTypeResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1195,18 +1486,23 @@ static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnUnhandledException", &MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1215,18 +1511,23 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAs LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "ParseAsAssemblySpec", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1235,18 +1536,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "Resolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1255,18 +1561,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveSatelliteAssembly", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1275,18 +1586,23 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveSignature", &MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, int32_t, int32_t, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); return; } - int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; + int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1295,18 +1611,23 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveToken", &MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, int32_t, void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, int32_t, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); return; } - int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; + int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1315,19 +1636,24 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDll", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((void *(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32)(arg0, arg1, arg2); + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32)(arg0, arg1, arg2); } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1336,19 +1662,24 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDllUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) { - return ((void *(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 != nullptr) + { + return ((void *(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3); } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; void * result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, (int8_t*)args, sizeof(args), (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1357,18 +1688,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1377,18 +1713,23 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetV LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhRethrow", &MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1397,18 +1738,23 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetV LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid(uint32_t arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1417,18 +1763,23 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_Re LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowHwEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(uint32_t, void *))r2rCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid != nullptr) + { + ((void(*)(uint32_t, void *))R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = nullptr; +static void* R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = (void*)(intptr_t)-1; static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32() { // Lazy lookup of MethodDesc for the function export scenario. @@ -1437,10 +1788,14 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "RunFinalizers", &MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); - if (r2rCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 == (void*)(intptr_t)-1) { - return ((uint32_t(*)())r2rCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32)(); + R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); + } + if (R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 != nullptr) + { + return ((uint32_t(*)())R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32)(); } uint32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, nullptr, 0, (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); @@ -1448,6 +1803,7 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1456,18 +1812,23 @@ static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_ LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "Setup", &MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *, int32_t, void *))r2rCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *, int32_t, void *))R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); return; } - int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; + int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1476,18 +1837,23 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StartAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid != nullptr) { - ((void(*)(void *, void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid)(arg0, arg1, arg2); return; } - int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; + int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1496,18 +1862,23 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I3 LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "StartCallback", &MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid == (void*)(intptr_t)-1) + { + R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid != nullptr) { - ((void(*)(void *))r2rCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid)(arg0); + ((void(*)(void *))R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid)(arg0); return; } - int64_t args[1] = { (int64_t)arg0 }; + int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = nullptr; +static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1516,14 +1887,18 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StopAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - void* r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); - if (r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid != nullptr) + // Cache the lookup: a method's native-code availability is fixed after first prepare. + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid == (void*)(intptr_t)-1) { - ((void(*)(void *, void *))r2rCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); + R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); + } + if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid != nullptr) + { + ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); return; } - int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; + int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); } From 82c18a97570adc9b69b2780d160a5dbba583f3d8 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 23 Sep 2026 12:44:07 +0200 Subject: [PATCH 03/14] Guard R2R reverse-thunk dispatch: skip by-ref returns, volatile-publish cache Addresses PR review: skip the direct R2R call for callbacks whose return is passed by a hidden buffer (their wasm function type would not match the declared cast), and publish the cached entrypoint with VolatileLoad/VolatileStore so concurrent first calls cannot tear the pointer. --- .../PInvokeTableGenerator.cs | 44 +- .../vm/wasm/browser/callhelpers-reverse.cpp | 972 ++++++++++-------- .../vm/wasm/wasi/callhelpers-reverse.cpp | 900 +++++++++------- 3 files changed, 1120 insertions(+), 796 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs index 5413d4ae5eb00b..7ba04a3c837eb8 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs @@ -289,12 +289,35 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) string arguments = string.Join(", ", Enumerable.Range(0, parameterCount).Select(i => $"arg{i}")); // A partial R2R image can compile an UnmanagedCallersOnly callback to native code. That R2R code // is the directly-callable native entrypoint (same ABI as this wrapper's parameters), so dispatch - // to it and skip the interpreter/interp->R2R path entirely. + // to it and skip the interpreter/interp->R2R path entirely. A by-reference struct return uses a + // hidden return-buffer pointer that this declared signature does not model, so skip the direct + // dispatch for those and let the interpreter fallback (which passes the buffer) handle them. + bool canDispatchR2R = cb.IsVoid || !IsPassedByReference(cb.ReturnType); string r2rVar = $"R2RCode_{cb.EntrySymbol}"; string paramTypesOnly = string.Join(", ", parameterCTypes); string r2rDispatch = cb.IsVoid - ? $"((void(*)({paramTypesOnly})){r2rVar})({arguments});{w.NewLine} return;" - : $"return (({MapType(cb.ReturnType)}(*)({paramTypesOnly})){r2rVar})({arguments});"; + ? $"((void(*)({paramTypesOnly}))r2r)({arguments});{w.NewLine} return;" + : $"return (({MapType(cb.ReturnType)}(*)({paramTypesOnly}))r2r)({arguments});"; + // Cache the resolved entrypoint in a per-callback static, published with a volatile store: + // these are native entry points that can be entered concurrently, and the value is computed + // identically on every call, so the racing read/write is benign but must not tear. + string r2rStaticDecl = canDispatchR2R + ? $"{w.NewLine}static void* {r2rVar} = (void*)(intptr_t)-1;" + : string.Empty; + string r2rSection = canDispatchR2R + ? w.NewLine + " // Prefer the R2R native entrypoint when this callback was compiled (partial R2R)." + + w.NewLine + " // Resolve once and cache; a method's native-code availability is fixed after first prepare." + + w.NewLine + $" void* r2r = VolatileLoad(&{r2rVar});" + + w.NewLine + " if (r2r == (void*)(intptr_t)-1)" + + w.NewLine + " {" + + w.NewLine + $" r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_{cb.EntrySymbol});" + + w.NewLine + $" VolatileStore(&{r2rVar}, r2r);" + + w.NewLine + " }" + + w.NewLine + " if (r2r != nullptr)" + + w.NewLine + " {" + + w.NewLine + $" {r2rDispatch}" + + w.NewLine + " }" + : string.Empty; string exportFunction = cb.IsExport ? $$""" @@ -307,8 +330,7 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) w.Write( $$""" - static MethodDesc* MD_{{cb.EntrySymbol}} = nullptr; - static void* {{r2rVar}} = (void*)(intptr_t)-1; + static MethodDesc* MD_{{cb.EntrySymbol}} = nullptr;{{r2rStaticDecl}} static {{ MapType(cb.ReturnType)}} Call_{{cb.EntrySymbol}}({{parametersDeclaration}}) { @@ -316,17 +338,7 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) if (!MD_{{cb.EntrySymbol}}) { LookupUnmanagedCallersOnlyMethodByName("{{cb.TypeFullName}}, {{cb.AssemblyName}}", "{{cb.MethodName}}", &MD_{{cb.EntrySymbol}}); - } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if ({{r2rVar}} == (void*)(intptr_t)-1) - { - {{r2rVar}} = GetR2RNativeCodeForUnmanagedCallersOnly(MD_{{cb.EntrySymbol}}); - } - if ({{r2rVar}} != nullptr) - { - {{r2rDispatch}} - }{{argsDeclaration}}{{ + }{{r2rSection}}{{argsDeclaration}}{{ (!cb.IsVoid ? $"{w.NewLine} {MapType(cb.ReturnType)} result;" : "")}} ExecuteInterpretedMethodFromUnmanaged(MD_{{cb.EntrySymbol}}, {{argsArgs}}, {{(cb.IsVoid ? "nullptr" : "(int8_t*)&result")}}, (PCODE)&Call_{{cb.EntrySymbol}});{{ (!cb.IsVoid ? $"{w.NewLine} return result;" : "")}} diff --git a/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp b/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp index f128c0a2609b2a..7afb08ab98bbea 100644 --- a/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp +++ b/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp @@ -25,14 +25,16 @@ static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g_ LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "g__Callback|72_0", &MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -50,14 +52,16 @@ static void Call_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJo LookupUnmanagedCallersOnlyMethodByName("System.Threading.ThreadPool, System.Private.CoreLib", "BackgroundJobHandler", &MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)())R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid)(); + ((void(*)())r2r)(); return; } ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid, nullptr, 0, nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); @@ -78,14 +82,16 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "BindAssemblyExports", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); + VolatileStore(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid, r2r); } - if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -108,14 +114,16 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelp LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.InitHelpers, System.Private.CoreLib", "CallClassConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -133,14 +141,16 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallDefaultConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -158,14 +168,16 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "CallDelegate", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); + VolatileStore(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid, r2r); } - if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -188,14 +200,16 @@ static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I3 LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "CallEntryPoint", &MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, int32_t, void *))R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, void *, int32_t, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -213,14 +227,16 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "CallJSExport", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(int32_t, void *))R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(int32_t, void *))r2r)(arg0, arg1); return; } @@ -243,14 +259,16 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHo LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "CallStartupHook", &MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -268,14 +286,16 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallToString", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -293,14 +313,16 @@ static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEven LookupUnmanagedCallersOnlyMethodByName("System.Diagnostics.Tracing.EventPipeEventProvider, System.Private.CoreLib", "Callback", &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, uint32_t, int64_t, int64_t, void *, void *))R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ((void(*)(void *, int32_t, uint32_t, int64_t, int64_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); return; } @@ -318,14 +340,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -343,14 +367,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -368,14 +394,16 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "CompleteTask", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); + VolatileStore(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid, r2r); } - if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -398,14 +426,16 @@ static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "ConfigCallback", &MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, int32_t, int64_t))R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, void *, int32_t, int64_t))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -423,14 +453,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -448,14 +480,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -473,14 +507,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Convert LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -498,14 +534,16 @@ static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Conve LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToNative", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((void *(*)(void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32)(arg0, arg1); + return ((void *(*)(void *, void *))r2r)(arg0, arg1); } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; @@ -524,14 +562,16 @@ static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create LookupUnmanagedCallersOnlyMethodByName("System.Reflection.LoaderAllocator, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -549,14 +589,16 @@ static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_ LookupUnmanagedCallersOnlyMethodByName("System.TypeLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + ((void(*)(void *, void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); return; } @@ -574,14 +616,16 @@ static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I LookupUnmanagedCallersOnlyMethodByName("System.IO.FileLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(int32_t, void *, void *, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ((void(*)(int32_t, void *, void *, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); return; } @@ -599,14 +643,16 @@ static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateArgumentException", &MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(int32_t, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(int32_t, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -624,14 +670,16 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAss LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "CreateAssemblyName", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -649,14 +697,16 @@ static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedExc LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateRuntimeWrappedException", &MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -674,14 +724,16 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationE LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTargetInvocationException", &MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -699,14 +751,16 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializatio LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTypeInitializationException", &MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -724,14 +778,16 @@ static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCa LookupUnmanagedCallersOnlyMethodByName("System.Globalization.CalendarData, System.Private.CoreLib", "EnumCalendarInfoCallback", &MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -749,14 +805,16 @@ static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAp LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "ExecuteInDefaultAppDomain", &MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32)(arg0, arg1, arg2); + return ((int32_t(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; @@ -775,14 +833,16 @@ static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_ LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetCodeInfo", &MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + ((void(*)(void *, void *, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); return; } @@ -800,14 +860,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "GetCustomMarshalerInstance", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -825,14 +887,16 @@ static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I3 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetEHInfo", &MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -850,14 +914,16 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "GetFunctionPointer", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *, void *, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); + return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; @@ -876,14 +942,16 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "GetInterfaceImplementation", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -901,14 +969,16 @@ static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I3 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetJitContext", &MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -926,14 +996,16 @@ static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetLocalsSignature", &MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -951,14 +1023,16 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "GetManagedStackTrace", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); + VolatileStore(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid, r2r); } - if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -981,14 +1055,16 @@ static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32 LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "GetResourceString", &MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -1006,14 +1082,16 @@ static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetStringLiteral", &MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1031,14 +1109,16 @@ static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTy LookupUnmanagedCallersOnlyMethodByName("System.Reflection.TypeNameResolver, System.Private.CoreLib", "GetTypeHelper", &MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, int32_t, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ((void(*)(void *, void *, int32_t, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); return; } @@ -1056,14 +1136,16 @@ static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLine LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "InitializeCommandLineArgs", &MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -1081,14 +1163,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "InitializeDefaultContext", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -1106,14 +1190,16 @@ static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_I LookupUnmanagedCallersOnlyMethodByName("System.Diagnostics.Tracing.EventSource, System.Private.CoreLib", "InitializeDefaultEventSources", &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -1131,14 +1217,16 @@ static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonit LookupUnmanagedCallersOnlyMethodByName("System.Threading.Lock, System.Private.CoreLib", "InitializeForMonitor", &MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, uint32_t, void *))R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, int32_t, uint32_t, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1156,14 +1244,16 @@ static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTr LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "InternalPreserveStackTrace", &MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1181,14 +1271,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArr LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "InvokeArrayContentsConverter", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -1206,14 +1298,16 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "IsInterfaceImplemented", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -1231,14 +1325,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -1256,14 +1352,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToUnmanaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -1281,14 +1379,16 @@ static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeL LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.NativeLibrary, System.Private.CoreLib", "LoadLibraryCallbackStub", &MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((void *(*)(void *, void *, int32_t, uint32_t, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4); + return ((void *(*)(void *, void *, int32_t, uint32_t, void *))r2r)(arg0, arg1, arg2, arg3, arg4); } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; @@ -1307,14 +1407,16 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartu LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "ManagedStartup", &MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1332,14 +1434,16 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewExternalTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32)(arg0, arg1); + return ((int32_t(*)(void *, void *))r2r)(arg0, arg1); } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; @@ -1358,14 +1462,16 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedExternalTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32)(arg0); + return ((int32_t(*)(void *))r2r)(arg0); } int64_t args[1] = { (int64_t)arg0 }; @@ -1384,14 +1490,16 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedProxyTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32)(arg0); + return ((int32_t(*)(void *))r2r)(arg0); } int64_t args[1] = { (int64_t)arg0 }; @@ -1410,14 +1518,16 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewProxyTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32)(arg0, arg1); + return ((int32_t(*)(void *, void *))r2r)(arg0, arg1); } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; @@ -1436,14 +1546,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1461,14 +1573,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1486,14 +1600,16 @@ static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnFirstChanceException", &MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1511,14 +1627,16 @@ static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetV LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnProcessExit", &MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -1536,14 +1654,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnResourceResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1561,14 +1681,16 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "OnThreadExited", &MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1586,14 +1708,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnTypeResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1611,14 +1735,16 @@ static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnUnhandledException", &MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1636,14 +1762,16 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAs LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "ParseAsAssemblySpec", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -1661,14 +1789,16 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports, System.Runtime.InteropServices.JavaScript", "ReleaseJSOwnedObjectByGCHandle", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); + VolatileStore(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid, r2r); } - if (R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -1691,14 +1821,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "Resolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1716,14 +1848,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveSatelliteAssembly", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1741,14 +1875,16 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveSignature", &MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, int32_t, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -1766,14 +1902,16 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveToken", &MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + ((void(*)(void *, int32_t, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); return; } @@ -1791,14 +1929,16 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDll", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((void *(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32)(arg0, arg1, arg2); + return ((void *(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; @@ -1817,14 +1957,16 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDllUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((void *(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3); + return ((void *(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; @@ -1843,14 +1985,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1868,14 +2012,16 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetV LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhRethrow", &MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1893,14 +2039,16 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetV LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1918,14 +2066,16 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_Re LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowHwEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(uint32_t, void *))R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(uint32_t, void *))r2r)(arg0, arg1); return; } @@ -1943,14 +2093,16 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "RunFinalizers", &MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 != nullptr) + if (r2r != nullptr) { - return ((uint32_t(*)())R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32)(); + return ((uint32_t(*)())r2r)(); } uint32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, nullptr, 0, (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); @@ -1967,14 +2119,16 @@ static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_ LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "Setup", &MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, int32_t, void *))R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, int32_t, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1992,14 +2146,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StartAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -2017,14 +2173,16 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I3 LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "StartCallback", &MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -2042,14 +2200,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StopAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -2067,14 +2227,16 @@ static void Call_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler LookupUnmanagedCallersOnlyMethodByName("System.Threading.TimerQueue, System.Private.CoreLib", "TimerHandler", &MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)())R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid)(); + ((void(*)())r2r)(); return; } ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid, nullptr, 0, nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); diff --git a/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp b/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp index c02f78ebcb3853..902a42b6c61bf9 100644 --- a/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp +++ b/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp @@ -25,14 +25,16 @@ static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g_ LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "g__Callback|72_0", &MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -50,14 +52,16 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelp LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.InitHelpers, System.Private.CoreLib", "CallClassConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -75,14 +79,16 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallDefaultConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -100,14 +106,16 @@ static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I3 LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "CallEntryPoint", &MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, int32_t, void *))R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, void *, int32_t, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -125,14 +133,16 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHo LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "CallStartupHook", &MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -150,14 +160,16 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallToString", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -175,14 +187,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -200,14 +214,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -225,14 +241,16 @@ static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "ConfigCallback", &MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, int32_t, int64_t))R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, void *, int32_t, int64_t))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -250,14 +268,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -275,14 +295,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -300,14 +322,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Convert LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -325,14 +349,16 @@ static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Conve LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToNative", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((void *(*)(void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32)(arg0, arg1); + return ((void *(*)(void *, void *))r2r)(arg0, arg1); } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; @@ -351,14 +377,16 @@ static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create LookupUnmanagedCallersOnlyMethodByName("System.Reflection.LoaderAllocator, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -376,14 +404,16 @@ static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_ LookupUnmanagedCallersOnlyMethodByName("System.TypeLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + ((void(*)(void *, void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); return; } @@ -401,14 +431,16 @@ static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I LookupUnmanagedCallersOnlyMethodByName("System.IO.FileLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(int32_t, void *, void *, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ((void(*)(int32_t, void *, void *, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); return; } @@ -426,14 +458,16 @@ static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateArgumentException", &MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(int32_t, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(int32_t, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -451,14 +485,16 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAss LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "CreateAssemblyName", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -476,14 +512,16 @@ static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedExc LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateRuntimeWrappedException", &MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -501,14 +539,16 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationE LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTargetInvocationException", &MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -526,14 +566,16 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializatio LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTypeInitializationException", &MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -551,14 +593,16 @@ static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCa LookupUnmanagedCallersOnlyMethodByName("System.Globalization.CalendarData, System.Private.CoreLib", "EnumCalendarInfoCallback", &MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -576,14 +620,16 @@ static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAp LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "ExecuteInDefaultAppDomain", &MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32)(arg0, arg1, arg2); + return ((int32_t(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; @@ -602,14 +648,16 @@ static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_ LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetCodeInfo", &MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + ((void(*)(void *, void *, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); return; } @@ -627,14 +675,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "GetCustomMarshalerInstance", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -652,14 +702,16 @@ static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I3 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetEHInfo", &MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -677,14 +729,16 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "GetFunctionPointer", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *, void *, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); + return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; @@ -703,14 +757,16 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "GetInterfaceImplementation", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -728,14 +784,16 @@ static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I3 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetJitContext", &MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -753,14 +811,16 @@ static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetLocalsSignature", &MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -778,14 +838,16 @@ static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32 LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "GetResourceString", &MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -803,14 +865,16 @@ static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetStringLiteral", &MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -828,14 +892,16 @@ static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTy LookupUnmanagedCallersOnlyMethodByName("System.Reflection.TypeNameResolver, System.Private.CoreLib", "GetTypeHelper", &MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, int32_t, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ((void(*)(void *, void *, int32_t, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); return; } @@ -853,14 +919,16 @@ static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLine LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "InitializeCommandLineArgs", &MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -878,14 +946,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "InitializeDefaultContext", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -903,14 +973,16 @@ static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_I LookupUnmanagedCallersOnlyMethodByName("System.Diagnostics.Tracing.EventSource, System.Private.CoreLib", "InitializeDefaultEventSources", &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -928,14 +1000,16 @@ static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonit LookupUnmanagedCallersOnlyMethodByName("System.Threading.Lock, System.Private.CoreLib", "InitializeForMonitor", &MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, uint32_t, void *))R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, int32_t, uint32_t, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -953,14 +1027,16 @@ static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTr LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "InternalPreserveStackTrace", &MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -978,14 +1054,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArr LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "InvokeArrayContentsConverter", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -1003,14 +1081,16 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "IsInterfaceImplemented", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -1028,14 +1108,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -1053,14 +1135,16 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToUnmanaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -1078,14 +1162,16 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "LoadAssembly", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32)(arg0, arg1, arg2); + return ((int32_t(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; @@ -1104,14 +1190,16 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "LoadAssemblyAndGetFunctionPointer", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *, void *, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); + return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; @@ -1130,14 +1218,16 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "LoadAssemblyBytes", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *, void *, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4, arg5); + return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; @@ -1156,14 +1246,16 @@ static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeL LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.NativeLibrary, System.Private.CoreLib", "LoadLibraryCallbackStub", &MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((void *(*)(void *, void *, int32_t, uint32_t, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3, arg4); + return ((void *(*)(void *, void *, int32_t, uint32_t, void *))r2r)(arg0, arg1, arg2, arg3, arg4); } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; @@ -1182,14 +1274,16 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartu LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "ManagedStartup", &MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1207,14 +1301,16 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewExternalTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32)(arg0, arg1); + return ((int32_t(*)(void *, void *))r2r)(arg0, arg1); } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; @@ -1233,14 +1329,16 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedExternalTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32)(arg0); + return ((int32_t(*)(void *))r2r)(arg0); } int64_t args[1] = { (int64_t)arg0 }; @@ -1259,14 +1357,16 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedProxyTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32)(arg0); + return ((int32_t(*)(void *))r2r)(arg0); } int64_t args[1] = { (int64_t)arg0 }; @@ -1285,14 +1385,16 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewProxyTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((int32_t(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32)(arg0, arg1); + return ((int32_t(*)(void *, void *))r2r)(arg0, arg1); } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; @@ -1311,14 +1413,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1336,14 +1440,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1361,14 +1467,16 @@ static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnFirstChanceException", &MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1386,14 +1494,16 @@ static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetV LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnProcessExit", &MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -1411,14 +1521,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnResourceResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1436,14 +1548,16 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "OnThreadExited", &MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1461,14 +1575,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnTypeResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1486,14 +1602,16 @@ static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnUnhandledException", &MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1511,14 +1629,16 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAs LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "ParseAsAssemblySpec", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -1536,14 +1656,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "Resolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1561,14 +1683,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveSatelliteAssembly", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1586,14 +1710,16 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveSignature", &MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, int32_t, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4); + ((void(*)(void *, int32_t, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); return; } @@ -1611,14 +1737,16 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32 LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveToken", &MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, int32_t, void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3, arg4, arg5); + ((void(*)(void *, int32_t, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); return; } @@ -1636,14 +1764,16 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDll", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((void *(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32)(arg0, arg1, arg2); + return ((void *(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; @@ -1662,14 +1792,16 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDllUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 != nullptr) + if (r2r != nullptr) { - return ((void *(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32)(arg0, arg1, arg2, arg3); + return ((void *(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; @@ -1688,14 +1820,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1713,14 +1847,16 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetV LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhRethrow", &MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1738,14 +1874,16 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetV LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } @@ -1763,14 +1901,16 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_Re LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowHwEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(uint32_t, void *))R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(uint32_t, void *))r2r)(arg0, arg1); return; } @@ -1788,14 +1928,16 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "RunFinalizers", &MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); + VolatileStore(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, r2r); } - if (R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 != nullptr) + if (r2r != nullptr) { - return ((uint32_t(*)())R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32)(); + return ((uint32_t(*)())r2r)(); } uint32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, nullptr, 0, (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); @@ -1812,14 +1954,16 @@ static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_ LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "Setup", &MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, int32_t, void *))R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid)(arg0, arg1, arg2, arg3); + ((void(*)(void *, void *, int32_t, void *))r2r)(arg0, arg1, arg2, arg3); return; } @@ -1837,14 +1981,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StartAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid)(arg0, arg1, arg2); + ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); return; } @@ -1862,14 +2008,16 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I3 LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "StartCallback", &MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *))R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid)(arg0); + ((void(*)(void *))r2r)(arg0); return; } @@ -1887,14 +2035,16 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StopAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Cache the lookup: a method's native-code availability is fixed after first prepare. - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid == (void*)(intptr_t)-1) + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); + if (r2r == (void*)(intptr_t)-1) { - R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); + VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, r2r); } - if (R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid != nullptr) + if (r2r != nullptr) { - ((void(*)(void *, void *))R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid)(arg0, arg1); + ((void(*)(void *, void *))r2r)(arg0, arg1); return; } From ea945e2d6f5ebebbeb8dbbe458436f32493a6369 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Wed, 23 Sep 2026 17:49:37 +0200 Subject: [PATCH 04/14] Provide VolatileLoad/VolatileStore in wasm callhelpers compat shim The reverse-thunk generator now publishes its cached R2R entrypoint with VolatileLoad/VolatileStore (from inc/volatile.h), which the in-tree VM build gets via vm/common.h. The generated callhelpers-reverse.cpp is also compiled standalone in the app/publish build with only coreclr_compat.h, which did not declare these helpers, so that compile failed with 'use of undeclared identifier'. Add minimal template equivalents to the shim; wasm is single-threaded so they reduce to a plain volatile access. Shared by both the browser and WASI app builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/mono/browser/build/coreclr_compat.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/mono/browser/build/coreclr_compat.h b/src/mono/browser/build/coreclr_compat.h index 551a2636eaa256..dd4b641e123299 100644 --- a/src/mono/browser/build/coreclr_compat.h +++ b/src/mono/browser/build/coreclr_compat.h @@ -19,6 +19,10 @@ // interp-to-managed file uses it but does not include that header. // * LF_INTEROP/LL_INFO1000/LOG/PORTABILITY_ASSERT -- CoreCLR logging // primitives used by callhelpers-pinvoke.cpp. +// * VolatileLoad/VolatileStore -- declared in inc/volatile.h in-tree; the +// reverse-thunk file uses them to publish its cached R2R entrypoint but +// does not include that header. wasm is single-threaded, so the in-tree +// memory-barrier machinery collapses to a plain volatile access here. // // Definitions for symbols declared by (g_portableCallHelperThunks, // g_ReverseThunks, ...) live in libcoreclr_static.a or in the same generated @@ -41,6 +45,22 @@ typedef uint32_t ULONG; #define INTERP_STACK_SLOT_SIZE 8u #endif +// CoreCLR volatile access helpers (inc/volatile.h). wasm is single-threaded, +// so these reduce to a plain volatile load/store with no memory barrier. +#ifdef __cplusplus +template +inline T VolatileLoad(T const * pt) +{ + return *(T volatile const *)pt; +} + +template +inline void VolatileStore(T* pt, T val) +{ + *(T volatile *)pt = val; +} +#endif // __cplusplus + // CoreCLR logging stubs. #define LF_INTEROP 0 #define LL_INFO1000 0 From 03d14047a113b24b4fbe960a1b99171cd2662e2a Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 24 Sep 2026 15:51:46 +0200 Subject: [PATCH 05/14] Test R2R native export callback dispatch on wasm Teach the runtime-test corerun harness to compile NativeFileReference sources, then exercise an R2R P/Invoke that calls back through a generated UnmanagedCallersOnly export. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/tests/Common/CLRTest.WasmCorerun.targets | 62 +++++++++++++------ .../WasmInterpreterTransitions.cs | 11 ++++ .../WasmInterpreterTransitions.csproj | 1 + .../wasm/WasmInterpreterTransitions/echo.c | 11 ++++ 4 files changed, 65 insertions(+), 20 deletions(-) create mode 100644 src/tests/readytorun/wasm/WasmInterpreterTransitions/echo.c diff --git a/src/tests/Common/CLRTest.WasmCorerun.targets b/src/tests/Common/CLRTest.WasmCorerun.targets index f77bee80745b10..22cba68a956f09 100644 --- a/src/tests/Common/CLRTest.WasmCorerun.targets +++ b/src/tests/Common/CLRTest.WasmCorerun.targets @@ -3,7 +3,7 @@ CLRTest.WasmCorerun.targets Builds a test-specific 'corerun' host for browser-wasm runtime tests whose managed code calls -into native code supplied by the test itself. +into native code supplied by the test itself through CMakeProjectReference or NativeFileReference. WebAssembly has no dynamic library loading, so a test's native library cannot be resolved at run time the way a .so/.dylib/.dll is elsewhere. It has to be linked into the host up front, together @@ -49,8 +49,9 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s projects are excluded: they never launch a host of their own, so a corerun built next to them would only waste build time and disk. Set WasmBuildTestCorerun=false to opt out. - Whether the test actually has native code is decided from @(CMakeProjectReference) on the - hook targets below, because item references are not allowed in an evaluation-time condition. + Whether the test actually has native code is decided from @(CMakeProjectReference) and + @(NativeFileReference) on the hook targets below, because item references are not allowed + in an evaluation-time condition. They also run when a corerun is already present, so that a project which drops its native code still gets the chance to clean the stale host out of its output directory. --> @@ -80,7 +81,7 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s --> $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'corerun-link')) + <_WasmCorerunDir>$([MSBuild]::NormalizeDirectory('$(IntermediateOutputPath)', 'wasm-corerun')) <_WasmCorerunTestLib Include="$(OutDir)*$(StaticLibSuffix)" /> + + + <_WasmCorerunNativeSource Include="@(NativeFileReference)" + Condition="'%(Extension)' == '.c' or '%(Extension)' == '.cpp'" + ObjectFile="$(_WasmCorerunDir)%(FileName).o" /> @@ -132,11 +139,11 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s '$(IsMergedTestRunnerAssembly)' == 'true'">true <_WasmCorerunSkip Condition="'$(WasmBuildTestCorerun)' != 'true'">true - <_WasmCorerunSkip Condition="'@(_WasmCorerunTestLib)' == ''">true + <_WasmCorerunSkip Condition="'@(_WasmCorerunTestLib)' == '' and '@(_WasmCorerunNativeSource)' == ''">true <_WasmCorerunSkip Condition="'$(_WasmCorerunRunsFromOutDir)' != 'true' and '$(InMergedTestDirectory)' == 'true'">true <_WasmCorerunSkipReason Condition="'$(WasmBuildTestCorerun)' != 'true'">the project opted out with WasmBuildTestCorerun=false - <_WasmCorerunSkipReason Condition="'$(_WasmCorerunSkipReason)' == '' and '@(_WasmCorerunTestLib)' == ''">there is no static library in $(OutDir) to link into it + <_WasmCorerunSkipReason Condition="'$(_WasmCorerunSkipReason)' == '' and '@(_WasmCorerunTestLib)' == '' and '@(_WasmCorerunNativeSource)' == ''">there is no native test code to link into it <_WasmCorerunSkipReason Condition="'$(_WasmCorerunSkipReason)' == '' and '$(_WasmCorerunSkip)' == 'true'">it runs from a merged wrapper's directory, which builds no corerun, so its native code stays unlinked and the checks that need it skip themselves @@ -168,9 +175,14 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s Text="WasmAppBuilder.dll was not found at '$(WasmAppBuilderDir)'. It is built by the 'tasks' subset into %24(TasksConfiguration)='$(TasksConfiguration)'; build the repo in that configuration, or pass /p:TasksConfiguration=<config> to the test build." /> + <_WasmCorerunEmcc Condition="'$(EmscriptenUpstreamEmscriptenPath)' != ''">$(EmscriptenUpstreamEmscriptenPath)emcc$(_WasmCorerunScriptExt) <_WasmCorerunEmxx Condition="'$(EmscriptenUpstreamEmscriptenPath)' != ''">$(EmscriptenUpstreamEmscriptenPath)em++$(_WasmCorerunScriptExt) + @@ -187,7 +199,6 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s live under obj, not next to the test: everything in $(OutDir) is sent to Helix, and these are worth about 300 KB per test there for no run-time purpose. Only corerun.js and corerun.wasm below belong in the output directory. --> - <_WasmCorerunDir>$([MSBuild]::NormalizeDirectory('$(IntermediateOutputPath)', 'wasm-corerun')) <_WasmCorerunInputManifest>$(_WasmCorerunDir)inputs.txt <_Crossgen2GeneratorRsp>$(_WasmCorerunDir)callhelpers-generator.rsp @@ -277,7 +288,7 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s @@ -287,16 +298,15 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s @@ -312,6 +322,7 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s + <_WasmCorerunPInvokeModule Include="@(_WasmCorerunNativeSource->'%(FileName)')" /> <_WasmCorerunPInvokeModule Include="@(_WasmCorerunTestLib->'%(FileName)')" /> @@ -361,16 +372,27 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s - + Inputs="@(_WasmCorerunGeneratedSource);@(_WasmCorerunNativeSource);@(_WasmCorerunKitInclude);$(_WasmCorerunCompileRsp);$(_WasmCorerunInputManifest)" + Outputs="@(_WasmCorerunGeneratedSource->'%(ObjectFile)');@(_WasmCorerunNativeSource->'%(ObjectFile)')"> + + + + + + @@ -385,12 +407,12 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s - <_WasmCorerunLinkInputs>@(_WasmCorerunGeneratedSource->'"%(ObjectFile)"', ' ') @(_WasmCorerunTestLib->'"%(FullPath)"', ' ') @(_WasmCorerunCommonLib->'"%(FullPath)"', ' ') + <_WasmCorerunLinkInputs>@(_WasmCorerunGeneratedSource->'"%(ObjectFile)"', ' ') @(_WasmCorerunNativeSource->'"%(ObjectFile)"', ' ') @(_WasmCorerunTestLib->'"%(FullPath)"', ' ') @(_WasmCorerunCommonLib->'"%(FullPath)"', ' ') native P/Invoke -> generated native-to-managed export -> R2R UCO. + Assert.Equal(A + C, Echo(A)); + // Reverse-pinvoke (UnmanagedCallersOnly) entry that re-enters managed code. crossgen2 must // thread the UCO method's $sp (loaded from the __stack_pointer global in its prolog) into the // R2R->interpreter thunk; passing 0 makes the thunk store below a null base and trap ("memory @@ -212,6 +217,12 @@ public static void TestEntryPoint() private static int s_sideEffect; + [DllImport("echo", EntryPoint = "echo")] + private static extern int Echo(int value); + + [UnmanagedCallersOnly(EntryPoint = "managed_echo")] + private static int ManagedEcho(int value) => value + C; + // Reverse-pinvoke entry (R2R-compiled) that calls an interpreted static int(int). private static unsafe delegate* unmanaged s_ucoToInterpreted = &UnmanagedCallerCallsInterpreted; diff --git a/src/tests/readytorun/wasm/WasmInterpreterTransitions/WasmInterpreterTransitions.csproj b/src/tests/readytorun/wasm/WasmInterpreterTransitions/WasmInterpreterTransitions.csproj index 35d837575a2ae2..96eac02283dc10 100644 --- a/src/tests/readytorun/wasm/WasmInterpreterTransitions/WasmInterpreterTransitions.csproj +++ b/src/tests/readytorun/wasm/WasmInterpreterTransitions/WasmInterpreterTransitions.csproj @@ -13,5 +13,6 @@ + diff --git a/src/tests/readytorun/wasm/WasmInterpreterTransitions/echo.c b/src/tests/readytorun/wasm/WasmInterpreterTransitions/echo.c new file mode 100644 index 00000000000000..0c3dafdb102689 --- /dev/null +++ b/src/tests/readytorun/wasm/WasmInterpreterTransitions/echo.c @@ -0,0 +1,11 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include + +extern int32_t managed_echo(int32_t value); + +int32_t echo(int32_t value) +{ + return managed_echo(value); +} From a3aceae049cc3f472cc48385181276284279303c Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 24 Sep 2026 16:12:41 +0200 Subject: [PATCH 06/14] Harden wasm R2R reverse thunk dispatch Reject multi-slot callback signatures before generating native wrappers, document why interpreter fallback thunks cannot recurse through R2R lookup, and use acquire/release atomics for cached entrypoint publication. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../WasmArgumentLayoutTests.cs | 51 +++++++++++++++++++ .../PInvokeTableGenerator.cs | 31 +++++++++++ src/coreclr/vm/wasm/helpers.cpp | 3 ++ src/mono/browser/build/coreclr_compat.h | 11 ++-- 4 files changed, 90 insertions(+), 6 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs index f510b504affc6a..0a3a3ad28f28d6 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs @@ -632,6 +632,57 @@ public void PortableCallHelpersGeneratorEncodesTypesTheSameWayInAndOutOfASignatu Assert.Equal(tokens[1], InteropSignature.GetAbiToken(type)); } + [Theory] + [InlineData("int", "System.Int128")] + [InlineData("System.Int128", "int")] + public void PortableCallHelpersGeneratorRejectsMultiSlotCallbacks(string returnType, string parameterType) + { + string source = $$""" + using System; + using System.Runtime.InteropServices; + + public static class Exports + { + [UnmanagedCallersOnly(EntryPoint = "callback")] + public static {{returnType}} Handle({{parameterType}} value) => default; + } + """; + + string workingDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + Directory.CreateDirectory(workingDirectory); + + try + { + string inputAssembly = CompileCallbackAssembly(source, Path.Combine(workingDirectory, "Callbacks.dll")); + var options = new PortableCallHelpersGeneratorOptions + { + OutputDirectory = Path.Combine(workingDirectory, "generated"), + TargetOS = "browser", + PInvokeModules = new[] { "libSystem.Native" }, + }; + + var log = new StringWriter(); + int exitCode = PortableCallHelpersGenerator.Run( + CreateWasmContext(inputAssembly), options, new Logger(log, isVerbose: false)); + + Assert.Equal(1, exitCode); + Assert.Contains("has multi-slot signature token 'l2'", log.ToString()); + } + finally + { + // The type system maps an input assembly with FileShare.Read and never releases it - the + // context is not disposable - so on Windows the compiled input cannot be deleted while + // this process lives. Cleaning up is best effort rather than a second way to fail. + try + { + Directory.Delete(workingDirectory, recursive: true); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) + { + } + } + } + private const string CoreLibSimpleName = "System.Private.CoreLib"; /// diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs index 7ba04a3c837eb8..f0128bad4c16fa 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs @@ -8,6 +8,8 @@ using System.Linq; using System.Text; +using ILCompiler.DependencyAnalysis.Wasm; +using Internal.JitInterface; using Internal.TypeSystem; using Internal.TypeSystem.Ecma; using Internal.TypeSystem.Interop; @@ -255,6 +257,7 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) callbacks.Sort(new PInvokeCallbackComparer()); foreach (PInvokeCallback cb in callbacks) { + RejectMultiSlotCallback(cb); cb.EntrySymbol = FixedSymbolName(cb); if (!callbackNames.Add(cb.EntrySymbol)) @@ -382,6 +385,34 @@ static void RejectAmbiguousExport(PInvokeCallback cb) throw new LogAsErrorException( $"Exported callback '{cb.EntryPoint}' cannot be resolved at run time: '{cb.TypeFullName}' declares more than one [UnmanagedCallersOnly] method named '{cb.MethodName}', and the runtime looks them up by name alone. Give them distinct names: {string.Join(", ", ambiguous)}"); } + + static void RejectMultiSlotCallback(PInvokeCallback cb) + { + List loweredTokens = InteropSignature.ParseSignatureTokens( + InteropSignature.GetMethodSignature(cb.Method, WasmLowering.LoweringFlags.IsUnmanagedCallersOnly)); + string token = null; + for (int i = 1; i < loweredTokens.Count; i++) + { + if (InteropSignature.IsMultiSlotToken(loweredTokens[i])) + { + token = loweredTokens[i]; + break; + } + } + + if (token is null && !cb.IsVoid) + { + string returnToken = InteropSignature.GetAbiToken(cb.ReturnType); + if (InteropSignature.IsMultiSlotToken(returnToken)) + token = returnToken; + } + + if (token is not null) + { + throw new LogAsErrorException( + $"UnmanagedCallersOnly callback '{cb.Method}' has multi-slot signature token '{token}', which the generated native wrapper does not support."); + } + } } private string CEntryPoint(PInvokeInfo pinvoke) diff --git a/src/coreclr/vm/wasm/helpers.cpp b/src/coreclr/vm/wasm/helpers.cpp index c9d8a9c3c09ade..0a11f9bad438c6 100644 --- a/src/coreclr/vm/wasm/helpers.cpp +++ b/src/coreclr/vm/wasm/helpers.cpp @@ -1731,6 +1731,9 @@ extern "C" void* GetR2RNativeCodeForUnmanagedCallersOnly(MethodDesc* pMD) } if (PortableEntryPoint::HasNativeEntryPoint(entryPoint)) { + // HasNativeEntryPoint excludes interpreter-preferred entrypoints. In particular, it rejects + // the generated reverse thunk that EnsureCodeForUnmanagedCallersOnly installs for an + // interpreted method, so returning it here cannot recurse back into this lookup. return PortableEntryPoint::GetActualCode(entryPoint); } return nullptr; diff --git a/src/mono/browser/build/coreclr_compat.h b/src/mono/browser/build/coreclr_compat.h index dd4b641e123299..a27bb7bbfd7079 100644 --- a/src/mono/browser/build/coreclr_compat.h +++ b/src/mono/browser/build/coreclr_compat.h @@ -21,8 +21,7 @@ // primitives used by callhelpers-pinvoke.cpp. // * VolatileLoad/VolatileStore -- declared in inc/volatile.h in-tree; the // reverse-thunk file uses them to publish its cached R2R entrypoint but -// does not include that header. wasm is single-threaded, so the in-tree -// memory-barrier machinery collapses to a plain volatile access here. +// does not include that header. // // Definitions for symbols declared by (g_portableCallHelperThunks, // g_ReverseThunks, ...) live in libcoreclr_static.a or in the same generated @@ -45,19 +44,19 @@ typedef uint32_t ULONG; #define INTERP_STACK_SLOT_SIZE 8u #endif -// CoreCLR volatile access helpers (inc/volatile.h). wasm is single-threaded, -// so these reduce to a plain volatile load/store with no memory barrier. +// CoreCLR volatile access helpers (inc/volatile.h). App native code can be +// built with wasm threads, so preserve acquire/release publication semantics. #ifdef __cplusplus template inline T VolatileLoad(T const * pt) { - return *(T volatile const *)pt; + return __atomic_load_n(pt, __ATOMIC_ACQUIRE); } template inline void VolatileStore(T* pt, T val) { - *(T volatile *)pt = val; + __atomic_store_n(pt, val, __ATOMIC_RELEASE); } #endif // __cplusplus From c0240ac42c07728f147d719e37eb9faf8895d534 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 24 Sep 2026 16:39:49 +0200 Subject: [PATCH 07/14] Expand wasm R2R native callback ABI coverage Exercise mixed integer and floating-point arguments, a void pointer callback, and a scalarized single-field struct return through the native-to-R2R export path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../WasmInterpreterTransitions.cs | 31 +++++++++++++++++++ .../wasm/WasmInterpreterTransitions/echo.c | 23 ++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/src/tests/readytorun/wasm/WasmInterpreterTransitions/WasmInterpreterTransitions.cs b/src/tests/readytorun/wasm/WasmInterpreterTransitions/WasmInterpreterTransitions.cs index aaa1bce61a7a9d..7d9d4823beb536 100644 --- a/src/tests/readytorun/wasm/WasmInterpreterTransitions/WasmInterpreterTransitions.cs +++ b/src/tests/readytorun/wasm/WasmInterpreterTransitions/WasmInterpreterTransitions.cs @@ -44,6 +44,11 @@ public struct S8 public int B; } + public struct S4 + { + public int Value; + } + public struct S12 { public int A; @@ -96,6 +101,14 @@ public static void TestEntryPoint() // R2R -> native P/Invoke -> generated native-to-managed export -> R2R UCO. Assert.Equal(A + C, Echo(A)); + Assert.Equal(A + C, EchoSingleIntStruct(A).Value); + Assert.Equal((Wide >> 16) * F64 + F32, EchoMixedScalars(Wide >> 16, F32, F64)); + unsafe + { + int value = A; + EchoPointer(&value, B); + Assert.Equal(A + B, value); + } // Reverse-pinvoke (UnmanagedCallersOnly) entry that re-enters managed code. crossgen2 must // thread the UCO method's $sp (loaded from the __stack_pointer global in its prolog) into the @@ -223,6 +236,24 @@ public static void TestEntryPoint() [UnmanagedCallersOnly(EntryPoint = "managed_echo")] private static int ManagedEcho(int value) => value + C; + [DllImport("echo", EntryPoint = "echo_single_int_struct")] + private static extern S4 EchoSingleIntStruct(int value); + + [UnmanagedCallersOnly(EntryPoint = "managed_echo_single_int_struct")] + private static S4 ManagedEchoSingleIntStruct(int value) => new() { Value = value + C }; + + [DllImport("echo", EntryPoint = "echo_mixed_scalars")] + private static extern double EchoMixedScalars(long value, float addend, double scale); + + [UnmanagedCallersOnly(EntryPoint = "managed_echo_mixed_scalars")] + private static double ManagedEchoMixedScalars(long value, float addend, double scale) => value * scale + addend; + + [DllImport("echo", EntryPoint = "echo_pointer")] + private static extern unsafe void EchoPointer(int* value, int delta); + + [UnmanagedCallersOnly(EntryPoint = "managed_echo_pointer")] + private static unsafe void ManagedEchoPointer(int* value, int delta) => *value += delta; + // Reverse-pinvoke entry (R2R-compiled) that calls an interpreted static int(int). private static unsafe delegate* unmanaged s_ucoToInterpreted = &UnmanagedCallerCallsInterpreted; diff --git a/src/tests/readytorun/wasm/WasmInterpreterTransitions/echo.c b/src/tests/readytorun/wasm/WasmInterpreterTransitions/echo.c index 0c3dafdb102689..36e6555dd5b977 100644 --- a/src/tests/readytorun/wasm/WasmInterpreterTransitions/echo.c +++ b/src/tests/readytorun/wasm/WasmInterpreterTransitions/echo.c @@ -3,9 +3,32 @@ #include +typedef struct +{ + int32_t value; +} single_int; + extern int32_t managed_echo(int32_t value); +extern single_int managed_echo_single_int_struct(int32_t value); +extern double managed_echo_mixed_scalars(int64_t value, float addend, double scale); +extern void managed_echo_pointer(int32_t* value, int32_t delta); int32_t echo(int32_t value) { return managed_echo(value); } + +single_int echo_single_int_struct(int32_t value) +{ + return managed_echo_single_int_struct(value); +} + +double echo_mixed_scalars(int64_t value, float addend, double scale) +{ + return managed_echo_mixed_scalars(value, addend, scale); +} + +void echo_pointer(int32_t* value, int32_t delta) +{ + managed_echo_pointer(value, delta); +} From 64a68e1677a7cad7f1c64abede044fc739d5950f Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 24 Sep 2026 16:57:44 +0200 Subject: [PATCH 08/14] Reject unsupported wasm callback struct returns Reject UnmanagedCallersOnly callbacks whose aggregate return requires a hidden return buffer instead of emitting an ABI-incompatible native wrapper, and cover the diagnostic in generator tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../WasmArgumentLayoutTests.cs | 29 +++++++++++- .../PInvokeTableGenerator.cs | 46 +++++++++---------- 2 files changed, 51 insertions(+), 24 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs index 0a3a3ad28f28d6..4541106a5e2003 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs @@ -648,6 +648,33 @@ public static class Exports } """; + AssertPortableCallHelpersGeneratorRejects(source, "has multi-slot signature token 'l2'"); + } + + [Fact] + public void PortableCallHelpersGeneratorRejectsHiddenReturnBufferCallbacks() + { + string source = """ + using System.Runtime.InteropServices; + + public struct Pair + { + public int First; + public int Second; + } + + public static class Exports + { + [UnmanagedCallersOnly(EntryPoint = "callback")] + public static Pair Handle(int value) => default; + } + """; + + AssertPortableCallHelpersGeneratorRejects(source, "uses a hidden return buffer"); + } + + private void AssertPortableCallHelpersGeneratorRejects(string source, string expectedError) + { string workingDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); Directory.CreateDirectory(workingDirectory); @@ -666,7 +693,7 @@ public static class Exports CreateWasmContext(inputAssembly), options, new Logger(log, isVerbose: false)); Assert.Equal(1, exitCode); - Assert.Contains("has multi-slot signature token 'l2'", log.ToString()); + Assert.Contains(expectedError, log.ToString()); } finally { diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs index f0128bad4c16fa..569c295dc2a447 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs @@ -257,7 +257,7 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) callbacks.Sort(new PInvokeCallbackComparer()); foreach (PInvokeCallback cb in callbacks) { - RejectMultiSlotCallback(cb); + RejectUnsupportedCallbackSignature(cb); cb.EntrySymbol = FixedSymbolName(cb); if (!callbackNames.Add(cb.EntrySymbol)) @@ -292,10 +292,7 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) string arguments = string.Join(", ", Enumerable.Range(0, parameterCount).Select(i => $"arg{i}")); // A partial R2R image can compile an UnmanagedCallersOnly callback to native code. That R2R code // is the directly-callable native entrypoint (same ABI as this wrapper's parameters), so dispatch - // to it and skip the interpreter/interp->R2R path entirely. A by-reference struct return uses a - // hidden return-buffer pointer that this declared signature does not model, so skip the direct - // dispatch for those and let the interpreter fallback (which passes the buffer) handle them. - bool canDispatchR2R = cb.IsVoid || !IsPassedByReference(cb.ReturnType); + // to it and skip the interpreter/interp->R2R path entirely. string r2rVar = $"R2RCode_{cb.EntrySymbol}"; string paramTypesOnly = string.Join(", ", parameterCTypes); string r2rDispatch = cb.IsVoid @@ -304,23 +301,20 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) // Cache the resolved entrypoint in a per-callback static, published with a volatile store: // these are native entry points that can be entered concurrently, and the value is computed // identically on every call, so the racing read/write is benign but must not tear. - string r2rStaticDecl = canDispatchR2R - ? $"{w.NewLine}static void* {r2rVar} = (void*)(intptr_t)-1;" - : string.Empty; - string r2rSection = canDispatchR2R - ? w.NewLine + " // Prefer the R2R native entrypoint when this callback was compiled (partial R2R)." - + w.NewLine + " // Resolve once and cache; a method's native-code availability is fixed after first prepare." - + w.NewLine + $" void* r2r = VolatileLoad(&{r2rVar});" - + w.NewLine + " if (r2r == (void*)(intptr_t)-1)" - + w.NewLine + " {" - + w.NewLine + $" r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_{cb.EntrySymbol});" - + w.NewLine + $" VolatileStore(&{r2rVar}, r2r);" - + w.NewLine + " }" - + w.NewLine + " if (r2r != nullptr)" - + w.NewLine + " {" - + w.NewLine + $" {r2rDispatch}" - + w.NewLine + " }" - : string.Empty; + string r2rStaticDecl = $"{w.NewLine}static void* {r2rVar} = (void*)(intptr_t)-1;"; + string r2rSection = + w.NewLine + " // Prefer the R2R native entrypoint when this callback was compiled (partial R2R)." + + w.NewLine + " // Resolve once and cache; a method's native-code availability is fixed after first prepare." + + w.NewLine + $" void* r2r = VolatileLoad(&{r2rVar});" + + w.NewLine + " if (r2r == (void*)(intptr_t)-1)" + + w.NewLine + " {" + + w.NewLine + $" r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_{cb.EntrySymbol});" + + w.NewLine + $" VolatileStore(&{r2rVar}, r2r);" + + w.NewLine + " }" + + w.NewLine + " if (r2r != nullptr)" + + w.NewLine + " {" + + w.NewLine + $" {r2rDispatch}" + + w.NewLine + " }"; string exportFunction = cb.IsExport ? $$""" @@ -386,7 +380,7 @@ static void RejectAmbiguousExport(PInvokeCallback cb) $"Exported callback '{cb.EntryPoint}' cannot be resolved at run time: '{cb.TypeFullName}' declares more than one [UnmanagedCallersOnly] method named '{cb.MethodName}', and the runtime looks them up by name alone. Give them distinct names: {string.Join(", ", ambiguous)}"); } - static void RejectMultiSlotCallback(PInvokeCallback cb) + static void RejectUnsupportedCallbackSignature(PInvokeCallback cb) { List loweredTokens = InteropSignature.ParseSignatureTokens( InteropSignature.GetMethodSignature(cb.Method, WasmLowering.LoweringFlags.IsUnmanagedCallersOnly)); @@ -412,6 +406,12 @@ static void RejectMultiSlotCallback(PInvokeCallback cb) throw new LogAsErrorException( $"UnmanagedCallersOnly callback '{cb.Method}' has multi-slot signature token '{token}', which the generated native wrapper does not support."); } + + if (!cb.IsVoid && IsPassedByReference(cb.ReturnType)) + { + throw new LogAsErrorException( + $"UnmanagedCallersOnly callback '{cb.Method}' has return type '{cb.ReturnType}' that uses a hidden return buffer, which the generated native wrapper does not support."); + } } } From bc31a5262c6375678cc9bf83a1def33a858cfd32 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 24 Sep 2026 17:58:35 +0200 Subject: [PATCH 09/14] Reject unsupported wasm vector callbacks Reject Vector128 UnmanagedCallersOnly parameters and returns before generating native wrappers whose C declarations cannot represent the v128 ABI, and cover both signature positions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../WasmArgumentLayoutTests.cs | 11 +++++++---- .../PortableCallHelpers/PInvokeTableGenerator.cs | 9 ++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs index 4541106a5e2003..52c6dfd8e7984c 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs @@ -633,9 +633,12 @@ public void PortableCallHelpersGeneratorEncodesTypesTheSameWayInAndOutOfASignatu } [Theory] - [InlineData("int", "System.Int128")] - [InlineData("System.Int128", "int")] - public void PortableCallHelpersGeneratorRejectsMultiSlotCallbacks(string returnType, string parameterType) + [InlineData("int", "System.Int128", "l2")] + [InlineData("System.Int128", "int", "l2")] + [InlineData("int", "System.Runtime.Intrinsics.Vector128", "V")] + [InlineData("System.Runtime.Intrinsics.Vector128", "int", "V")] + public void PortableCallHelpersGeneratorRejectsUnsupportedSignatureTokens( + string returnType, string parameterType, string expectedToken) { string source = $$""" using System; @@ -648,7 +651,7 @@ public static class Exports } """; - AssertPortableCallHelpersGeneratorRejects(source, "has multi-slot signature token 'l2'"); + AssertPortableCallHelpersGeneratorRejects(source, $"has unsupported signature token '{expectedToken}'"); } [Fact] diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs index 569c295dc2a447..c768fb352b420d 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs @@ -387,7 +387,7 @@ static void RejectUnsupportedCallbackSignature(PInvokeCallback cb) string token = null; for (int i = 1; i < loweredTokens.Count; i++) { - if (InteropSignature.IsMultiSlotToken(loweredTokens[i])) + if (IsUnsupportedToken(loweredTokens[i])) { token = loweredTokens[i]; break; @@ -397,14 +397,14 @@ static void RejectUnsupportedCallbackSignature(PInvokeCallback cb) if (token is null && !cb.IsVoid) { string returnToken = InteropSignature.GetAbiToken(cb.ReturnType); - if (InteropSignature.IsMultiSlotToken(returnToken)) + if (IsUnsupportedToken(returnToken)) token = returnToken; } if (token is not null) { throw new LogAsErrorException( - $"UnmanagedCallersOnly callback '{cb.Method}' has multi-slot signature token '{token}', which the generated native wrapper does not support."); + $"UnmanagedCallersOnly callback '{cb.Method}' has unsupported signature token '{token}', which the generated native wrapper does not support."); } if (!cb.IsVoid && IsPassedByReference(cb.ReturnType)) @@ -412,6 +412,9 @@ static void RejectUnsupportedCallbackSignature(PInvokeCallback cb) throw new LogAsErrorException( $"UnmanagedCallersOnly callback '{cb.Method}' has return type '{cb.ReturnType}' that uses a hidden return buffer, which the generated native wrapper does not support."); } + + static bool IsUnsupportedToken(string token) => + token is "V" || InteropSignature.IsMultiSlotToken(token); } } From dfdc276ae937955dde724a0a85b3bb19e007f533 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Thu, 24 Sep 2026 18:41:50 +0200 Subject: [PATCH 10/14] Emit atomic wasm R2R callback cache operations Generate acquire/release builtins directly so both VM-compiled and app-linked reverse helpers publish cached R2R entrypoints atomically. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../WasmArgumentLayoutTests.cs | 3 + .../PInvokeTableGenerator.cs | 4 +- .../vm/wasm/browser/callhelpers-reverse.cpp | 324 +++++++++--------- .../vm/wasm/wasi/callhelpers-reverse.cpp | 300 ++++++++-------- src/mono/browser/build/coreclr_compat.h | 19 - 5 files changed, 317 insertions(+), 333 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs index 52c6dfd8e7984c..53ede048306325 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs @@ -778,6 +778,9 @@ public static class Exports { Assert.Equal(0, exitCode); Assert.DoesNotContain("declares more than one", log.ToString()); + string reverseHelpers = File.ReadAllText(Path.Combine(outputDirectory, "callhelpers-reverse.cpp")); + Assert.Contains("__atomic_load_n", reverseHelpers); + Assert.Contains("__atomic_store_n", reverseHelpers); } } finally diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs index c768fb352b420d..905ca4f8d89fea 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs @@ -305,11 +305,11 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) string r2rSection = w.NewLine + " // Prefer the R2R native entrypoint when this callback was compiled (partial R2R)." + w.NewLine + " // Resolve once and cache; a method's native-code availability is fixed after first prepare." - + w.NewLine + $" void* r2r = VolatileLoad(&{r2rVar});" + + w.NewLine + $" void* r2r = __atomic_load_n(&{r2rVar}, __ATOMIC_ACQUIRE);" + w.NewLine + " if (r2r == (void*)(intptr_t)-1)" + w.NewLine + " {" + w.NewLine + $" r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_{cb.EntrySymbol});" - + w.NewLine + $" VolatileStore(&{r2rVar}, r2r);" + + w.NewLine + $" __atomic_store_n(&{r2rVar}, r2r, __ATOMIC_RELEASE);" + w.NewLine + " }" + w.NewLine + " if (r2r != nullptr)" + w.NewLine + " {" diff --git a/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp b/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp index 7afb08ab98bbea..d88c8b3a467764 100644 --- a/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp +++ b/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp @@ -26,11 +26,11 @@ static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g_ } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -53,11 +53,11 @@ static void Call_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJo } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -83,11 +83,11 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid); - VolatileStore(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -115,11 +115,11 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -142,11 +142,11 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -169,11 +169,11 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid); - VolatileStore(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -201,11 +201,11 @@ static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I3 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -228,11 +228,11 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -260,11 +260,11 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHo } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -287,11 +287,11 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -314,11 +314,11 @@ static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEven } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -341,11 +341,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -368,11 +368,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -395,11 +395,11 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid); - VolatileStore(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -427,11 +427,11 @@ static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -454,11 +454,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -481,11 +481,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -508,11 +508,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Convert } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -535,11 +535,11 @@ static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Conve } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -563,11 +563,11 @@ static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -590,11 +590,11 @@ static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_ } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -617,11 +617,11 @@ static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -644,11 +644,11 @@ static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -671,11 +671,11 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAss } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -698,11 +698,11 @@ static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedExc } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -725,11 +725,11 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationE } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -752,11 +752,11 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializatio } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -779,11 +779,11 @@ static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCa } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -806,11 +806,11 @@ static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -834,11 +834,11 @@ static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_ } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -861,11 +861,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -888,11 +888,11 @@ static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I3 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -915,11 +915,11 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -943,11 +943,11 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -970,11 +970,11 @@ static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I3 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -997,11 +997,11 @@ static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1024,11 +1024,11 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid); - VolatileStore(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1056,11 +1056,11 @@ static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1083,11 +1083,11 @@ static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1110,11 +1110,11 @@ static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTy } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1137,11 +1137,11 @@ static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLine } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1164,11 +1164,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1191,11 +1191,11 @@ static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_I } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1218,11 +1218,11 @@ static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonit } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1245,11 +1245,11 @@ static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTr } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1272,11 +1272,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArr } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1299,11 +1299,11 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1326,11 +1326,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1353,11 +1353,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1380,11 +1380,11 @@ static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeL } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1408,11 +1408,11 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartu } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1435,11 +1435,11 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1463,11 +1463,11 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1491,11 +1491,11 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1519,11 +1519,11 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1547,11 +1547,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1574,11 +1574,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1601,11 +1601,11 @@ static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1628,11 +1628,11 @@ static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetV } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1655,11 +1655,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1682,11 +1682,11 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1709,11 +1709,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1736,11 +1736,11 @@ static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1763,11 +1763,11 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAs } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1790,11 +1790,11 @@ static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_Intero } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid); - VolatileStore(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1822,11 +1822,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1849,11 +1849,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1876,11 +1876,11 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1903,11 +1903,11 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1930,11 +1930,11 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1958,11 +1958,11 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1986,11 +1986,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -2013,11 +2013,11 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetV } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -2040,11 +2040,11 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetV } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -2067,11 +2067,11 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_Re } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -2094,11 +2094,11 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -2120,11 +2120,11 @@ static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_ } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -2147,11 +2147,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -2174,11 +2174,11 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I3 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -2201,11 +2201,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -2228,11 +2228,11 @@ static void Call_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { diff --git a/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp b/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp index 902a42b6c61bf9..768fc20b4c5669 100644 --- a/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp +++ b/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp @@ -26,11 +26,11 @@ static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g_ } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -53,11 +53,11 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -80,11 +80,11 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -107,11 +107,11 @@ static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I3 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -134,11 +134,11 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHo } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -161,11 +161,11 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -188,11 +188,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -215,11 +215,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -242,11 +242,11 @@ static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -269,11 +269,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -296,11 +296,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -323,11 +323,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Convert } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -350,11 +350,11 @@ static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Conve } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -378,11 +378,11 @@ static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -405,11 +405,11 @@ static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_ } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -432,11 +432,11 @@ static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -459,11 +459,11 @@ static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -486,11 +486,11 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAss } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -513,11 +513,11 @@ static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedExc } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -540,11 +540,11 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationE } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -567,11 +567,11 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializatio } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -594,11 +594,11 @@ static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCa } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -621,11 +621,11 @@ static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -649,11 +649,11 @@ static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_ } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -676,11 +676,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -703,11 +703,11 @@ static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I3 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -730,11 +730,11 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -758,11 +758,11 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -785,11 +785,11 @@ static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I3 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -812,11 +812,11 @@ static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -839,11 +839,11 @@ static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -866,11 +866,11 @@ static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -893,11 +893,11 @@ static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTy } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -920,11 +920,11 @@ static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLine } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -947,11 +947,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -974,11 +974,11 @@ static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_I } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1001,11 +1001,11 @@ static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonit } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1028,11 +1028,11 @@ static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTr } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1055,11 +1055,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArr } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1082,11 +1082,11 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1109,11 +1109,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1136,11 +1136,11 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1163,11 +1163,11 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1191,11 +1191,11 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1219,11 +1219,11 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1247,11 +1247,11 @@ static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeL } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1275,11 +1275,11 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartu } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1302,11 +1302,11 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1330,11 +1330,11 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1358,11 +1358,11 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1386,11 +1386,11 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1414,11 +1414,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1441,11 +1441,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1468,11 +1468,11 @@ static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1495,11 +1495,11 @@ static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetV } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1522,11 +1522,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1549,11 +1549,11 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1576,11 +1576,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1603,11 +1603,11 @@ static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1630,11 +1630,11 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAs } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1657,11 +1657,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1684,11 +1684,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1711,11 +1711,11 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1738,11 +1738,11 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1765,11 +1765,11 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1793,11 +1793,11 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1821,11 +1821,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1848,11 +1848,11 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetV } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1875,11 +1875,11 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetV } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1902,11 +1902,11 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_Re } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1929,11 +1929,11 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); - VolatileStore(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1955,11 +1955,11 @@ static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_ } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -1982,11 +1982,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -2009,11 +2009,11 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I3 } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { @@ -2036,11 +2036,11 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex } // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = VolatileLoad(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); + void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, __ATOMIC_ACQUIRE); if (r2r == (void*)(intptr_t)-1) { r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); - VolatileStore(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, r2r); + __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); } if (r2r != nullptr) { diff --git a/src/mono/browser/build/coreclr_compat.h b/src/mono/browser/build/coreclr_compat.h index a27bb7bbfd7079..551a2636eaa256 100644 --- a/src/mono/browser/build/coreclr_compat.h +++ b/src/mono/browser/build/coreclr_compat.h @@ -19,9 +19,6 @@ // interp-to-managed file uses it but does not include that header. // * LF_INTEROP/LL_INFO1000/LOG/PORTABILITY_ASSERT -- CoreCLR logging // primitives used by callhelpers-pinvoke.cpp. -// * VolatileLoad/VolatileStore -- declared in inc/volatile.h in-tree; the -// reverse-thunk file uses them to publish its cached R2R entrypoint but -// does not include that header. // // Definitions for symbols declared by (g_portableCallHelperThunks, // g_ReverseThunks, ...) live in libcoreclr_static.a or in the same generated @@ -44,22 +41,6 @@ typedef uint32_t ULONG; #define INTERP_STACK_SLOT_SIZE 8u #endif -// CoreCLR volatile access helpers (inc/volatile.h). App native code can be -// built with wasm threads, so preserve acquire/release publication semantics. -#ifdef __cplusplus -template -inline T VolatileLoad(T const * pt) -{ - return __atomic_load_n(pt, __ATOMIC_ACQUIRE); -} - -template -inline void VolatileStore(T* pt, T val) -{ - __atomic_store_n(pt, val, __ATOMIC_RELEASE); -} -#endif // __cplusplus - // CoreCLR logging stubs. #define LF_INTEROP 0 #define LL_INFO1000 0 From f350cdf4eb54406e411cc85cdde9171e5440907d Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 25 Sep 2026 12:14:36 +0200 Subject: [PATCH 11/14] Compile test native sources without generated-helper flags User NativeFileReference .c/.cpp now use a dedicated corerun-compile-user.rsp that carries only the shared compile flags (optimization, exception model, SIMD, GEN_PINVOKE) and omits the coreclr_compat.h force-include and kit header path, mirroring the app build's _EmccCFlags/_EmccCFlagsGenerated split so raw sources don't inherit CoreCLR typedefs/macros. Also correct a stale generator comment that still referenced a volatile store. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/coreclr/hosts/corerun/wasm/testkit.cmake | 27 ++++++++++++++----- .../PInvokeTableGenerator.cs | 6 ++--- src/tests/Common/CLRTest.WasmCorerun.targets | 13 ++++++--- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/coreclr/hosts/corerun/wasm/testkit.cmake b/src/coreclr/hosts/corerun/wasm/testkit.cmake index 914bfc34ba915d..ecb9935e4aa117 100644 --- a/src/coreclr/hosts/corerun/wasm/testkit.cmake +++ b/src/coreclr/hosts/corerun/wasm/testkit.cmake @@ -229,12 +229,24 @@ function(corerun_kit_export) # or, worse, hold per-configuration defaults the repo never actually uses. # corerun's include directories are likewise not exported: the generated # sources only need the headers shipped in the kit. - set(compileResponse "") - string(APPEND compileResponse "-O2\n") - string(APPEND compileResponse "-fwasm-exceptions\n") - string(APPEND compileResponse "-sWASM_LEGACY_EXCEPTIONS=0\n") - string(APPEND compileResponse "-msimd128\n") - string(APPEND compileResponse "-DGEN_PINVOKE=1\n") + # The user response is the flags every object linked into the test corerun must + # agree on -- the exception model above all, which wasm-ld rejects if it is + # mixed. It carries no generated-helper-only flags, mirroring the app build's + # split between user NativeFileReference sources and the crossgen2-emitted + # call tables (BrowserWasmApp.CoreCLR.targets: _EmccCFlags vs _EmccCFlagsGenerated). + set(userCompileResponse "") + string(APPEND userCompileResponse "-O2\n") + string(APPEND userCompileResponse "-fwasm-exceptions\n") + string(APPEND userCompileResponse "-sWASM_LEGACY_EXCEPTIONS=0\n") + string(APPEND userCompileResponse "-msimd128\n") + string(APPEND userCompileResponse "-DGEN_PINVOKE=1\n") + + # The generated call tables additionally force-include coreclr_compat.h (which + # injects CoreCLR type/macro prereqs like MethodDesc/ULONG/LOG) and add the kit + # header search path. Those are deliberately kept off user sources: a raw .c/.cpp + # NativeFileReference must not inherit those typedefs/macros, which would collide + # with arbitrary user code. + set(compileResponse "${userCompileResponse}") string(APPEND compileResponse "-I\"include\"\n") string(APPEND compileResponse "-include\n\"include/coreclr_compat.h\"\n") @@ -243,6 +255,8 @@ function(corerun_kit_export) TARGET corerun_static) file(GENERATE OUTPUT "${generatedDirectory}/corerun-compile.rsp" CONTENT "${compileResponse}" TARGET corerun_static) + file(GENERATE OUTPUT "${generatedDirectory}/corerun-compile-user.rsp" CONTENT "${userCompileResponse}" + TARGET corerun_static) foreach(library IN LISTS kitLibraries) install(FILES "$" DESTINATION ${kitDestination} COMPONENT ${KIT_COMPONENT}) @@ -250,6 +264,7 @@ function(corerun_kit_export) install(FILES ${kitFiles} DESTINATION ${kitDestination} COMPONENT ${KIT_COMPONENT}) install(FILES ${KIT_JS_LIBRARIES} "${KIT_EXTERN_POST_JS}" DESTINATION ${kitDestination} COMPONENT ${KIT_COMPONENT}) install(FILES "${generatedDirectory}/corerun-link.rsp" "${generatedDirectory}/corerun-compile.rsp" + "${generatedDirectory}/corerun-compile-user.rsp" DESTINATION ${kitDestination} COMPONENT ${KIT_COMPONENT}) # Headers the generated call tables include, plus the compatibility header diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs index 905ca4f8d89fea..a7d821895abf2f 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs @@ -298,9 +298,9 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) string r2rDispatch = cb.IsVoid ? $"((void(*)({paramTypesOnly}))r2r)({arguments});{w.NewLine} return;" : $"return (({MapType(cb.ReturnType)}(*)({paramTypesOnly}))r2r)({arguments});"; - // Cache the resolved entrypoint in a per-callback static, published with a volatile store: - // these are native entry points that can be entered concurrently, and the value is computed - // identically on every call, so the racing read/write is benign but must not tear. + // Cache the resolved entrypoint in a per-callback static, published with acquire/release + // atomics: these are native entry points that can be entered concurrently, and the value is + // computed identically on every call, so the racing read/write is benign but must not tear. string r2rStaticDecl = $"{w.NewLine}static void* {r2rVar} = (void*)(intptr_t)-1;"; string r2rSection = w.NewLine + " // Prefer the R2R native entrypoint when this callback was compiled (partial R2R)." diff --git a/src/tests/Common/CLRTest.WasmCorerun.targets b/src/tests/Common/CLRTest.WasmCorerun.targets index 22cba68a956f09..05dcdf17977921 100644 --- a/src/tests/Common/CLRTest.WasmCorerun.targets +++ b/src/tests/Common/CLRTest.WasmCorerun.targets @@ -203,8 +203,13 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s <_Crossgen2GeneratorRsp>$(_WasmCorerunDir)callhelpers-generator.rsp + which is why both em++ invocations below run from there. The generated call tables use + the full compile rsp (force-includes coreclr_compat.h); user NativeFileReference sources + use the user rsp, which omits the generated-helper-only compat header/include path so a + raw .c/.cpp does not inherit CoreCLR typedefs/macros. This mirrors the app build's split + between _EmccCFlags and _EmccCFlagsGenerated. --> <_WasmCorerunCompileRsp>$(WasmCorerunKitDir)corerun-compile.rsp + <_WasmCorerunUserCompileRsp>$(WasmCorerunKitDir)corerun-compile-user.rsp <_WasmCorerunLinkRsp>$(WasmCorerunKitDir)corerun-link.rsp <_WasmCorerunJs>$(OutDir)corerun.js @@ -372,7 +377,7 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s @@ -380,12 +385,12 @@ against CORE_ROOT, and no SDK is involved. Only the generator task assembly is s WorkingDirectory="$(WasmCorerunKitDir)" EnvironmentVariables="@(_WasmCorerunEmscriptenEnv)" /> - - From 26268dbd64bb3abbc8f42200e442c26d11107ce3 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 25 Sep 2026 17:36:07 +0200 Subject: [PATCH 12/14] Skip wasm corerun for struct-returning callconv tests The generated wasm reverse thunk cannot model hidden-return-buffer struct-returning UnmanagedCallersOnly callbacks (GetSize -> SizeF), so crossgen2 now rejects them and fails the whole test build leg. Opt these four callconv tests out of the test-specific corerun on browser-coreclr, matching the existing EmptyThisCallTest precedent (dotnet/runtime#131811). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CdeclMemberFunction/CdeclMemberFunctionTest.csproj | 4 ++++ .../PlatformDefaultMemberFunctionTest.csproj | 4 ++++ .../StdCallMemberFunction/StdCallMemberFunctionTest.csproj | 4 ++++ src/tests/JIT/Directed/callconv/ThisCall/ThisCallTest.csproj | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/src/tests/JIT/Directed/callconv/CdeclMemberFunction/CdeclMemberFunctionTest.csproj b/src/tests/JIT/Directed/callconv/CdeclMemberFunction/CdeclMemberFunctionTest.csproj index 00eaa467d6d71d..65f34f680513f9 100644 --- a/src/tests/JIT/Directed/callconv/CdeclMemberFunction/CdeclMemberFunctionTest.csproj +++ b/src/tests/JIT/Directed/callconv/CdeclMemberFunction/CdeclMemberFunctionTest.csproj @@ -1,5 +1,9 @@ + + false true true diff --git a/src/tests/JIT/Directed/callconv/PlatformDefaultMemberFunction/PlatformDefaultMemberFunctionTest.csproj b/src/tests/JIT/Directed/callconv/PlatformDefaultMemberFunction/PlatformDefaultMemberFunctionTest.csproj index 00eaa467d6d71d..65f34f680513f9 100644 --- a/src/tests/JIT/Directed/callconv/PlatformDefaultMemberFunction/PlatformDefaultMemberFunctionTest.csproj +++ b/src/tests/JIT/Directed/callconv/PlatformDefaultMemberFunction/PlatformDefaultMemberFunctionTest.csproj @@ -1,5 +1,9 @@ + + false true true diff --git a/src/tests/JIT/Directed/callconv/StdCallMemberFunction/StdCallMemberFunctionTest.csproj b/src/tests/JIT/Directed/callconv/StdCallMemberFunction/StdCallMemberFunctionTest.csproj index 00eaa467d6d71d..65f34f680513f9 100644 --- a/src/tests/JIT/Directed/callconv/StdCallMemberFunction/StdCallMemberFunctionTest.csproj +++ b/src/tests/JIT/Directed/callconv/StdCallMemberFunction/StdCallMemberFunctionTest.csproj @@ -1,5 +1,9 @@ + + false true true diff --git a/src/tests/JIT/Directed/callconv/ThisCall/ThisCallTest.csproj b/src/tests/JIT/Directed/callconv/ThisCall/ThisCallTest.csproj index c943b6059364df..9a5cfb90034678 100644 --- a/src/tests/JIT/Directed/callconv/ThisCall/ThisCallTest.csproj +++ b/src/tests/JIT/Directed/callconv/ThisCall/ThisCallTest.csproj @@ -1,6 +1,10 @@ true + + false true true From b6b2ac03b2bfbc180e64904538cb76c47dc20051 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 29 Sep 2026 11:16:40 +0200 Subject: [PATCH 13/14] Emit wasm R2R callback dispatch for exported callbacks only Native code calls extern "C" exports directly, so only those wrappers must reach the R2R native entrypoint themselves. Every other reverse thunk is handed out by GetUnmanagedCallersOnlyThunk, which already prefers R2R code before falling back to the interpreter wrapper, making the dispatch dead code there. Gate the R2RCode_ cache, the dispatch block, and its extern on the exported-by-name callbacks, author the block as a raw-string literal for readability, and regenerate the checked-in browser and wasi helpers. wasi has no exported callbacks, so its R2R machinery drops entirely. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../WasmArgumentLayoutTests.cs | 71 +- .../PInvokeTableGenerator.cs | 59 +- .../vm/wasm/browser/callhelpers-reverse.cpp | 1011 ---------------- .../vm/wasm/wasi/callhelpers-pinvoke.cpp | 2 +- .../vm/wasm/wasi/callhelpers-reverse.cpp | 1037 ----------------- 5 files changed, 107 insertions(+), 2073 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs index 803aef948ae40a..773287c45d7dd3 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs @@ -849,9 +849,6 @@ public static class Exports { Assert.Equal(0, exitCode); Assert.DoesNotContain("declares more than one", log.ToString()); - string reverseHelpers = File.ReadAllText(Path.Combine(outputDirectory, "callhelpers-reverse.cpp")); - Assert.Contains("__atomic_load_n", reverseHelpers); - Assert.Contains("__atomic_store_n", reverseHelpers); } } finally @@ -869,6 +866,74 @@ public static class Exports } } + /// + /// The generated wrapper only needs to reach the R2R native entrypoint for callbacks exported by + /// name: native code calls the extern "C" export (and thus the wrapper) directly. Every other + /// reverse thunk is handed out by the runtime, which already prefers R2R code before falling back to + /// the interpreter wrapper, so the dispatch is emitted for exports alone. + /// + [Theory] + [InlineData("[UnmanagedCallersOnly(EntryPoint = \"cb_export\")]", true)] + [InlineData("[UnmanagedCallersOnly]", false)] + public void PortableCallHelpersGeneratorEmitsR2RDispatchForExportsOnly(string attribute, bool expectR2RDispatch) + { + string source = $$""" + using System.Runtime.InteropServices; + + public static class Exports + { + {{attribute}} + public static int Handle(int value) => value; + } + """; + + string workingDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + Directory.CreateDirectory(workingDirectory); + + try + { + string inputAssembly = CompileCallbackAssembly(source, Path.Combine(workingDirectory, "Callbacks.dll")); + string outputDirectory = Path.Combine(workingDirectory, "generated"); + + var options = new PortableCallHelpersGeneratorOptions + { + OutputDirectory = outputDirectory, + TargetOS = "browser", + PInvokeModules = new[] { "libSystem.Native" }, + }; + + var log = new StringWriter(); + int exitCode = PortableCallHelpersGenerator.Run( + CreateWasmContext(inputAssembly), options, new Logger(log, isVerbose: false)); + + Assert.Equal(0, exitCode); + string reverseHelpers = File.ReadAllText(Path.Combine(outputDirectory, "callhelpers-reverse.cpp")); + + if (expectR2RDispatch) + { + Assert.Contains("GetR2RNativeCodeForUnmanagedCallersOnly", reverseHelpers); + Assert.Contains("__atomic_load_n", reverseHelpers); + Assert.Contains("__atomic_store_n", reverseHelpers); + } + else + { + Assert.DoesNotContain("GetR2RNativeCodeForUnmanagedCallersOnly", reverseHelpers); + Assert.DoesNotContain("__atomic_load_n", reverseHelpers); + Assert.DoesNotContain("__atomic_store_n", reverseHelpers); + } + } + finally + { + try + { + Directory.Delete(workingDirectory, recursive: true); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) + { + } + } + } + /// /// Builds an input assembly for the generator to scan. It references the same CoreLib the context /// reads, so the attributes it applies are the ones the type system will resolve. diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs index a7d821895abf2f..a3a8a9cd391f69 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/PortableCallHelpers/PInvokeTableGenerator.cs @@ -235,8 +235,15 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) // the runtime's key for a method to its wrapper, and the runtime fills that static in as it // hands the wrapper out. An export is not handed out that way, so it resolves the static // itself, by name, on the first call. + // The R2R dispatch below is emitted only for callbacks exported by name, so its extern is too: + // native code reaches those wrappers directly, while every other reverse thunk is handed out by + // the runtime, which already prefers R2R code before falling back to the interpreter wrapper. + bool anyExport = callbacks.Any(cb => cb.IsExport); + string r2rExtern = anyExport + ? w.NewLine + "extern \"C\" void* GetR2RNativeCodeForUnmanagedCallersOnly(MethodDesc* pMD);" + : string.Empty; w.Write( - """ + $$""" // // GENERATED FILE, DON'T EDIT // Generated by coreclr callhelpers generator @@ -247,8 +254,7 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) // WASM-TODO: The method lookup would ideally be fully qualified assembly and then methodDef token. // The current approach has limitations with overloaded methods. extern "C" void LookupUnmanagedCallersOnlyMethodByName(const char* fullQualifiedTypeName, const char* methodName, MethodDesc** ppMD); - extern "C" void ExecuteInterpretedMethodFromUnmanaged(MethodDesc* pMD, int8_t* args, size_t argSize, int8_t* ret, PCODE callerIp); - extern "C" void* GetR2RNativeCodeForUnmanagedCallersOnly(MethodDesc* pMD); + extern "C" void ExecuteInterpretedMethodFromUnmanaged(MethodDesc* pMD, int8_t* args, size_t argSize, int8_t* ret, PCODE callerIp);{{r2rExtern}} """); @@ -290,10 +296,16 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) : string.Empty; string parametersDeclaration = string.Join(", ", parameterCTypes.Select((p, i) => $"{p} arg{i}")); string arguments = string.Join(", ", Enumerable.Range(0, parameterCount).Select(i => $"arg{i}")); - // A partial R2R image can compile an UnmanagedCallersOnly callback to native code. That R2R code - // is the directly-callable native entrypoint (same ABI as this wrapper's parameters), so dispatch - // to it and skip the interpreter/interp->R2R path entirely. - string r2rVar = $"R2RCode_{cb.EntrySymbol}"; + + // A partial R2R image can compile an UnmanagedCallersOnly callback to native code. That R2R + // code is the directly-callable native entrypoint (same ABI as this wrapper's parameters), so + // dispatch to it and skip the interpreter/interp->R2R path entirely. + // + // Only callbacks exported by name need this here: native code holds the extern "C" export and + // calls this wrapper directly, so the wrapper itself has to reach the R2R entrypoint. Every + // other reverse thunk is handed out by the runtime through GetUnmanagedCallersOnlyThunk, which + // already returns the R2R native code directly and only falls back to this interpreter wrapper + // when the method has no native code -- so the dispatch would be dead code there. string paramTypesOnly = string.Join(", ", parameterCTypes); string r2rDispatch = cb.IsVoid ? $"((void(*)({paramTypesOnly}))r2r)({arguments});{w.NewLine} return;" @@ -301,20 +313,25 @@ public void EmitNativeToInterp(TextWriter w, List callbacks) // Cache the resolved entrypoint in a per-callback static, published with acquire/release // atomics: these are native entry points that can be entered concurrently, and the value is // computed identically on every call, so the racing read/write is benign but must not tear. - string r2rStaticDecl = $"{w.NewLine}static void* {r2rVar} = (void*)(intptr_t)-1;"; - string r2rSection = - w.NewLine + " // Prefer the R2R native entrypoint when this callback was compiled (partial R2R)." - + w.NewLine + " // Resolve once and cache; a method's native-code availability is fixed after first prepare." - + w.NewLine + $" void* r2r = __atomic_load_n(&{r2rVar}, __ATOMIC_ACQUIRE);" - + w.NewLine + " if (r2r == (void*)(intptr_t)-1)" - + w.NewLine + " {" - + w.NewLine + $" r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_{cb.EntrySymbol});" - + w.NewLine + $" __atomic_store_n(&{r2rVar}, r2r, __ATOMIC_RELEASE);" - + w.NewLine + " }" - + w.NewLine + " if (r2r != nullptr)" - + w.NewLine + " {" - + w.NewLine + $" {r2rDispatch}" - + w.NewLine + " }"; + string r2rStaticDecl = cb.IsExport + ? $"{w.NewLine}static void* R2RCode_{cb.EntrySymbol} = (void*)(intptr_t)-1;" + : string.Empty; + string r2rSection = cb.IsExport + ? w.NewLine + $$""" + // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). + // Resolve once and cache; a method's native-code availability is fixed after first prepare. + void* r2r = __atomic_load_n(&R2RCode_{{cb.EntrySymbol}}, __ATOMIC_ACQUIRE); + if (r2r == (void*)(intptr_t)-1) + { + r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_{{cb.EntrySymbol}}); + __atomic_store_n(&R2RCode_{{cb.EntrySymbol}}, r2r, __ATOMIC_RELEASE); + } + if (r2r != nullptr) + { + {{r2rDispatch}} + } + """ + : string.Empty; string exportFunction = cb.IsExport ? $$""" diff --git a/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp b/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp index d88c8b3a467764..b8d90d34d90148 100644 --- a/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp +++ b/src/coreclr/vm/wasm/browser/callhelpers-reverse.cpp @@ -16,7 +16,6 @@ extern "C" void ExecuteInterpretedMethodFromUnmanaged(MethodDesc* pMD, int8_t* a extern "C" void* GetR2RNativeCodeForUnmanagedCallersOnly(MethodDesc* pMD); static MethodDesc* MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -24,19 +23,6 @@ static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g_ { LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "g__Callback|72_0", &MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *))r2r)(arg0); - return; - } int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); @@ -105,7 +91,6 @@ extern "C" void SystemInteropJS_BindAssemblyExports(void * arg0) } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -113,26 +98,12 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelp { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.InitHelpers, System.Private.CoreLib", "CallClassConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -140,19 +111,6 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallDefaultConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); @@ -191,7 +149,6 @@ extern "C" void SystemInteropJS_CallDelegate(void * arg0) } static MethodDesc* MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -199,19 +156,6 @@ static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I3 { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "CallEntryPoint", &MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, int32_t, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); @@ -250,7 +194,6 @@ extern "C" void SystemInteropJS_CallJSExport(int32_t arg0, void * arg1) } static MethodDesc* MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -258,26 +201,12 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHo { LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "CallStartupHook", &MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -285,26 +214,12 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallToString", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid(void * arg0, int32_t arg1, uint32_t arg2, int64_t arg3, int64_t arg4, void * arg5, void * arg6) { // Lazy lookup of MethodDesc for the function export scenario. @@ -312,26 +227,12 @@ static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEven { LookupUnmanagedCallersOnlyMethodByName("System.Diagnostics.Tracing.EventPipeEventProvider, System.Private.CoreLib", "Callback", &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, uint32_t, int64_t, int64_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); - return; - } int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventPipeEventProvider_Callback_I32_I32_I32_I64_I64_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -339,26 +240,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -366,19 +253,6 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); @@ -417,7 +291,6 @@ extern "C" void SystemInteropJS_CompleteTask(void * arg0) } static MethodDesc* MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, int64_t arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -425,26 +298,12 @@ static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32 { LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "ConfigCallback", &MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, int32_t, int64_t))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -452,26 +311,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -479,26 +324,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -506,26 +337,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Convert { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -533,18 +350,6 @@ static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Conve { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToNative", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((void *(*)(void *, void *))r2r)(arg0, arg1); - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; void * result; @@ -553,7 +358,6 @@ static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Conve } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -561,26 +365,12 @@ static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.LoaderAllocator, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -588,26 +378,12 @@ static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_ { LookupUnmanagedCallersOnlyMethodByName("System.TypeLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); - return; - } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid(int32_t arg0, void * arg1, void * arg2, int32_t arg3, void * arg4, void * arg5, void * arg6) { // Lazy lookup of MethodDesc for the function export scenario. @@ -615,26 +391,12 @@ static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I { LookupUnmanagedCallersOnlyMethodByName("System.IO.FileLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(int32_t, void *, void *, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); - return; - } int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid(int32_t arg0, void * arg1, void * arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -642,26 +404,12 @@ static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateArgumentException", &MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(int32_t, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -669,26 +417,12 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAss { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "CreateAssemblyName", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -696,26 +430,12 @@ static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedExc { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateRuntimeWrappedException", &MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -723,26 +443,12 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationE { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTargetInvocationException", &MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -750,26 +456,12 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializatio { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTypeInitializationException", &MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -777,26 +469,12 @@ static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCa { LookupUnmanagedCallersOnlyMethodByName("System.Globalization.CalendarData, System.Private.CoreLib", "EnumCalendarInfoCallback", &MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -804,18 +482,6 @@ static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAp { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "ExecuteInDefaultAppDomain", &MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; int32_t result; @@ -824,7 +490,6 @@ static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAp } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -832,26 +497,12 @@ static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_ { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetCodeInfo", &MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); - return; - } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -859,26 +510,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "GetCustomMarshalerInstance", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -886,26 +523,12 @@ static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I3 { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetEHInfo", &MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -913,18 +536,6 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp { LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "GetFunctionPointer", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); - } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; int32_t result; @@ -933,7 +544,6 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -941,26 +551,12 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "GetInterfaceImplementation", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -968,26 +564,12 @@ static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I3 { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetJitContext", &MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -995,19 +577,6 @@ static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetLocalsSignature", &MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); @@ -1046,7 +615,6 @@ extern "C" void SystemInteropJS_GetManagedStackTrace(void * arg0) } static MethodDesc* MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1054,26 +622,12 @@ static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32 { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "GetResourceString", &MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1081,26 +635,12 @@ static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32 { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetStringLiteral", &MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, int32_t arg3, void * arg4, void * arg5, void * arg6) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1108,26 +648,12 @@ static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTy { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.TypeNameResolver, System.Private.CoreLib", "GetTypeHelper", &MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, int32_t, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); - return; - } int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1135,26 +661,12 @@ static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLine { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "InitializeCommandLineArgs", &MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1162,26 +674,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "InitializeDefaultContext", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *))r2r)(arg0); - return; - } int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1189,26 +687,12 @@ static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_I { LookupUnmanagedCallersOnlyMethodByName("System.Diagnostics.Tracing.EventSource, System.Private.CoreLib", "InitializeDefaultEventSources", &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *))r2r)(arg0); - return; - } int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, uint32_t arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1216,26 +700,12 @@ static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonit { LookupUnmanagedCallersOnlyMethodByName("System.Threading.Lock, System.Private.CoreLib", "InitializeForMonitor", &MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, uint32_t, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1243,26 +713,12 @@ static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTr { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "InternalPreserveStackTrace", &MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1270,26 +726,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArr { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "InvokeArrayContentsConverter", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1297,26 +739,12 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "IsInterfaceImplemented", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1324,26 +752,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1351,26 +765,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToUnmanaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, int32_t arg2, uint32_t arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1378,18 +778,6 @@ static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeL { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.NativeLibrary, System.Private.CoreLib", "LoadLibraryCallbackStub", &MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((void *(*)(void *, void *, int32_t, uint32_t, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; void * result; @@ -1398,7 +786,6 @@ static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeL } static MethodDesc* MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1406,26 +793,12 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartu { LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "ManagedStartup", &MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1433,18 +806,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewExternalTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *, void *))r2r)(arg0, arg1); - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; int32_t result; @@ -1453,7 +814,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1461,18 +821,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedExternalTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *))r2r)(arg0); - } int64_t args[1] = { (int64_t)arg0 }; int32_t result; @@ -1481,7 +829,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1489,18 +836,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedProxyTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *))r2r)(arg0); - } int64_t args[1] = { (int64_t)arg0 }; int32_t result; @@ -1509,7 +844,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1517,18 +851,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewProxyTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *, void *))r2r)(arg0, arg1); - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; int32_t result; @@ -1537,7 +859,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1545,26 +866,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1572,26 +879,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1599,26 +892,12 @@ static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnFirstChanceException", &MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1626,26 +905,12 @@ static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetV { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnProcessExit", &MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *))r2r)(arg0); - return; - } int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1653,26 +918,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnResourceResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1680,26 +931,12 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I { LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "OnThreadExited", &MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1707,26 +944,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnTypeResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1734,26 +957,12 @@ static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnUnhandledException", &MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1761,19 +970,6 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAs { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "ParseAsAssemblySpec", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); @@ -1812,7 +1008,6 @@ extern "C" void SystemInteropJS_ReleaseJSOwnedObjectByGCHandle(void * arg0) } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1820,26 +1015,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "Resolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1847,26 +1028,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveSatelliteAssembly", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1874,26 +1041,12 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32 { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveSignature", &MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1901,26 +1054,12 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32 { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveToken", &MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); - return; - } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1928,18 +1067,6 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDll", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((void *(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; void * result; @@ -1948,7 +1075,6 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1956,18 +1082,6 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDllUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((void *(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; void * result; @@ -1976,7 +1090,6 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1984,26 +1097,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -2011,26 +1110,12 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetV { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhRethrow", &MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -2038,26 +1123,12 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetV { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid(uint32_t arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -2065,26 +1136,12 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_Re { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowHwEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(uint32_t, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = (void*)(intptr_t)-1; static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32() { // Lazy lookup of MethodDesc for the function export scenario. @@ -2092,25 +1149,12 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( { LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "RunFinalizers", &MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((uint32_t(*)())r2r)(); - } uint32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, nullptr, 0, (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -2118,26 +1162,12 @@ static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_ { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "Setup", &MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, int32_t, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -2145,26 +1175,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StartAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -2172,26 +1188,12 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I3 { LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "StartCallback", &MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *))r2r)(arg0); - return; - } int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -2199,19 +1201,6 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StopAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); diff --git a/src/coreclr/vm/wasm/wasi/callhelpers-pinvoke.cpp b/src/coreclr/vm/wasm/wasi/callhelpers-pinvoke.cpp index ef460b8b653cbf..0f0f9ca8e353ab 100644 --- a/src/coreclr/vm/wasm/wasi/callhelpers-pinvoke.cpp +++ b/src/coreclr/vm/wasm/wasi/callhelpers-pinvoke.cpp @@ -344,7 +344,7 @@ static const Entry s_libSystem_Native [] = { DllImportEntry(SystemNative_GetCryptographicallySecureRandomBytes) // System.IO.Compression DllImportEntry(SystemNative_GetCwd) // System.Private.CoreLib DllImportEntry(SystemNative_GetDefaultSearchOrderPseudoHandle) // System.Private.CoreLib - DllImportEntry(SystemNative_GetErrNo) // System.Private.CoreLib + DllImportEntry(SystemNative_GetErrNo) // System.Net.NameResolution, System.Private.CoreLib DllImportEntry(SystemNative_GetHostEntryForName) // System.Net.NameResolution DllImportEntry(SystemNative_GetHostName) // System.Net.NameResolution DllImportEntry(SystemNative_GetIPv4Address) // System.Net.Primitives, System.Net.Sockets diff --git a/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp b/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp index 768fc20b4c5669..f60c87519e1a7a 100644 --- a/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp +++ b/src/coreclr/vm/wasm/wasi/callhelpers-reverse.cpp @@ -13,10 +13,8 @@ // The current approach has limitations with overloaded methods. extern "C" void LookupUnmanagedCallersOnlyMethodByName(const char* fullQualifiedTypeName, const char* methodName, MethodDesc** ppMD); extern "C" void ExecuteInterpretedMethodFromUnmanaged(MethodDesc* pMD, int8_t* args, size_t argSize, int8_t* ret, PCODE callerIp); -extern "C" void* GetR2RNativeCodeForUnmanagedCallersOnly(MethodDesc* pMD); static MethodDesc* MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -24,26 +22,12 @@ static void Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g_ { LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "g__Callback|72_0", &MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *))r2r)(arg0); - return; - } int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -51,26 +35,12 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelp { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.InitHelpers, System.Private.CoreLib", "CallClassConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_InitHelpers_CallClassConstructor_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -78,26 +48,12 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallDefaultConstructor", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallDefaultConstructor_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -105,26 +61,12 @@ static void Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I3 { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "CallEntryPoint", &MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, int32_t, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -132,26 +74,12 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHo { LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "CallStartupHook", &MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -159,26 +87,12 @@ static void Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeH { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.CompilerServices.RuntimeHelpers, System.Private.CoreLib", "CallToString", &MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_CompilerServices_RuntimeHelpers_CallToString_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -186,26 +100,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -213,26 +113,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ClearNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, int64_t arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -240,26 +126,12 @@ static void Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32 { LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "ConfigCallback", &MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, int32_t, int64_t))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -267,26 +139,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToManaged", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -294,26 +152,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "ConvertContentsToNative", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -321,26 +165,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Convert { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToManaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -348,18 +178,6 @@ static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Conve { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.BSTRMarshaler, System.Private.CoreLib", "ConvertToNative", &MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_ConvertToNative_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((void *(*)(void *, void *))r2r)(arg0, arg1); - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; void * result; @@ -368,7 +186,6 @@ static void * Call_System_Private_CoreLib_System_StubHelpers_BSTRMarshaler_Conve } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -376,26 +193,12 @@ static void Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.LoaderAllocator, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, int32_t arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -403,26 +206,12 @@ static void Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_ { LookupUnmanagedCallersOnlyMethodByName("System.TypeLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); - return; - } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_TypeLoadException_Create_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid(int32_t arg0, void * arg1, void * arg2, int32_t arg3, void * arg4, void * arg5, void * arg6) { // Lazy lookup of MethodDesc for the function export scenario. @@ -430,26 +219,12 @@ static void Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I { LookupUnmanagedCallersOnlyMethodByName("System.IO.FileLoadException, System.Private.CoreLib", "Create", &MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(int32_t, void *, void *, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); - return; - } int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_IO_FileLoadException_Create_I32_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid(int32_t arg0, void * arg1, void * arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -457,26 +232,12 @@ static void Call_System_Private_CoreLib_System_Exception_CreateArgumentException { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateArgumentException", &MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(int32_t, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateArgumentException_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -484,26 +245,12 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAss { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "CreateAssemblyName", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_AssemblyName_CreateAssemblyName_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -511,26 +258,12 @@ static void Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedExc { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateRuntimeWrappedException", &MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateRuntimeWrappedException_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -538,26 +271,12 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationE { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTargetInvocationException", &MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateTargetInvocationException_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -565,26 +284,12 @@ static void Call_System_Private_CoreLib_System_Exception_CreateTypeInitializatio { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "CreateTypeInitializationException", &MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_CreateTypeInitializationException_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -592,26 +297,12 @@ static void Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCa { LookupUnmanagedCallersOnlyMethodByName("System.Globalization.CalendarData, System.Private.CoreLib", "EnumCalendarInfoCallback", &MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -619,18 +310,6 @@ static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAp { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "ExecuteInDefaultAppDomain", &MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_ExecuteInDefaultAppDomain_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; int32_t result; @@ -639,7 +318,6 @@ static int32_t Call_System_Private_CoreLib_System_Environment_ExecuteInDefaultAp } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -647,26 +325,12 @@ static void Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_ { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetCodeInfo", &MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); - return; - } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -674,26 +338,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshale { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.MngdRefCustomMarshaler, System.Private.CoreLib", "GetCustomMarshalerInstance", &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_GetCustomMarshalerInstance_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -701,26 +351,12 @@ static void Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I3 { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetEHInfo", &MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetEHInfo_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -728,18 +364,6 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp { LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "GetFunctionPointer", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); - } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; int32_t result; @@ -748,7 +372,6 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -756,26 +379,12 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "GetInterfaceImplementation", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_GetInterfaceImplementation_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -783,26 +392,12 @@ static void Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I3 { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetJitContext", &MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -810,26 +405,12 @@ static void Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetLocalsSignature", &MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -837,26 +418,12 @@ static void Call_System_Private_CoreLib_System_Environment_GetResourceString_I32 { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "GetResourceString", &MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_GetResourceString_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -864,26 +431,12 @@ static void Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32 { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "GetStringLiteral", &MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, int32_t arg3, void * arg4, void * arg5, void * arg6) { // Lazy lookup of MethodDesc for the function export scenario. @@ -891,26 +444,12 @@ static void Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTy { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.TypeNameResolver, System.Private.CoreLib", "GetTypeHelper", &MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, int32_t, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); - return; - } int64_t args[7] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5, (int64_t)arg6 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_TypeNameResolver_GetTypeHelper_I32_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -918,26 +457,12 @@ static void Call_System_Private_CoreLib_System_Environment_InitializeCommandLine { LookupUnmanagedCallersOnlyMethodByName("System.Environment, System.Private.CoreLib", "InitializeCommandLineArgs", &MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Environment_InitializeCommandLineArgs_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -945,26 +470,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "InitializeDefaultContext", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *))r2r)(arg0); - return; - } int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_InitializeDefaultContext_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -972,26 +483,12 @@ static void Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_I { LookupUnmanagedCallersOnlyMethodByName("System.Diagnostics.Tracing.EventSource, System.Private.CoreLib", "InitializeDefaultEventSources", &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *))r2r)(arg0); - return; - } int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, uint32_t arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -999,26 +496,12 @@ static void Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonit { LookupUnmanagedCallersOnlyMethodByName("System.Threading.Lock, System.Private.CoreLib", "InitializeForMonitor", &MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, uint32_t, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Lock_InitializeForMonitor_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1026,26 +509,12 @@ static void Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTr { LookupUnmanagedCallersOnlyMethodByName("System.Exception, System.Private.CoreLib", "InternalPreserveStackTrace", &MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Exception_InternalPreserveStackTrace_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1053,26 +522,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArr { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "InvokeArrayContentsConverter", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_InvokeArrayContentsConverter_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1080,26 +535,12 @@ static void Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicIn { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.DynamicInterfaceCastableHelpers, System.Private.CoreLib", "IsInterfaceImplemented", &MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_InteropServices_DynamicInterfaceCastableHelpers_IsInterfaceImplemented_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1107,26 +548,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToManaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToManaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1134,26 +561,12 @@ static void Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTyp { LookupUnmanagedCallersOnlyMethodByName("System.StubHelpers.StubHelpers, System.Private.CoreLib", "LayoutTypeConvertToUnmanaged", &MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StubHelpers_StubHelpers_LayoutTypeConvertToUnmanaged_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1161,18 +574,6 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp { LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "LoadAssembly", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; int32_t result; @@ -1181,7 +582,6 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1189,18 +589,6 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp { LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "LoadAssemblyAndGetFunctionPointer", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); - } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; int32_t result; @@ -1209,7 +597,6 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp } static MethodDesc* MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1217,18 +604,6 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp { LookupUnmanagedCallersOnlyMethodByName("Internal.Runtime.InteropServices.ComponentActivator, System.Private.CoreLib", "LoadAssemblyBytes", &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *, void *, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); - } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; int32_t result; @@ -1237,7 +612,6 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_Comp } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, int32_t arg2, uint32_t arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1245,18 +619,6 @@ static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeL { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.NativeLibrary, System.Private.CoreLib", "LoadLibraryCallbackStub", &MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_NativeLibrary_LoadLibraryCallbackStub_I32_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((void *(*)(void *, void *, int32_t, uint32_t, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; void * result; @@ -1265,7 +627,6 @@ static void * Call_System_Private_CoreLib_System_Runtime_InteropServices_NativeL } static MethodDesc* MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1273,26 +634,12 @@ static void Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartu { LookupUnmanagedCallersOnlyMethodByName("System.StartupHookProvider, System.Private.CoreLib", "ManagedStartup", &MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_StartupHookProvider_ManagedStartup_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1300,18 +647,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewExternalTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *, void *))r2r)(arg0, arg1); - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; int32_t result; @@ -1320,7 +655,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1328,18 +662,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedExternalTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedExternalTypeMap_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *))r2r)(arg0); - } int64_t args[1] = { (int64_t)arg0 }; int32_t result; @@ -1348,7 +670,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1356,18 +677,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewPrecachedProxyTypeMap", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewPrecachedProxyTypeMap_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *))r2r)(arg0); - } int64_t args[1] = { (int64_t)arg0 }; int32_t result; @@ -1376,7 +685,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 = (void*)(intptr_t)-1; static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1384,18 +692,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.InteropServices.TypeMapLazyDictionary, System.Private.CoreLib", "NewProxyTypeEntry", &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((int32_t(*)(void *, void *))r2r)(arg0, arg1); - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; int32_t result; @@ -1404,7 +700,6 @@ static int32_t Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMa } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1412,26 +707,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1439,26 +720,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnAssemblyResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1466,26 +733,12 @@ static void Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnFirstChanceException", &MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnFirstChanceException_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1493,26 +746,12 @@ static void Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetV { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnProcessExit", &MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *))r2r)(arg0); - return; - } int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnProcessExit_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1520,26 +759,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnResourceResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1547,26 +772,12 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I { LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "OnThreadExited", &MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Thread_OnThreadExited_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1574,26 +785,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "OnTypeResolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1601,26 +798,12 @@ static void Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "OnUnhandledException", &MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_OnUnhandledException_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1628,26 +811,12 @@ static void Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAs { LookupUnmanagedCallersOnlyMethodByName("System.Reflection.AssemblyName, System.Private.CoreLib", "ParseAsAssemblySpec", &MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Reflection_AssemblyName_ParseAsAssemblySpec_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1655,26 +824,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "Resolve", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1682,26 +837,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveSatelliteAssembly", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, int32_t arg2, void * arg3, void * arg4) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1709,26 +850,12 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32 { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveSignature", &MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, int32_t, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4); - return; - } int64_t args[5] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_ResolveSignature_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid(void * arg0, int32_t arg1, void * arg2, void * arg3, void * arg4, void * arg5) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1736,26 +863,12 @@ static void Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32 { LookupUnmanagedCallersOnlyMethodByName("System.Resolver, System.Private.CoreLib", "ResolveToken", &MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, int32_t, void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3, arg4, arg5); - return; - } int64_t args[6] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3, (int64_t)arg4, (int64_t)arg5 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Resolver_ResolveToken_I32_I32_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1763,18 +876,6 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDll", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDll_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((void *(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; void * result; @@ -1783,7 +884,6 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32 = (void*)(intptr_t)-1; static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1791,18 +891,6 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUnmanagedDllUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUnmanagedDllUsingEvent_I32_I32_I32_I32_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((void *(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; void * result; @@ -1811,7 +899,6 @@ static void * Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadCont } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1819,26 +906,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "ResolveUsingEvent", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1846,26 +919,12 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetV { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhRethrow", &MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhRethrow_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1873,26 +932,12 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetV { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhThrowEx_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid(uint32_t arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1900,26 +945,12 @@ static void Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_Re { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.EH, System.Private.CoreLib", "RhThrowHwEx", &MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(uint32_t, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_EH_RhThrowHwEx_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = nullptr; -static void* R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32 = (void*)(intptr_t)-1; static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32() { // Lazy lookup of MethodDesc for the function export scenario. @@ -1927,25 +958,12 @@ static uint32_t Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32( { LookupUnmanagedCallersOnlyMethodByName("System.GC, System.Private.CoreLib", "RunFinalizers", &MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - return ((uint32_t(*)())r2r)(); - } uint32_t result; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32, nullptr, 0, (int8_t*)&result, (PCODE)&Call_System_Private_CoreLib_System_GC_RunFinalizers_Void_RetI32); return result; } static MethodDesc* MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid(void * arg0, void * arg1, int32_t arg2, void * arg3) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1953,26 +971,12 @@ static void Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_ { LookupUnmanagedCallersOnlyMethodByName("System.AppContext, System.Private.CoreLib", "Setup", &MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, int32_t, void *))r2r)(arg0, arg1, arg2, arg3); - return; - } int64_t args[4] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2, (int64_t)arg3 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid(void * arg0, void * arg1, void * arg2) { // Lazy lookup of MethodDesc for the function export scenario. @@ -1980,26 +984,12 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StartAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *, void *))r2r)(arg0, arg1, arg2); - return; - } int64_t args[3] = { (int64_t)arg0, (int64_t)arg1, (int64_t)arg2 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StartAssemblyLoad_I32_I32_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid(void * arg0) { // Lazy lookup of MethodDesc for the function export scenario. @@ -2007,26 +997,12 @@ static void Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I3 { LookupUnmanagedCallersOnlyMethodByName("System.Threading.Thread, System.Private.CoreLib", "StartCallback", &MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *))r2r)(arg0); - return; - } int64_t args[1] = { (int64_t)arg0 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Threading_Thread_StartCallback_I32_RetVoid); } static MethodDesc* MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = nullptr; -static void* R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid = (void*)(intptr_t)-1; static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid(void * arg0, void * arg1) { // Lazy lookup of MethodDesc for the function export scenario. @@ -2034,19 +1010,6 @@ static void Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContex { LookupUnmanagedCallersOnlyMethodByName("System.Runtime.Loader.AssemblyLoadContext, System.Private.CoreLib", "StopAssemblyLoad", &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); } - // Prefer the R2R native entrypoint when this callback was compiled (partial R2R). - // Resolve once and cache; a method's native-code availability is fixed after first prepare. - void* r2r = __atomic_load_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, __ATOMIC_ACQUIRE); - if (r2r == (void*)(intptr_t)-1) - { - r2r = GetR2RNativeCodeForUnmanagedCallersOnly(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); - __atomic_store_n(&R2RCode_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, r2r, __ATOMIC_RELEASE); - } - if (r2r != nullptr) - { - ((void(*)(void *, void *))r2r)(arg0, arg1); - return; - } int64_t args[2] = { (int64_t)arg0, (int64_t)arg1 }; ExecuteInterpretedMethodFromUnmanaged(MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid, (int8_t*)args, sizeof(args), nullptr, (PCODE)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_StopAssemblyLoad_I32_I32_RetVoid); From 0628cb6552acd2606e3da4ff82119930cbf949ca Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 29 Sep 2026 13:06:58 +0200 Subject: [PATCH 14/14] Scope R2R export-gating test to its own callback symbol The generator scans CoreLib too, whose framework callbacks are exported by name, so the browser CoreLib makes the R2R extern and atomics appear regardless of the test's own callback. Assert on this callback's mangled R2RCode_ symbol instead of the shared strings, which failed on the browser leg while passing against the windows CoreLib. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../WasmArgumentLayoutTests.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs index 773287c45d7dd3..7dad79aa57399c 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs @@ -909,17 +909,18 @@ public static class Exports Assert.Equal(0, exitCode); string reverseHelpers = File.ReadAllText(Path.Combine(outputDirectory, "callhelpers-reverse.cpp")); + // CoreLib is part of the scan context, so its own exported callbacks emit R2R dispatch too. + // Scope the assertions to this callback's mangled symbol to test the gating in isolation. + const string mySymbol = "R2RCode_Callbacks__Exports_Handle"; if (expectR2RDispatch) { - Assert.Contains("GetR2RNativeCodeForUnmanagedCallersOnly", reverseHelpers); - Assert.Contains("__atomic_load_n", reverseHelpers); - Assert.Contains("__atomic_store_n", reverseHelpers); + Assert.Contains(mySymbol, reverseHelpers); + Assert.Contains($"__atomic_load_n(&{mySymbol}", reverseHelpers); + Assert.Contains($"__atomic_store_n(&{mySymbol}", reverseHelpers); } else { - Assert.DoesNotContain("GetR2RNativeCodeForUnmanagedCallersOnly", reverseHelpers); - Assert.DoesNotContain("__atomic_load_n", reverseHelpers); - Assert.DoesNotContain("__atomic_store_n", reverseHelpers); + Assert.DoesNotContain(mySymbol, reverseHelpers); } } finally