-
Notifications
You must be signed in to change notification settings - Fork 646
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
Prefer to get & set exception from exec_env_tls #4007
base: main
Are you sure you want to change the base?
Prefer to get & set exception from exec_env_tls #4007
Conversation
@@ -166,6 +168,9 @@ typedef struct WASMExecEnv { | |||
/* The WASM stack. */ | |||
uint8 bottom[1]; | |||
} wasm_stack_u; | |||
|
|||
/* The exception buffer for current execution environment. */ | |||
char cur_exception[EXCEPTION_BUF_LEN]; |
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.
Not sure if we can safely add anything below wasm_stack_u.bottom
as this is the region used for the WASM stack frames.
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.
I see, I can move it to anywhere in WASMExecEnv
struct. Is after module_inst
OK?
I'm not entirely clear on the concept of "parallel" here. Does it mean using a single instance across multiple threads? |
Yes, it means use a single instance across multiple threads at the same time without locking. |
currently it isn't possible.
i don't see what's the point of the change. it just makes it more inconsistent, doesn't it? |
Indeed, it is a very unusual scenario and somewhat conflicts with some fundamental principles of WebAssembly, possibly the weak wasm thread model or the threads proposal or others, I can't quite remember which. |
Exceptions are currently stored in module instance, but if most of them can be stored at the exec_env that would allow using a single module instance in parallel without locking and handle the exception separately.
Using a single module instance in parallel might not be usual, but it's possible from what I understand and tested WAMR, at least for specific use cases (e.g. no writing to globals or wasm memory, only reading from that and writing to wasm stack). Please correct me if I'm missing anything.
This PR proposes a change in how we store and retrieve exception from a given module instance: