dotnet / runtimelab

This repo is for experimentation and exploring new ideas that may or may not make it into the main dotnet/runtime repo.
MIT License
1.36k stars 188 forks source link

[NativeAOT-LLVM] Fix generating wasm export name for JSExport registration method #2581

Closed maraf closed 1 month ago

maraf commented 1 month ago

cc @dotnet/nativeaot-llvm

maraf commented 1 month ago

Question: what prevents the code from using the original names (with dots and things)?

Emscripten is generating local variables for all exports and doesn't do the dot replace

var _mono_wasm_load_icu_data = Module['_mono_wasm_load_icu_data'] = createExportWrapper('mono_wasm_load_icu_data');
var _System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask = Module['_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask'] = createExportWrapper('System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask');
var _System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate = Module['_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate'] = createExportWrapper('System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate');
var __5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_DelegateMarshalling_466611500 = Module['__5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_DelegateMarshalling_466611500'] = createExportWrapper('_5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_DelegateMarshalling_466611500');
var __5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_JSObject_2073398274 = Module['__5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_JSObject_2073398274'] = createExportWrapper('_5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_JSObject_2073398274');
var __5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_AsyncWithCancel_1775108263 = Module['__5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_AsyncWithCancel_1775108263'] = createExportWrapper('_5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_AsyncWithCancel_1775108263');
var __5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_Async_690947675 = Module['__5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_Async_690947675'] = createExportWrapper('_5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_Async_690947675');
var __5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_Throw_965526960 = Module['__5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_Throw_965526960'] = createExportWrapper('_5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_Throw_965526960');
var __5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_Concat_599381252 = Module['__5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_Concat_599381252'] = createExportWrapper('_5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_Concat_599381252');
var __5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_Square_2059988945 = Module['__5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_Square_2059988945'] = createExportWrapper('_5B_DotnetJs_5D_DotnetJsApp_Program_2F_Interop_3A_Square_2059988945');
var _DotnetJs__GeneratedInitializer__Register_ = Module['_DotnetJs__GeneratedInitializer__Register_'] = createExportWrapper('DotnetJs__GeneratedInitializer__Register_');