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

runtime, builder: WebAssembly reactor mode #4082

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Commits on Mar 20, 2024

  1. builder, src/runtime, targets, tests/wasm: prototype WebAssembly reac…

    …tor mode
    
    The entrypoint for a WebAssembly reactor module is _initialize instead of _start.
    
    Assuming that the WebAssembly runtime is not reentrant (e.g. not threaded), then
    this works if the //go:wasmexport calls are detected and wrapped in a function
    that starts the Go scheduler.
    
    When the exported function ends, all other goroutines are paused.
    
    Goroutines started in a global init() function will run while the host has called into
    the guest. They are paused when the guest call returns and restarted on the next call.
    
    TODO: figure out how to enable reactor mode:
    1. Should it be a flag to tinygo build?
    2. Should it be a build tag (e.g. -tags reactor)?
    3. Should the compiler detect the omission of main.main and automatically enable reactor mode?
    
    TODO: figure out where best to wrap //go:wasmexport calls.
    
    WIP
    ydnar committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    bd6a3f2 View commit details
    Browse the repository at this point in the history