forked from bytecodealliance/wasm-micro-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Merge bytecodealliance:dev/gc_refactor into wenyongh:fix_gc_warnings #826
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
Merged
wenyongh
merged 59 commits into
wenyongh:fix_gc_warnings
from
bytecodealliance:dev/gc_refactor
Oct 8, 2023
Merged
Merge bytecodealliance:dev/gc_refactor into wenyongh:fix_gc_warnings #826
wenyongh
merged 59 commits into
wenyongh:fix_gc_warnings
from
bytecodealliance:dev/gc_refactor
Oct 8, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As a part of stress-testing we want to ensure that mutex implementation is working correctly and protecting shared resource to be allocated from other threads when mutex is locked. This test covers the most common situations that happen when some program uses mutexes like locks from various threads, locks from the same thread etc.
Use a separate global lock instead. Fixes: #2407
Add simple infrastructure to add more unit tests in the future. At the moment tests are only executed on Linux, but can be extended to other platforms if needed. Use https://github.com/google/googletest/ as a framework.
) While wasi proc exit is not a real trap, what the runtime does on it is mostly same as real traps. That is, kill the siblings threads and represent the exit/trap as the result of the "process" to the user api. There seems no reason to distinguish it from real traps here. Note that: - The target thread either doesn't care the specific exception type or ignore wasi proc exit by themselves. (clear_wasi_proc_exit_exception) - clear_wasi_proc_exit_exception only clears local exception.
When embedding WAMR, this PR allows to register a callback that is invoked when memory.grow fails. In case of memory allocation failures, some languages allow to handle the error (e.g. by checking the return code of malloc/calloc in C), some others (e.g. Rust) just panic.
The macro WASMTIME_SSP_STATIC_CURFDS isn't used in the source code, remove the related macro control code.
Introduce module instance context APIs which can set one or more contexts created
by the embedder for a wasm module instance:
```C
wasm_runtime_create_context_key
wasm_runtime_destroy_context_key
wasm_runtime_set_context
wasm_runtime_set_context_spread
wasm_runtime_get_context
```
And make libc-wasi use it and set wasi context as the first context bound to the wasm
module instance.
Also add samples.
Refer to #2460.
This fixes a few test cases in wasi-threads testsuite like wasi_threads_return_main_block. And also move the special handling for "wasi proc exit" to a more appropriate place.
Preserve errno because this function is often used like
the following. The caller wants to report the error from the main
operation (`lseek` in this example), not from fd_object_release.
```
off_t ret = lseek(fd_number(fo), offset, nwhence);
fd_object_release(fo);
if (ret < 0)
return convert_errno(errno);
```
Add API wasm_runtime_terminate to terminate a module instance by setting "terminated by user" exception to the module instance. And update the product-mini of posix platforms. Note: this doesn't work for some situations like blocking system calls.
Instead of showing the total case amount under *spec/test/core*, show the accurate number of how many test cases were executed.
Remove thread local attribute of prev_sig_act_SIGSEGV/SIGBUS to allow using custom signal handler from non-main thread since in a thread spawned by embedder, embedder may be unable to call wasm_runtime_init_thread_env to initialize them. And fix the handling of prev_sig_act when its sa_handler is SIG_DFL, SIG_IGN, or a user customized handler.
Send a signal whose handler is no-op to a blocking thread to wake up the blocking syscall with either EINTR equivalent or partial success. Unlike the approach taken in the `dev/interrupt_block_insn` branch (that is, signal + longjmp similarly to `OS_ENABLE_HW_BOUND_CHECK`), this PR does not use longjmp because: * longjmp from signal handler doesn't work on nuttx refer to apache/nuttx#10326 * the singal+longjmp approach may be too difficult for average programmers who might implement host functions to deal with See also #1910
struct dfs_fd has been deprecated
This improves test consistency between typical local environments and github runners. This is necessary for some of latest wasi-threads tests. cf. yamt/toywasm@570e670
The WASI docs allow for fewer rights to be applied to an fd than requested but not more. This behavior is also asserted in the rust WASI tests, so it's necessary for those to pass as well.
…2582) Apply "provide stdin by ourselves" to the aot case and check the correct exit code.
Return a WASI error code (rather than a host POSIX one). In addition, there is no need to return an error in the case that the provided buffer is too large.
Adapt API usage to new interfaces where applicable, including LLVM function usage, obsoleted llvm::Optional type and removal of unavailable headers. Know issues: - AOT static PGO isn't enabled - LLVM JIT may run failed due to llvm_orc_registerEHFrameSectionWrapper isn't linked into iwasm
Explicitly declare readdir_r in gpc_code_gen_util.c.
There doesn't appear to be a clear reason not to support this behavior. It seems it was disallowed previously as a precaution. See bytecodealliance/wasmtime@67e2e57 for more context.
`wasm_loader_push_pop_frame_offset` may pop n operands by using `loader_ctx->stack_cell_num` to check whether the operand can be popped or not. While `loader_ctx->stack_cell_num` is updated in the later `wasm_loader_push_pop_frame_ref`, the check may fail if the stack is in polymorphic state and lead to `ctx->frame_offset` underflow. Fix issue #2577 and #2586.
The CI might use clang-17 to build iwasm for Android platform and it may report compilation error: https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/6308980430/job/17128073777 /home/runner/work/wasm-micro-runtime/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/blocking_op.c:45:19: error: call to undeclared function 'preadv'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] ssize_t ret = preadv(fd, iov, iovcnt, offset); ^ Explicitly declare preadv and pwritev in android platform header file to resolve it.
Suppress a sanitizer integer overflow error in signed integer add operation in Fast JIT.
Support muti-module for AOT mode, currently only implement the multi-module's function import feature for AOT, the memory/table/ global import are not implemented yet. And update wamr-test-suites scripts, multi-module sample and some CIs accordingly.
According to the specification, - fNxM_pmin/max returns v1 or v2 based on flt(v1,v2) result - fNxM_min/max returns +/-NaN, +/-Inf, v1 or v2 based on more than flt(v1,v2) result Fixes issue #2561.
Avoid the stack traces getting mixed up together when multi-threading is enabled by using exception_lock/unlock in dumping the call stacks. And remove duplicated call stack dump in wasm_application.c. Also update coding guideline CI to fix the clang-format-12 not found issue.
When destroying wasi-nn context, module instance should be also removed from hashmap to avoid memory leak.
Fixed a bug in the processing of the br_table_cache opcode that caused out-of-range references when the label index was greater than the length of the label.
To make it clearer to users when synchronization behaviour is not supported, return ENOTSUP when O_RSYNC, O_DSYNC or O_SYNC are respectively not defined. Linux also doesn't support O_RSYNC despite the O_RSYNC flag being defined.
This PR adds the Cosmopolitan Libc platform enabling compatibility with multiple x86_64 operating systems with the same binary. The platform is similar to the Linux platform, but for now only x86_64 with interpreter modes are supported. The only major change to the core is `posix.c/convert_errno()` was rewritten to use a switch statement. With Cosmopolitan errno values depend on the currently running operating system, and so they are non-constant and cannot be used in array designators. However, the `cosmocc` compiler allows non-constant case labels in switch statements, enabling the new version. And updated wamr-test-suites script to add `-j <platform>` option. The spec tests can be ran via `CC=cosmocc ./test_wamr.sh -j cosmopolitan -t classic-interp` or `CC=cosmocc ./test_wamr.sh -j cosmopolitan -t fast-interp`.
And refine some code pieces.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.