-
Notifications
You must be signed in to change notification settings - Fork 648
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
Enable aux stack allocations on application heap #1799
Enable aux stack allocations on application heap #1799
Conversation
4004fee
to
b2cb12b
Compare
@@ -527,9 +527,6 @@ pthread_start_routine(void *arg) | |||
/* destroy pthread key values */ | |||
call_key_destructor(exec_env); | |||
|
|||
/* routine exit, destroy instance */ | |||
wasm_runtime_deinstantiate_internal(module_inst, true); | |||
|
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.
how is this related to the rest of the PR?
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.
If WASM_ENABLE_HEAP_AUX_STACK_ALLOCATION
is enabled, module instance can't be deinstantiate untill the memory allocated for the aux stack is released.
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.
- with this change, where will it be deinstantiated instead?
- how about the other wasm_runtime_deinstantiate_internal call in this function? (L507)
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.
with this change, where will it be deinstantiated instead?
It's deinstantiated in the thread_manager_start_routine()
how about the other wasm_runtime_deinstantiate_internal call in this function? (L507)
Yes, this one, and one in the lib_wasi_threads_wrapper.c
have to be removed. Already updated the code, thanks.
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.
do you mean already updated locally but not pushed yet?
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.
Yes sorry, didn't push my change. Should be updated now.
The refactoring is necessary for further steps where we use module instance of the exec env environment to perform on-heap aux stack allocations.
This enables us to have fully application-managed aux stack. The change is needed for wasi threads where aux stack is managed by Libc.
b2cb12b
to
762b501
Compare
So it can be used in thread manager even if wasi threads aren't enabled.
762b501
to
c344759
Compare
This is necessary for WASI threads as the aux stack should be managed by the application. See bytecodealliance#1790 for details.
This is necessary for WASI threads as the aux stack should be managed by the application. See #1790 for details.