Commit Graph

11 Commits

Author SHA1 Message Date
Wenyong Huang
38c67b3f48
thread-mgr: Fix spread "wasi proc exit" exception and atomic.wait issues (#1988)
Raising "wasi proc exit" exception, spreading it to other threads and then
clearing it in all threads may result in unexpected behavior: the sub thread
may end first, handle the "wasi proc exit" exception and clear exceptions
of other threads, including the main thread. And when main thread's
exception is cleared, it may continue to run and throw "unreachable"
exception. This also leads to some assertion failed.

Ignore exception spreading for "wasi proc exit" and don't clear exception
of other threads to resolve the issue.

And add suspend flag check after atomic wait since the atomic wait may
be notified by other thread when exception occurs.
2023-02-24 20:05:39 +08:00
Enrico Loparco
2eed50b303
Document how to use WASI threads in AOT mode (#1905)
Describe how to use WASI threads in AOT mode, following the discussion below:
  https://github.com/bytecodealliance/wasm-micro-runtime/pull/1867#discussion_r1070268062

Make aux stack boundary checks of wasi-threads always successful by setting
`exec_env->aux_stack_bottom` to UINT32_MAX and `exec_env->aux_stack_boundary` to 0
2023-01-27 18:32:33 +08:00
YAMAMOTO Takashi
42f8fed20e
Rename thread_spawn import (#1907)
Following the wit-defined ABI:
https://github.com/WebAssembly/wasi-threads/pull/26

cf. https://github.com/WebAssembly/wasi-libc/pull/387
2023-01-27 06:45:34 +08:00
Marcin Kolny
879563047f
Fix thread termination example (#1915)
The example wasn't fully implemented the intention - it didn't work as
expected when the trap/proc_exit was executed on the main thread,
because main thread never waited for all the threads to start.
2023-01-25 09:34:36 +08:00
Enrico Loparco
9cf55f953b
feat(wasi-threads): Change sample exception_propagation to thread_termination (#1869)
Trigger wasi_proc_exit in the sample
2023-01-23 10:36:58 +08:00
Marcin Kolny
903f5212f1
Increase stack size in the example app (#1880) 2023-01-11 09:40:32 +08:00
Marcin Kolny
0e2382a959
Disable aux stack allocations for threads spawned by wasi_thread_start (#1867)
This syscall doesn't need allocating stack or TLS and it's expected from the application
to do that instead. E.g. WASI-libc already does this for `pthread_create`.

Also fix some of the examples to allocate memory for stack and not use stack before
the stack pointer is set to a correct value.
2023-01-09 20:36:34 +08:00
Enrico Loparco
7d19b229eb
feat(wasi-threads): Add CI for WASI threads (#1819)
Update wasi-sdk from 12.0 to 16.0 in CI
Build wasi-libc and build wai-threads sample in CI
2022-12-22 18:02:23 +08:00
Enrico Loparco
8fc641377a
feat(wasi-threads): Add example of exception propagation (#1812) 2022-12-16 14:22:53 +08:00
Marcin Kolny
929d5942b9
Add implementation for wasi_thread_spawn() (#1786)
For now this implementation uses thread manager.

Not sure whether thread manager is needed in that case. In the future there'll be likely another syscall added (for pthread_exit) and for that we might need some kind of thread management - with that in mind, we keep thread manager for now and will refactor this later if needed.
2022-12-13 21:33:27 +08:00
Marcin Kolny
684ae6554d
Create a placeholder for WASI threads implementation (#1783)
This a simpler version of the PR: https://github.com/bytecodealliance/wasm-micro-runtime/pull/1638
2022-12-06 21:11:27 +08:00