Skip to content

[NativeAOT LLVM] Support dotnet.js #2434

Open
@maraf

Description

@maraf
  • Building naot flavored dotnet.js
  • Enable dotnet.js for naot-llvm apps targeting browser-wasm
  • JS interop
    • Interop.Runtime.cs as wasm imports (instead of icalls)
    • Marshaling
      • JS marshallers should expect wasm import/export instead of Mono reflection found methods
      • Copy string to heap instead of passing MonoString ref to JS (already as feature flag in upstream)
      • Tasks
      • Delegates
      • JSObject
    • JSImport
    • JSExport
      • Generated __Register_ as wasm export
      • Generated wrapper as wasm export
    • Deliver the interop generator outside of app.ref pack
  • Main
    • Export user written Main (possibly async) as wasm export (we need to do JS marshaling for it). Generated managed_main is also responsible for storing args and tearingdown the runtime
    • Store args, so they are available from Environment.GetCommandLineArgs()
  • Yield to JS event loop
  • Timers
  • Allow to call UCO exports before Main (aka library mode)
  • Add support for environment variables
  • Add support for runtime options
  • Move runtime JS files to /aotsdk instead of /framework
  • Find a proper solution for Interop.Runtime.NativeAOT.cs and other switches in libs (libs can't use switch based on runtime flavor)
  • Run library tests
    • System.Runtime.InteropServices.JavaScript

Smoke test with currently supported feature set
https://github.com/dotnet/runtimelab/blob/feature/NativeAOT-LLVM/src/tests/nativeaot/SmokeTests/DotnetJs

Original prototype
https://github.com/maraf/MinimalDotNetWasmNativeAOT/tree/dotnetjs/DotnetJsHack

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-NativeAOT-LLVMLLVM generation for Native AOT compilation (including Web Assembly)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions