Skip to content
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

Document the initialization order #23492

Open
brendandahl opened this issue Jan 24, 2025 · 1 comment
Open

Document the initialization order #23492

brendandahl opened this issue Jan 24, 2025 · 1 comment
Assignees

Comments

@brendandahl
Copy link
Collaborator

This is a reminder that I need to add this to the docs somewhere....

Initialization Order

  • Top Level Code (or init() when MODULARIZE=instance)
    • Await createWasm()
      • getWasmImports
      • Await instanitateAsync
        • WebAssembly.instantiateStreaming
      • receiveInstantiationResult
        • Assign wasmExports
        • Remove run dependencies “wasm-instantiate”
    • Assign globals from wasmExports
    • Call Module[“preInit”] (if defined)
    • run()
      • (may bail of runDependencies not empty)
      • preRun()
        • Call Module[“preRun”] (if defined)
        • Call __ATPRERUN__
      • doRun()
        • initRuntime()
          • Call __ATINIT__
            • $__wasm_call_ctors
            • ?? embindUpdateExports
        • preMain()
          • Call __ATMAIN__
        • readyPromiseResolve
        • Call Module[“onRuntimeInitialized”] (if defined)
        • callMain() (if shouldRun)
          • Throws exception to quit
        • postRun()
          • Call Module[“postRun”] (if defined)
          • Call __ATPOSTRUN__
@brendandahl brendandahl self-assigned this Jan 24, 2025
@sbc100
Copy link
Collaborator

sbc100 commented Jan 24, 2025

Thanks for opening!

Maybe this should go in site/source/docs/contributing/developers_guide.rst ? Or a new sub-section?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants