Commit Graph

1528 Commits

Author SHA1 Message Date
Cengizhan Pasaoglu
84ecf15322
Update libuv version to v1.46.0 (#2405) 2023-07-31 18:32:20 +08:00
Wenyong Huang
edea32b629
Fix result arity check on select_t opcode (#2406)
Typed select must have exactly one result. Reported in issue #2402.
2023-07-31 18:20:11 +08:00
Cengizhan Pasaoglu
45a4e774de
Upgrade cJSON version to v1.7.16 (#2404) 2023-07-31 18:14:50 +08:00
YAMAMOTO Takashi
b1fa27e91d
bh_atomic.h: Add BH_ATOMIC_32_FETCH_ADD/BH_ATOMIC_32_FETCH_SUB (#2408) 2023-07-31 17:56:15 +08:00
Marcin Kolny
151600fef2
Fix wasi-sockets tests (#2389)
Tests were failing because the right permissions were not provided to iwasm.
Also, test failures didn't trigger build failure due to typo - also fixed in this change.

In addition to that, this PR fixes a few issues with the test itself:
* the `server_init_complete` was not reset early enough causing the client to occasionally
  assume the server started even though it didn't yet
* set `SO_REUSEADDR` on the server socket so the port can be reused shortly after
  closing the previous socket
* defined receive-send-receive sequence from server to make sure server is alive at the
  time of sending message
2023-07-30 19:34:09 +08:00
YAMAMOTO Takashi
6d6cea1a73
Fix non-builtin BH_ATOMIC_32_FETCH_OR and BH_ATOMIC_32_FETCH_AND (#2400) 2023-07-30 19:23:30 +08:00
Huang Qi
10b18d85cd
Fix ExpandMemoryOpPass doesn't work properly (#2399)
The old method may not work for some cases. This PR iterates over all instructions
in the function, looking for memcpy, memmove and memset instructions, putting
them into a set, and finally expands them into a loop one by one.

And move this LLVM Pass after building the pipe line of pass builder to ensure that
the memcpy/memmove/memset instrinsics are generated before applying the pass.
2023-07-29 10:28:09 +08:00
YAMAMOTO Takashi
7db4815e83
bh_atomic.h: Add comments (#2398) 2023-07-28 20:36:35 +08:00
Wenyong Huang
59b2099b68
Fix some check issues on table operations (#2392)
Fix some check issues on table.init, table.fill and table.copy, and unify the check method
for all running modes.
Fix issue #2390 and #2096.
2023-07-27 21:53:48 +08:00
YAMAMOTO Takashi
228417ab8c
Move generic parts of wasm_suspend_flags.h to bh_atomic.h (#2393) 2023-07-27 21:37:23 +08:00
TianlongLiang
6110ea39fd
Add hadolint CI for Dockerfile linting (#2387) 2023-07-27 14:54:53 +08:00
dongheng
ada7e3fe88
ESP-IDF platform supports to load AOT to PSRAM and run it (#2385) 2023-07-27 10:17:21 +08:00
Marcin Kolny
5463ea4a20
Temporarily disable code that does not compile on windows (#2386)
And return ENOSYS. We do that so we can at least compile the code on CI.
We'll be gradually enabling more and more functions.

Also, enabled `proc_raise()` for windows.
2023-07-25 10:35:05 +08:00
Cengizhan Pasaoglu
1cafa37568
Update Docker image for latest version of external libraries & tools (#2374)
Devcontainer is too old to catch up the latest versions of dependencies. This PR updates
the libraries & tools that WASM environment requires for Docker image.

**Impediments:**
- LLVM 16 can not be retrieved directly by using shell command as provided before.
So we upgrade all tools manually as a workaround and just put LLVM issue URL as a
comment in the script. 

**Improvements:**
- Use `Debian 12 (Bookworm)` as a base image instead of `Ubuntu 20.04`.
- `GCC9` upgraded to `GCC12`.
- `LLVM14` upgraded to `LLVM16`.
- `Clang10` upgraded to `Clang10`.
- `Binaryen111` upgraded to `Binaryen114`.
- `WASI-19` upgraded to `WASI-20`
- `WABT-1.0.29` upgraded to `WABT-1.0.33`
- `Bazelisk-1.12.0` upgraded to `Bazelisk-1.17.0`
- `GithubCLI-2.20.2` upgraded to `GithubCLI-2.32.0`
- `NodeJS-19.x` upgraded to `NodeJS-20.x`
- `EMSDK-3.0.0` upgraded to `EMSDK-3.1.43`

**Notes:**
`Python 2.7` is removed due to no support anymore and not found in the repository.
2023-07-24 17:43:13 +08:00
Wenyong Huang
24c6c6977b
Fix llvm jit failed to lookup aot_stack_sizes symbol issue (#2384)
LVM JIT failed to lookup symbol "aot_stack_sizes" as it is an internal symbol,
change to lookup "aot_stack_sizes_alias" instead.

Reported in #2372.
2023-07-24 15:15:48 +08:00
Marcin Kolny
fe4ee37122
Add more fixes for wasi libc on windows (#2380)
* disable translations of errno codes that aren't defined on Windows
* undef `min()` macro if it is defined to not conflict with the `min()` function we define
* implement `shed_yield` wasi call
* disable some of the features in the config for windows by default
2023-07-24 15:14:52 +08:00
Marcin Kolny
a9d008f942
Use _fullpath function on windows to get absolute path of a directory (#2377)
There is no standard `realpath` function in the C/C++ standard libraries for Windows,
use `_fullpath` function instead to get absolute path of a directory.
2023-07-22 08:46:10 +08:00
Marcin Kolny
0f4edf9735
Implement suspend flags as atomic variable (#2361)
We have observed a significant performance degradation after merging
https://github.com/bytecodealliance/wasm-micro-runtime/pull/1991
Instead of protecting suspend flags with a mutex, we implement the flags
as atomic variable and only use mutex when atomics are not available
on a given platform.
2023-07-21 08:27:09 +08:00
dongsheng28849455
fbe072c0d3
Bring up WAMR on esp32-s3 device (#2348)
esp32-s3's instruction memory and data memory can be accessed through mutual mirroring way,
so we define a new feature named as WASM_MEM_DUAL_BUS_MIRROR.
2023-07-21 07:54:13 +08:00
Cengizhan Pasaoglu
57abdfdb5c
Fix typo (dwarf) in the codebase (#2367)
In the codebase, the struct and functions were written without "f" for dwarf.
2023-07-19 17:58:52 +08:00
Xu Jun
fbcf8c2c60
Fix some static scan issues (#2362) 2023-07-18 16:06:21 +08:00
Marcin Kolny
662e38e9b0
[Partial] Build wasi-libc for Windows (#2338)
Build wasi-libc library on Windows since libuv may be not supported. This PR is a first step
to make it working, but there's still a number of changes to get it fully working.
2023-07-13 21:02:29 +08:00
Bananymous
81f0371f63
Fix typo in zephyr's Dockerfile.old (#2354)
Dockerfile had command 'pip install --no-cache-doir' which caused
the image build to fail. Fix this to correctly say '--no-cache-dir'.
2023-07-11 14:41:12 +08:00
YAMAMOTO Takashi
7448a994ed
iwasm: Disable app heap by default if wasi is enabled (#2346)
It's rare to require app heap with wasi and sometimes harmful in some cases:
https://github.com/bytecodealliance/wasm-micro-runtime/issues/2275
2023-07-07 16:09:15 +08:00
YAMAMOTO Takashi
a300b627d5
nuttx: Add a kconfig for wasi-threads (#2343)
nuttx apps counterpart: https://github.com/apache/nuttx-apps/pull/1823
2023-07-07 15:12:00 +08:00
Huang Qi
aafea39b8c
Add "--enable-builtin-intrinsics=<flags>" option to wamrc (#2341)
Refer to doc/xip.md for details.
2023-07-06 18:20:35 +08:00
YAMAMOTO Takashi
228a3bed53
Fix unused warnings on disable_bounds_checks (#2347) 2023-07-06 15:31:22 +08:00
Huang Qi
6a310cc88a
Add "--native-lib=<lib>" option to wamrc (#2342) 2023-07-06 12:25:28 +08:00
TianlongLiang
e495276646
Add docker file to fix Zephy ESP32 linking issue (#2314)
- Provide a Dockerfile.old to fix issue of ESP32 custom linker scripts not working
  properly with the newer version of Zephyr, as reported in #2263
- Provide a Dockerfile with newer Zephyr for other boards
- Update the corresponding document
2023-07-06 10:11:39 +08:00
Xu Jun
25a1985413
Add scripts to validate lldb source debugger (#2150) 2023-07-05 15:58:57 +08:00
YAMAMOTO Takashi
3bbf59ad45
wamrc: Warn on text relocations for XIP (#2340) 2023-07-05 10:49:45 +08:00
Marcin Kolny
a9b76228b0
Allow defining hints without exact socket type or address family (#2337) 2023-07-04 21:21:21 +08:00
Huang Qi
ae4069df41
Migrate ExpandMemoryOpPass to llvm new pass manager (#2334)
Fix #2328
2023-07-04 17:17:15 +08:00
YAMAMOTO Takashi
1f89e446d9
Avoid switch lowering to lookup tables for XIP (#2339)
Because it involves relocations for the table. (.Lswitch.table.XXX)

Discussions: https://github.com/bytecodealliance/wasm-micro-runtime/issues/2316
2023-07-04 16:48:32 +08:00
Huang Qi
18092f86cc
Make memory access boundary check behavior configurable (#2289)
Allow to use `cmake -DWAMR_CONFIGURABLE_BOUNDS_CHECKS=1` to
build iwasm, and then run `iwasm --disable-bounds-checks` to disable the
memory access boundary checks.

And add two APIs:
`wasm_runtime_set_bounds_checks` and `wasm_runtime_is_bounds_checks_enabled`
2023-07-04 16:21:30 +08:00
Huang Qi
44f4b4f062
Add "--enable-llvm-passes=<passes>" option to wamrc (#2335)
Add "--enable-llvm-passes=<passes>" option to wamrc for customizing LLVM passes
2023-07-04 12:20:52 +08:00
Huang Qi
df98d9fb4a
Add "--xip" option for wamrc (#2336)
Add shorthand "--xip" option for wamrc, which is equal to
"--enalbe-indirect-mode --disable-llvm-intrinsics"
2023-07-04 12:03:40 +08:00
Marcin Kolny
6ed4c9c908
Increase default native stack size (#2332)
Calling `__wasi_sock_addr_resolve` syscall causes native stack overflow.
Given this is a standard function available in WAMR, we should have at least
the default stack size large enough to handle this case.

The socket tests were updated so they also run in separate thread, but
the simple retro program is:

```C
void *th(void *p)
{
    struct addrinfo *res;
    getaddrinfo("amazon.com", NULL, NULL, &res);
    return NULL;
}

int main(int argc, char **argv)
{
    pthread_t pt;
    pthread_create(&pt, NULL, th, NULL);
    pthread_join(pt, NULL);
    return 0;
}
```
2023-07-03 21:02:10 +08:00
Marcin Kolny
569f702ec2
Fix sanitizer errors in posix socket (#2331) 2023-07-03 14:36:01 +08:00
YAMAMOTO Takashi
c39eb46b6f
Add a few more assertions on structures to which aot abi is sensitive (#2326) 2023-06-30 10:22:46 +08:00
YAMAMOTO Takashi
03418ef5ac
aot: Avoid possible relocations around "stack_sizes" for XIP mode (#2322)
Fixes https://github.com/bytecodealliance/wasm-micro-runtime/issues/2316

Lightly tested on riscv64 qemu.
2023-06-29 18:45:33 +08:00
YAMAMOTO Takashi
5c13bbbde7
product-mini/platforms/linux: Mark vmlib POSITION_INDEPENDENT_CODE (#2323)
This fixes armhf build:
https://github.com/bytecodealliance/wasm-micro-runtime/issues/2315

Note: This is not the only place which seems to have the same problem.
For example, many of examples sharing the similar structure probably
have the same problem. This commit leaves them for now.
2023-06-29 14:57:27 +08:00
tonibofarull
ab96e01f5e
wasi-nn: Add support of wasi-nn as shared lib (#2310)
## Context

Currently, WAMR supports compiling iwasm with flag `WAMR_BUILD_WASI_NN`.
However, there are scenarios where the user might prefer having it as a shared library.

## Proposed Changes

Decouple wasi-nn context management by internally managing the context given
a module instance reference.
2023-06-27 18:18:26 +08:00
YAMAMOTO Takashi
0a0739ef23
aot: Implement a few more relocation types for riscv (#2318)
This PR partly fixes #2312. Lightly tested on qemu riscv64.
2023-06-27 16:33:05 +08:00
YAMAMOTO Takashi
5831531449
aot: Move stack_sizes table to a dedicated section (#2317)
To solve the "AOT module load failed: resolve symbol stack_sizes failed" issue.

This PR partly fixes #2312 and was lightly tested on qemu armhf.
2023-06-27 16:18:14 +08:00
Wenyong Huang
ea78b89965
Fix wamrc build issues with LLVM 13 and LLVM 16 (#2313)
Fix some build errors when building wamrc with LLVM-13, reported in #2311
Fix some build warnings when building wamrc with LLVM-16:
```
  core/iwasm/compilation/aot_llvm_extra2.cpp:26:26: warning:
  ‘llvm::None’ is deprecated: Use std::nullopt instead. [-Wdeprecated-declarations]
     26 |             return llvm::None;
```
Fix a maybe-uninitialized compile warning:
```
  core/iwasm/compilation/aot_llvm.c:413:9: warning:
  ‘update_top_block’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    413 |         LLVMPositionBuilderAtEnd(b, update_top_block);
```
2023-06-27 08:59:49 +08:00
tonibofarull
f5c5a83331
wasi-nn: Improve tests paths for local dev (#2309)
## Context

Path to models use `/assets` for testing inside docker. While testing directly from
the repo we are forced to use soft-links or modify the paths.

## Proposed Changes

Use relative path and adjust docker volumes in docs.
2023-06-27 08:07:30 +08:00
tonibofarull
ac9e789951
wasi-nn: Simplify cmake and headers' location (#2308)
Major changes:
- Public headers inside `wasi-nn/include`
- Put cmake files in `cmake` folder
- Make linux iwasm link with `${WASI_NN_LIBS}` so iwasm can enable wasi-nn
2023-06-26 09:29:05 +08:00
Blaine Bublitz
f51d98f850
Use system libuv if available (#1861)
This PR attempts to search for the system libuv and use it if found instead of
downloading it. As reported in #1831, this is needed because some tools
build in a sandbox and clear the extra sources.
2023-06-26 08:37:10 +08:00
Zzzabiyaka
10c96b19d0
Add retries to flaky step in nightly run CI (#2306)
Adds more automated way for errors like this:
https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/5328561662

Proposed dependency : https://github.com/nick-fields/retry

Co-authored-by: Maksim Litskevich <makslit@amazon.co.uk>
2023-06-24 09:15:34 +08:00