-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[wasm] Improvements to startup performance of mono_wasm_get_assembly_exports #99924
Conversation
Requesting review to get feedback. I hope someone knows trimming better than me and can suggest how to fix this. Put a dependency attribute of some kind on the generated module initializer, maybe? |
...braries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportGenerator.cs
Outdated
Show resolved
Hide resolved
...ropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.cs
Outdated
Show resolved
Hide resolved
64759a1
to
8a4b7fc
Compare
8a4b7fc
to
96666c5
Compare
Could you please show the generated code ? |
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute]
unsafe class __GeneratedInitializer
{
[global::System.ThreadStaticAttribute]
static bool initialized;
[global::System.Runtime.CompilerServices.ModuleInitializerAttribute, global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods, typeof(__GeneratedInitializer))]
static internal void __Net7SelfInit_()
{
}
[global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute("__Wrapper_PrepareToRender_1401412665", "MainJS", "RayTracer")]
[global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute("__Wrapper_OnClick_1317452459", "MainJS", "RayTracer")]
static void __Register_()
{
if (initialized || global::System.Runtime.InteropServices.RuntimeInformation.OSArchitecture != global::System.Runtime.InteropServices.Architecture.Wasm)
return;
initialized = true;
global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction("[RayTracer]MainJS:PrepareToRender", 1401412665, new global::System.Runtime.InteropServices.JavaScript.JSMarshalerType[] { global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.ArraySegment(global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Byte), global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32 });
global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction("[RayTracer]MainJS:OnClick", 1317452459, new global::System.Runtime.InteropServices.JavaScript.JSMarshalerType[] { global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task() });
}
} |
Let's rename |
9b8c760
to
77f918b
Compare
Here we are removing support for 3rd party library/nuget generated by Net9 SDK from being able to run on Net7 runtime. |
.NET 7 is EOL on May 14, 2024. Removing support seems reasonable to me |
…exports (dotnet#99924) Change generated JSImport/JSExport initializer to not rely on Environment.Version, for faster startup
Generated JSImport/JSExport initializer does an
Environment.Version
check to see if we're on NET7. That check is tremendously expensive, because it fetches a CustomAttribute instance off of something in corlib, then parses the version string (parsing version strings initializes a bunch of stuff). This PR removes that check and adds a linker dependency to keep the registration method alive so it can be called when needed.We will also need to document that DLLs (in nugets?) generated by this new version of the generator won't work on NET7 runtimes, since the relevant logic to perform automatic registration on that version.