-
Notifications
You must be signed in to change notification settings - Fork 202
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
Reactor support. #74
Reactor support. #74
Conversation
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.
Nice
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! |
@@ -3,6 +3,7 @@ extern void __wasm_call_ctors(void); | |||
extern int __original_main(void); | |||
extern void __prepare_for_exit(void); | |||
|
|||
__attribute__((export_name("_start"))) | |||
void _start(void) { |
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.
Remind my why this file is duplicated here and in basics/crt/crt1.c?
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.
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"]