Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NativeAOT-LLVM] [Question] CORINFO_HELP_READYTORUN_DELEGATE_CTOR implementation #1870

Closed
yowl opened this issue Mar 13, 2022 · 1 comment
Closed
Labels
area-NativeAOT-LLVM LLVM generation for Native AOT compilation (including Web Assembly)

Comments

@yowl
Copy link
Contributor

yowl commented Mar 13, 2022

When compiling

private AssemblyBinderImplementation()
{
_scopeGroups = new KeyValuePair<RuntimeAssemblyName, ScopeDefinitionGroup>[0];
ModuleList.AddModuleRegistrationCallback(RegisterModule);
}

AddModuleRegistrationCallback accepts a Action<ModuleInfo> and so will call the helper CORINFO_HELP_READYTORUN_DELEGATE_CTOR .

For the helper CORINFO_HELP_READYTORUN_DELEGATE_CTOR , if I ask for the symbol name from its call->gtEntryPoint.handle I'll get something like:

__DelegateCtor_S_P_CoreLib_System_Delegate__InitializeClosedInstance__S_P_TypeLoader_Internal_Reflection_Execution_AssemblyBinderImplementation__RegisterModule

I'd then have to write out an implementation for this ( which I believe we don't currently have), that would go on to call S_P_CoreLib_System_Delegate__InitializeClosedInstance I suppose.

My question is, should I do that? I ask because the IL implementation for the ctor in AssemblyBinderImplementation would directly call S_P_CoreLib_System_Delegate__InitializeClosedInstance without the need for a __DelegateCtor_S_P_CoreLib_System_Delegate__InitializeClosedInstance__S_P_TypeLoader_Internal_Reflection_Execution_AssemblyBinderImplementation__RegisterModule .

Thanks

@jkotas
Copy link
Member

jkotas commented Mar 13, 2022

I ask because the IL implementation for the ctor in AssemblyBinderImplementation would directly call S_P_CoreLib_System_Delegate__InitializeClosedInstance

I think you would need to inline it in the importer in fgOptimizeDelegateConstructor to make this work. Is it what you meant? It sounds good to me. It may improve the nativeaot non-wasm path as well.

@jkotas jkotas added the area-NativeAOT-LLVM LLVM generation for Native AOT compilation (including Web Assembly) label Mar 13, 2022
@yowl yowl closed this as completed Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-LLVM LLVM generation for Native AOT compilation (including Web Assembly)
Projects
None yet
Development

No branches or pull requests

2 participants