Disable qcalls on wasm. Treat them as normal pinvokes.#43798
Disable qcalls on wasm. Treat them as normal pinvokes.#43798vargaz merged 3 commits intodotnet:masterfrom
Conversation
src/mono/wasm/wasm.proj
Outdated
There was a problem hiding this comment.
Because QCalls are implemented on the managed side as pinvokes with to the module 'QCall'.
There was a problem hiding this comment.
Wouldn't be better to handle that inside runtime?
There was a problem hiding this comment.
Wouldn't be better to handle that inside runtime?
We want to make it possible to remove the native code of pinvokes/qcalls that are not called anywhere in managed. If the runtime has an array of qcall functions, the native linker won't be able to drop them
There was a problem hiding this comment.
There is a patch which adds a lot more of these so this won't work
There was a problem hiding this comment.
It's just intended as a temporary hack until that MetadataLoadContext bug is fixed though, so it might be fine for now? Unless you think that patch is landing soon.
There was a problem hiding this comment.
That patch landed yesterday so this does not work anymore
There was a problem hiding this comment.
catch NotSupportedException and map to int 😬
There was a problem hiding this comment.
It looks like all the delegate* in that patch are in assemblies we don't support
There was a problem hiding this comment.
/Users/lewing/Source/runtime/src/mono/wasm/wasm.proj(48,5): error MSB4018: The "PInvokeTableGenerator" task failed unexpectedly.
/Users/lewing/Source/runtime/src/mono/wasm/wasm.proj(48,5): error MSB4018: System.Exception: The return type 'Interop+BOOL' of pinvoke callback method 'Interop+BOOL EnumCalendarInfoCallback(System.Char*, System.UInt32, System.IntPtr, System.Void*)' needs to be blittable.
/Users/lewing/Source/runtime/src/mono/wasm/wasm.proj(48,5): error MSB4018: at PInvokeTableGenerator.Error(String msg) in /Users/lewing/Source/runtime/tools-local/tasks/mobile.tasks/WasmAppBuilder/PInvokeTableGenerator.cs:line 313
/Users/lewing/Source/runtime/src/mono/wasm/wasm.proj(48,5): error MSB4018: at PInvokeTableGenerator.EmitNativeToInterp(StreamWriter w, List`1 callbacks) in /Users/lewing/Source/runtime/tools-local/tasks/mobile.tasks/WasmAppBuilder/PInvokeTableGenerator.cs:line 196
/Users/lewing/Source/runtime/src/mono/wasm/wasm.proj(48,5): error MSB4018: at PInvokeTableGenerator.GenPInvokeTable(String[] pinvokeModules, String[] assemblies) in /Users/lewing/Source/runtime/tools-local/tasks/mobile.tasks/WasmAppBuilder/PInvokeTableGenerator.cs:line 53
/Users/lewing/Source/runtime/src/mono/wasm/wasm.proj(48,5): error MSB4018: at PInvokeTableGenerator.Execute() in /Users/lewing/Source/runtime/tools-local/tasks/mobile.tasks/WasmAppBuilder/PInvokeTableGenerator.cs:line 28
/Users/lewing/Source/runtime/src/mono/wasm/wasm.proj(48,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
/Users/lewing/Source/runtime/src/mono/wasm/wasm.proj(48,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
|
@lambdageek please review |
There was a problem hiding this comment.
It's just intended as a temporary hack until that MetadataLoadContext bug is fixed though, so it might be fine for now? Unless you think that patch is landing soon.
tools-local/tasks/mobile.tasks/WasmAppBuilder/PInvokeTableGenerator.cs
Outdated
Show resolved
Hide resolved
tools-local/tasks/mobile.tasks/WasmAppBuilder/PInvokeTableGenerator.cs
Outdated
Show resolved
Hide resolved
lambdageek
left a comment
There was a problem hiding this comment.
I think you also need to exclude entrypoints.c from the sources in src/mono/mini/CMakeLists.txt. Otherwise gPalGlobalizationNative will still build the array of all the globalization functions.
It will be built, but nothing will reference it. Will check. |
Removing it doesn't seem to matter. |
This is needed because they are stored in a separate table, so they cannot be linked out the same way as pinvokes/icalls.
…rator.cs Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
…rator.cs Co-authored-by: Ryan Lucia <ryan@luciaonline.net>
This is needed because they are stored in a separate table, so they cannot be linked out the same
way as pinvokes/icalls.