Reactor support.#74
Conversation
1bd89e0 to
695a003
Compare
|
I've now rewritten this patch, which is much easier now that a bunch of other pieces of startup have been factored out. The patch is now very simple. See also the corresponding WASI PR: WebAssembly/WASI#256 |
|
This is now updated to use And while here, I noticed that wasi-libc was exporting a |
|
Rebased and ready for review! |
| extern void __prepare_for_exit(void); | ||
|
|
||
| __attribute__((export_name("_start"))) | ||
| void _start(void) { |
There was a problem hiding this comment.
Remind my why this file is duplicated here and in basics/crt/crt1.c?
There was a problem hiding this comment.
Good point; it's an artifact of the "reference sysroot" idea that isn't important anymore. I'll submit a separate PR to remove it.
|
The PR description seems out-of-date. I was kind of expecting to see some change to Makefile to build the new version of crt1? |
|
The Makefile is set up to compile all .c files in the crt directory into .o files in the sysroot, so just adding a new .c file here is sufficient. |
|
Title and PR description updated! |
This adds support for a new "Reactor" executable model.
The "Commands" and "Reactors" concepts are introduced here:
WebAssembly/WASI#13
A companion Clang patch, which just consists of using the new
crt1-reactor.o and Reactor-specific entry point name, is here:
https://reviews.llvm.org/D62922
Instead of an entrypoint named "_start", which calls "main", which
then scopes the lifetime of the program, Reactors have a
"_initialize" function. When "_initialize" exits, the intention is that the program should
persist and be available for calling.
At present, the main anticipated use for this is in environments like
Node, where WASI-using modules can be imported and don't necessarily
want the semantics of a "main" function.
[edit: update to reflect design changes, and drop "experimental"]