Commit Graph

18 Commits

Author SHA1 Message Date
Xu Jun
d75cb3224f
Fix dead lock in source debugger (#2040) 2023-03-20 08:17:22 +08:00
Enrico Loparco
63273a1673
Fix issues in the libc-wasi poll_oneoff when thread-mgr is enabled (#1980)
Fix issues in the libc-wasi `poll_oneoff` when thread manager is enabled:
-  The exception of a thread may be cleared when other thread runs into
   `proc_exit` and then calls `clear_wasi_proc_exit_exception`, so should not
   use `wasm_runtime_get_exception` to check whether an exception was
    thrown, use `wasm_cluster_is_thread_terminated` instead
- We divided one time poll_oneoff into many times poll_oneoff to check
   the exception to avoid long time waiting in previous PR, but if all events
   returned by one time poll are all waiting events, we need to continue to
   wait but not return directly.

Follow-up on #1951. Tested with multiple timeout values, with and without
interruption and measured the time spent sleeping.
2023-02-23 16:11:33 +08:00
Wenyong Huang
c7141894fb Merge branch main into dev/wasi_threads 2023-01-21 13:18:55 +08:00
Xu Jun
cadf9d0ad3
Main thread spread exception when thread-mgr is enabled (#1889)
And refactor clear_wasi_proc_exit_exception, refer to
https://github.com/bytecodealliance/wasm-micro-runtime/pull/1869
2023-01-20 08:54:27 +08:00
Xu Jun
e696ac36d7
Fix potential block issue in source debugger (#1887)
Fix issue reported in #1860
2023-01-17 08:45:29 +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
Marcin Kolny
0f637cff07
Enable aux stack allocations on application heap (#1799)
This is necessary for WASI threads as the aux stack should be managed by the application.
See https://github.com/bytecodealliance/wasm-micro-runtime/issues/1790 for details.
2022-12-19 10:58:12 +08:00
YAMAMOTO Takashi
d5d6b7284d
Fix a few redefinition warnings for WAMR_BUILD_DEBUG_INTERP=1 (#1256) 2022-06-29 12:23:58 +08:00
Wenyong Huang
c6997aa68a
Fix execute_main not wait for other threads (#1137)
Fix wasm_application_execute_main/wasm_application_execute_func not waiting for
other threads to terminate in multi-thread mode, which causes that the exception
thrown by other threads may haven't been spreaded to current main thread, and
cannot be detected by the caller, as reported in #1131.
2022-04-29 15:47:43 +08:00
Wenyong Huang
092efbfe21
Fix thread manager issues (#962)
Fix the issue that joining a detached thread might result in joining hang,
resolve the issue by adding wait_count for a thread's exec_env to indicate
whether a thread needs to detach itself or not when it exits.

And add checks for the input exec_env for cluster's join/detach/cancel thread.
2022-01-17 17:09:04 +08:00
Xu Jun
ee97e30a1a
Fix pointer unchecked issue in thread-mgr.c (#960)
And refine the code format of thread_manager.h
2022-01-14 17:57:59 +08:00
Xu Jun
2af5ae5abb
[source debug] refine some code in source debugging (#856)
- move the wait_cond from exec_env to debug_instance, so the debug thread can be waken up by any threads
- process more general query message from debugger
- refine debug instance create/destroy mechanism
- avoid creating debug instance during module instantiating
- avoid blocking execution thread during creating debug instance
- update related documents
2021-12-06 10:25:38 +08:00
Wenyong Huang
fb4afc7ca4
Apply clang-format for core/iwasm compilation and libraries (#784)
Apply clang-format for core/iwasm/compilation and core/iwasm/libraries files.
Add wasm-c-api empty_imports sample to workflow test.
And enable triggering workflow when core/config.h changes.
2021-10-13 15:13:00 +08:00
Wenyong Huang
9ef37dd781
Implement source debugging for interpreter and AOT (#769)
Implement source debugging feature for classic interpreter and AOT:
- use `cmake -DWAMR_BUILD_DEBUG_INTERP=1` to enable interpreter debugging
- use `cmake -DWAMR_BUILD_DEBUG_AOT=1` to enable AOT debugging

See doc/source_debugging.md for more details.
2021-09-29 13:36:46 +08:00
Xu Jun
f637438e4e
Spread module custom data to all threads, enable libc-builtin float print (#633) 2021-05-19 14:57:31 +08:00
Xu Jun
22bcfe204e
fix aux stack overwritten issue when lib-pthread is enabled (#596) 2021-04-01 15:07:00 +08:00
Xu Jun
2db335c6d4
add spawn thread API and sample (#333) 2020-08-04 17:40:45 +08:00
Xu Jun
d98ab63e5c
Enable shared memory && add pthread support (#282) 2020-06-15 19:04:04 +08:00