Add an API to set segue flags for wasm-c-api LLVM JIT mode:
```C
wasm_config_t *
wasm_config_set_segue_flags(wasm_config_t *config, uint32 segue_flags);
```
- Don't allocate the implicit/unused frame when calling the LLVM JIT function
- Don't set exec_env's thread handle and stack boundary in the recursive
calling from host, since they have been set in the first time calling
- Fix frame not freed in llvm_jit_call_func_bytecode
And refactor the original perf support
- use WAMR_BUILD_LINUX_PERF as the cmake compilation control
- use WASM_ENABLE_LINUX_PERF as the compiler macro
- use `wamrc --enable-linux-perf` to generate aot file which contains fp operations
- use `iwasm --enable-linux-perf` to create perf map for `perf record`
The host embedder may also want to terminate the wasm instance
for single-threading mode, and it should work by setting exception
to the wasm instance.
According to the specification:
```
When instantiating a module which is expected to run
with `wasi-threads`, the WASI host must first allocate shared memories to
satisfy the module's imports.
```
Currently, if a test from the spec is executed while having the `multi-module`
feature enabled, WAMR fails with `WASM module load failed: unknown import`.
That happens because spec tests use memory like this:
`(memory (export "memory") (import "foo" "bar") 1 1 shared)`
and WAMR tries to find a registered module named `foo`.
At the moment, there is no specific module name that can be used to identify
that the memory is imported because using WASI threads:
https://github.com/WebAssembly/wasi-threads/issues/33,
so this PR only avoids treating the submodule dependency not being found
as a failure.
It's possible to set both `atim` and `atim_now` in the `fstflags`
parameter. Same goes for `mtin` and `mtim_now`. However, it's
ambiguous which time should be set in these two cases. This commit
checks this and returns `EINVAL`.
A wasm module can be either a command or a reactor, so it can export
either `_start` or `_initialize`. Currently, if a command module is run,
`iwasm` still looks for `_initialize`, resulting in the warning:
`can not find an export 0 named _initialize in the module`.
Change to look for `_initialize` only if `_start` not found to resolve the issue.
This commit adds a check to `fd_advise`. If the fd is a directory,
return `ebadf`. This brings iwasm in line with Wasmtime's behavior.
WASI folks have stated that fd_advise should not work on directories
as this is a Linux-specific behavior:
https://github.com/bytecodealliance/wasmtime/issues/6505#issuecomment-1574122949
- Fix op_br_table arity type check when the dest block is loop block
- Fix op_drop issue when the stack is polymorphic and it is to drop
an ANY type value in the stack
* Empty names are spec-wise valid.
* As we ignore unknown custom sections anyway, it's safe to
accept empty names here.
* Currently, the problem is not exposed on our CI because
the wabt version used there is a bit old.
For shared memory, runtime should get the memories pointer from
module_inst first, then get memory instance from memories array,
and then get the fields of the memory instance.
Support new a wasm_config_t, set allocation and linux_perf_support
options to it, and then pass it to wasm_engine_new_with_config to
new an engine with private configuration.
The JSON evidence is allocated on the module instance heap, but no API
was given to dispose of this memory buffer. The sample mentions using
the function free, which behaves differently depending on the
execution context.
This fix provides a new function called librats_dispose_evidence_json,
enabling freeing the JSON evidence directly from the Wasm app.
Change WASMMemoryInstance's field is_shared_memory's type from bool
to uint8 whose size is fixed, so as to make WASMMemoryInstance's size
and layout fixed and not break AOT ABI.
See discussion in https://github.com/bytecodealliance/wasm-micro-runtime/pull/2682.
The popped reachable block may be if block whose else branch hasn't been
translated, and should push the params for the else block if there are.
And use LLVMDisposeMessage to free memory allocated in is_win_platform.