-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[browser] modularize corerun #121318
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
base: main
Are you sure you want to change the base?
[browser] modularize corerun #121318
Conversation
|
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov |
7501a3b to
e993dc3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements infrastructure for WASM/browser diagnostics support and refactors module initialization, including renaming PromiseController to PromiseCompletionSource, consolidating Emscripten export definitions, and adding support for Virtual File System (VFS) operations.
- Adds new
dotnet.diagnostics.jsmodule infrastructure with rollup configuration - Refactors promise-related APIs from PromiseController to PromiseCompletionSource across the codebase
- Consolidates Emscripten export definitions into a centralized
GenerateEmccExportstarget innative.wasm.targets - Adds VFS file installation support and runtime registration for corehost browserhost
- Introduces unsigned right-shift operations (
>>> 0) for memory safety in pointer operations
Reviewed Changes
Copilot reviewed 47 out of 50 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/rollup.config.js | Adds dotnetDiagnosticsJS configuration for new diagnostics module build |
| src/native/rollup.config.defines.js | Adds fallback default path for StaticLibDestination to support local development |
| src/native/libs/build-native.proj | Changes import from native.props to native.wasm.targets and adds GenerateEmccExports dependency |
| src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/weak-ref.ts | Adds weak reference utility functions with polyfill fallback for browsers lacking WeakRef support |
| src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/types.ts | Defines WeakRefInternal type extending WeakRef with optional dispose method |
| src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/index.ts | Formatting: adds spacing in function signature |
| src/native/libs/System.Native.Browser/utils/types.ts | Re-exports types from parent types module |
| src/native/libs/System.Native.Browser/utils/strings.ts | Adds unsigned right-shift operations for pointer safety |
| src/native/libs/System.Native.Browser/utils/runtime-list.ts | Implements runtime registry using WeakRef for managing multiple dotnet runtimes on a page |
| src/native/libs/System.Native.Browser/utils/polyfills.ts | Adds WeakRef polyfill for browsers lacking native support |
| src/native/libs/System.Native.Browser/utils/memory.ts | Adds unsigned right-shift operations for safe memory access and updates import path |
| src/native/libs/System.Native.Browser/utils/index.ts | Initializes polyfills, registers runtime and CDAC, adds zeroRegion export |
| src/native/libs/System.Native.Browser/utils/host.ts | Renames parameter from exit_code to exitCode |
| src/native/libs/System.Native.Browser/utils/cdac.ts | Registers CDAC (Contract Descriptor for Active Contract) functions to runtime API |
| src/native/libs/System.Native.Browser/native/timer.ts | Updates to use global functions instead of Module namespace |
| src/native/libs/System.Native.Browser/native/main.ts | Adds return type annotations and SystemJS_ConsoleClear function |
| src/native/libs/System.Native.Browser/native/index.ts | Exports SystemJS_ConsoleClear and formatting improvements |
| src/native/libs/System.Native.Browser/native/cross-linked.ts | Adds _GetDotNetRuntimeContractDescriptor function declaration |
| src/native/libs/System.Native.Browser/libSystem.Native.Browser.footer.js | Adds GetDotNetRuntimeContractDescriptor to dependencies |
| src/native/libs/System.Native.Browser/entrypoints.c | Adds SystemJS_ConsoleClear entrypoint |
| src/native/libs/System.Native.Browser/diagnostics/index.ts | Creates placeholder diagnostics module with dummy export |
| src/native/libs/Common/JavaScript/types/public-api.ts | Renames parameter from exit_code to exitCode and adds VfsAsset type |
| src/native/libs/Common/JavaScript/types/internal.ts | Renames PromiseController to PromiseCompletionSource |
| src/native/libs/Common/JavaScript/types/exchange.ts | Adds exports for debug logging, promise utilities, VFS operations, and zeroRegion |
| src/native/libs/Common/JavaScript/cross-module/index.ts | Updates table indices after adding debug logger and new loader exports |
| src/native/libs/Common/JavaScript/cross-linked/index.ts | Adds type annotations, RuntimeExports, and global function declarations |
| src/native/libs/Common/JavaScript/CMakeLists.txt | Reorganizes source file list and adds new diagnostics, polyfills, and utility files |
| src/native/corehost/corehost.proj | Changes import and adds GenerateEmccExports and ResolveRuntimeFilesFromLocalBuild dependencies |
| src/native/corehost/browserhost/sample/CMakeLists.txt | Adds dotnet.diagnostics.js and map file to sample assets |
| src/native/corehost/browserhost/loader/run.ts | Renames PromiseController to PromiseCompletionSource and adds selfHostNodeJS for Node.js auto-start |
| src/native/corehost/browserhost/loader/promise-completion-source.ts | Renames from promise-controller.ts with updated symbol and function names |
| src/native/corehost/browserhost/loader/polyfills.ts | Removes WeakRef polyfill (moved to utils), adds nodeFs/nodeUrl helpers |
| src/native/corehost/browserhost/loader/logging.ts | Adds debug logging function |
| src/native/corehost/browserhost/loader/index.ts | Adds debug logger and promise completion source exports to loader exchange |
| src/native/corehost/browserhost/loader/exit.ts | Renames parameter from exit_code to exitCode |
| src/native/corehost/browserhost/loader/dotnet.ts | Removes registerRuntime call and adds selfHostNodeJS for auto-start |
| src/native/corehost/browserhost/loader/dotnet.d.ts | Renames parameter and adds VfsAsset type definition |
| src/native/corehost/browserhost/loader/bootstrap.ts | Adds findResources, isNodeHosted, isShellHosted functions and VFS fetching support |
| src/native/corehost/browserhost/libBrowserHost.footer.js | Adds FS and NODEFS dependencies and Node.js filesystem mounting |
| src/native/corehost/browserhost/host/index.ts | Adds installVfsFile export to browser host exports |
| src/native/corehost/browserhost/host/host.ts | Implements installVfsFile for creating files in Emscripten virtual filesystem |
| src/native/corehost/browserhost/browserhost.cpp | Updates library name matching from libSystem.JavaScript to libSystem.JavaScript.Native |
| src/native/corehost/browserhost/CMakeLists.txt | Refactors to use CMAKE variables for Emscripten exports, adds environment and error limit flags |
| src/coreclr/vm/wasm/callhelpers.cpp | Adds CallFunc_I32_I32_IND_RetVoid thunk for new call signature |
| src/coreclr/runtime.proj | Changes import and adds GenerateEmccExports dependency |
| src/coreclr/hosts/corerun/wasm/libCorerun.pre.js | Removed file (functionality moved to extpost) |
| src/coreclr/hosts/corerun/wasm/libCorerun.extpost.js | New file implementing corerun initialization as ES6 module |
| src/coreclr/hosts/corerun/CMakeLists.txt | Switches from pre-js to extern-post-js and uses CMAKE variables for exports |
| eng/native.wasm.targets | New file consolidating WASM/browser build configuration and Emscripten export generation |
| eng/native.props | Removed file (moved to native.wasm.targets) |
eng\native.propstoeng\native.wasm.targetsand addGenerateEmccExportstargetGenerateEmccExportsthe target to calculateEmccExportedRuntimeMethodandEmccExportedFunctionCMAKE_EMCC_EXPORTED_RUNTIME_METHODSandCMAKE_EMCC_EXPORTED_FUNCTIONSTargetotherwise MSBuild doesn't respectItemGroup/PropertyGrouporderCMAKE_EMCC_EXPORTED_RUNTIME_METHODSandCMAKE_EMCC_EXPORTED_FUNCTIONSin corerun and browserhostcorerun.jsglobalThislibCorerun.pre.jstolibCorerun.extpost.jsthis changes howselfRunworks for corerun-sNODERAWFS=1- this also fixes$PATHemscripten moduleCallFunc_I32_I32_IND_RetVoidinwasm\callhelpers.cppdotnet.diagnostics.jspinvoke_overridenamesfetchVfs,installVfsFilenode dotnet.js hello.dllshould behave same asdotnet hello.dlldotnet.boot.jsmanifest - self-configure infindResourcesisNodeHostedselfHostNodeJS/managedPromiseCompletionSourceand export more helpers to cross-module exchangeRuntimeListso thatglobalThis.getDotnetRuntime(0)works also for corerunSystemJS_ConsoleClearGetDotNetRuntimeContractDescriptorviaglobalThis.getDotnetRuntime(0).INTERNAL.GetDotNetRuntimeContractDescriptor()GetDotNetRuntimeHeapviaglobalThis.getDotnetRuntime(0).INTERNAL.GetDotNetRuntimeHeap(ptr, length)Module.HEAPU8