Commit Graph

2063 Commits

Author SHA1 Message Date
Berthelot Mewen
dc21c62431
Add missing functions to make RIOT work with the 2.x.x version (#3508)
The `os_mremap` and `os_getpagesize` were missing in the `core/shared/platform/riot`
and were preventing RIOT from compiling if using WAMR v2.x.x. This PR is adding
both functions and should allow RIOT to update WAMR version to v2.x.x.

Signed-off-by:: mewen.berthelot <mewen.berthelot@orange.com>
2024-06-07 09:40:35 +08:00
Wenyong Huang
8f86b37616
Update release notes (#3506) 2024-06-06 10:26:50 +08:00
dependabot[bot]
53f26e436b
Bump requests from 2.32.2 to 2.32.3 in /build-scripts (#3494)
Bumps [requests](https://github.com/psf/requests) from 2.32.2 to 2.32.3.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.32.2...v2.32.3)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-06 10:09:19 +08:00
Benbuck Nason
5d1f19fc09
Fix wasm_mini_loader.c build when jit or multi-module is enabled (#3502)
This PR fixes compilation error when building with
`-DWAMR_BUILD_MINI_LOADER=1 -DWAMR_BUILD_JIT=1` or
`-DWAMR_BUILD_MINI_LOADER=1 -DWAMR_BUILD_MULTI_MODULE=1`,
though normally we don't use wasm mini loader when JIT or multi-module
is enabled.
2024-06-06 09:53:22 +08:00
Benbuck Nason
421a6c4301
Fix posix build when libc wasi is disabled and debug interp is enabled (#3503)
This change supports building with `-DWAMR_BUILD_LIBC_WASI=0` and
`-DWAMR_BUILD_DEBUG_INTERP=1`, otherwise the os_socket_* functions
will be undefined.
2024-06-06 09:37:28 +08:00
Benbuck Nason
8239dd4aa7
Add wasm_export.h APIs to expose memory type (#3496)
Support to get `wasm_memory_type_t memory_type` from API
`wasm_runtime_get_import_type` and `wasm_runtime_get_export_type`,
and then get shared flag, initial page cout, maximum page count
from the memory_type:
```C
bool
wasm_memory_type_get_shared(const wasm_memory_type_t memory_type);
uint32_t
wasm_memory_type_get_init_page_count(const wasm_memory_type_t memory_type);
uint32_t
wasm_memory_type_get_max_page_count(const wasm_memory_type_t memory_type);
```
2024-06-06 09:20:24 +08:00
Marcin Kolny
3fbb7fca25
Update version to 2.1.0 and update release notes (#3481)
There was quite a few enhancements since 2.0.0 release and it'd be good to
have another release now.
2024-06-04 16:27:06 +08:00
Wenyong Huang
0712c7f361
Fix CI build and run unit tests (#3499) 2024-06-04 14:47:42 +08:00
Benbuck Nason
56b42908a8
Fix internal global getter types (#3495) 2024-06-04 11:29:31 +08:00
Zhang, Yi
380cd7b0e7
Add unit test suites (#3490) 2024-06-04 11:24:27 +08:00
Wenyong Huang
0a80cc4e94
Fix wasm loader check data segment count (#3492)
When datacount section exists, loader will check whether the data count
read from data segment section is same with the data count read from
datacount section, but the value of latter can be 0, loader should not
skip the check when the latter is 0. This fixes #3491.

And fix handle_name_section return value not checked issue and early
return true issue after handle_name_section.

And also add the failed case in #3491 to ba-issues.
2024-06-03 19:48:11 +08:00
Wenyong Huang
082cfa1c4f
Correct nuttx repo names (#3484)
The nuttx repo had changed from https://github.com/apache/incubator-nuttx
to https://github.com/apache/nuttx.
2024-05-31 15:39:23 +08:00
TianlongLiang
ab4e17b701
Modify logging for windows exception handler and remove unused function (#3489)
ps.
https://github.com/bytecodealliance/wasm-micro-runtime/issues/3416
https://github.com/bytecodealliance/wasm-micro-runtime/issues/3400
2024-05-31 13:07:56 +08:00
Wenyong Huang
f635ab9655
Enable building static library on Android platform (#3488)
ps. https://github.com/bytecodealliance/wasm-micro-runtime/issues/3486
2024-05-31 12:11:11 +08:00
Wenyong Huang
23e1d51587
Fix loader parse block type and calculate dynamic offset for loop args (#3482)
Fix several issues in wasm loader:
- Parse a block's type index with leb int32 instead leb uint32
- Correct dst dynamic offset of loop block arguments for opcode br
  when copying the stack operands to the arguments of loop block
- Free each frame_csp's param_frame_offsets when destroy loader ctx
- Fix compilation error in wasm_mini_loader.c
- Add test cases of failed issues

This PR fixes issue #3467 and #3468.
2024-05-31 11:32:36 +08:00
liang.he
67638e24f4
wasm-mutator-fuzz: Generate more kinds of corpus (#3487) 2024-05-31 11:16:14 +08:00
Wenyong Huang
5623e4d22a
Fix memory64 handling find_block_addr and execute_main (#3480) 2024-05-30 16:14:12 +08:00
YAMAMOTO Takashi
1f8a78d61a
posix iwasm: Make the timeout logic a bit more robust (#3478)
Use an absolute timeout calculation to avoid being affected much
by CPU scheduling.
2024-05-30 15:55:24 +08:00
dependabot[bot]
115a4767df
Bump requests from 2.31.0 to 2.32.2 in /build-scripts (#3474)
Bumps [requests](https://github.com/psf/requests) from 2.31.0 to 2.32.2.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.31.0...v2.32.2)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-30 15:42:37 +08:00
liang.he
d29802c451
Fix two issues to make fuzzing test quit earlier (#3471)
- Add a marco to limit the maxi allocable memory size of fuzz test to
  2GB to avoid libFuzzer out-of-memory
- Check global type in load_global_import and load_global_section
2024-05-30 14:55:21 +08:00
Wenyong Huang
a2a8b32456
Fix test-wamr-ide CI failure (#3485)
Set `moduleResolution` as `node16` in tsconfig.json.

ps.
https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/9296272681/job/25586420457
```
node_modules/@vscode/test-electron/out/util.d.ts(1,23): error TS1452:
'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`.
```
2024-05-30 14:08:18 +08:00
YAMAMOTO Takashi
6067dbb3ab
NuttX: Fix a dbus-related crash on esp32s3 (#3470)
Although I don't know what exactly the esp32s3 rom version of memset is,
it seems that the current code crashes only with a small "len". I guess
it changes the logic depending on the size.
Anyway, it's safer to use dbus here.
2024-05-27 11:07:30 +08:00
liang.he
a9eff69dd9
wasm-mutator-fuzz: Adapt to oss-fuzz compilation (#3464) 2024-05-27 10:33:36 +08:00
Enrico Loparco
3b8ef89110
Clone data segments when specified with load args (#3463)
Follow-up on https://github.com/bytecodealliance/wasm-micro-runtime/pull/3389, specifically: https://github.com/bytecodealliance/wasm-micro-runtime/pull/3389#discussion_r1600872451

If we want to free the wasm binary buffer early, we need to clone the data segments into the module.
That's because, in case of [passive data segments](https://webassembly.github.io/threads/core/syntax/modules.html#syntax-data),
they can be referred during wasm execution.
2024-05-27 09:59:24 +08:00
Zhang, Yi
f378edc408
Add regression tests of BA issue cases (#3462) 2024-05-23 13:53:53 +08:00
Wenyong Huang
6fdfedb08a
Fix codeql compilation error (#3461)
Update OS to ubuntu-22.04 and install `libgcc-12-dev lib32gcc-12-dev` instead
of `libgcc-11-dev lib32gcc-11-dev`.

And fix a bh_assert condition typo error.

ps.
https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/9183310069/job/25253782329
2024-05-22 17:27:38 +08:00
Wenyong Huang
f143344842
libc-builtin: Enhance buffered print for printf_wrapper (#3460)
Move print_buf and print_buf to str_context struct to support multi-threading
when BUILTIN_LIBC_BUFFERED_PRINTF macro is enabled, and fix the issue of
losing some text.

ps. https://github.com/bytecodealliance/wasm-micro-runtime/issues/3430.
2024-05-22 17:17:36 +08:00
Benbuck Nason
c5ab862dbb
Add api to get export global instance (#3452)
Add API
```C
bool
wasm_runtime_get_export_global_inst(const wasm_module_inst_t module_inst,
                                    const char *name,
                                    wasm_global_inst_t *global_inst);
```
2024-05-22 16:59:44 +08:00
Zhang, Yi
591a20b917
Add malformed test cases (#3459) 2024-05-21 16:38:34 +08:00
Wenyong Huang
15d191943a
Enhance GC const initializer expression to support nested struct/array new (#3447)
Only support interpreter now, and fix some issues found in wasm loader.

This PR fixes issue #3410 and #3411.
2024-05-21 16:09:12 +08:00
YAMAMOTO Takashi
403f472ff1
wasi: Tweak the configuration for nuttx and explain why (#3451) 2024-05-21 14:42:30 +08:00
YAMAMOTO Takashi
5bc38f77f6
NuttX: Rename a few recently-added nuttx options (#3449)
from:
ARCH_TEXT_HEAP_SEPARATE_DATA_ADDRESS
ARCH_TEXT_HEAP_WORD_ALIGNED_READ

to:
ARCH_HAVE_TEXT_HEAP_SEPARATE_DATA_ADDRESS
ARCH_HAVE_TEXT_HEAP_WORD_ALIGNED_READ
2024-05-21 14:31:14 +08:00
liang.he
a4f0a0d0ea
wamr-test-suites: Enable AOT multi-module spec tests (#3450)
Bypass some cases because:
- aot multi-module doesn't support empty modules
- aot multi-module doesn't support import globals
2024-05-21 12:10:47 +08:00
Zhang, Yi
a2f3c7298f
Add wasm-mutator-fuzz test (#3420) 2024-05-21 12:01:13 +08:00
Byeongjee Kang
33aada2133
Remove install_wasi_sdk from workload preparation script (#3445)
This function was removed in 7be0d38 while building a customized wasi-sdk.
2024-05-20 16:18:34 +08:00
TianlongLiang
30ed97cddc
Fix several typos and fix bh_log calculate mills (#3441) 2024-05-20 15:54:01 +08:00
Benbuck Nason
0ceffe74a7
Add cmake static/shared library build settings (#3443)
Allow builds to target either static library only, shared library only, or both (default).
2024-05-18 21:15:11 +08:00
YAMAMOTO Takashi
ec44f494cc
NuttX: Replace esp32s3 bits with the OS-provided APIs (#3439)
Expected merge order:
https://github.com/apache/nuttx/pull/12355
https://github.com/apache/nuttx-apps/pull/2395
https://github.com/bytecodealliance/wasm-micro-runtime/pull/3439
2024-05-18 20:35:16 +08:00
Benbuck Nason
7744e84607
ssp_config.h: Fix ifdef for android random api (#3444)
It looks like the preferred preprocessor check for Android is `__ANDROID__`
instead of `ANDROID`:
https://groups.google.com/g/android-ndk/c/cf9_f1SLXls

Change `(defined(ANDROID) && __ANDROID_API__ < 28)` to
`((defined(ANDROID) || defined(__ANDROID__)) && (__ANDROID_API__ < 28))`.
2024-05-18 20:23:34 +08:00
liang.he
b2eb7d838d
Update spec test to latest commit (#3293)
- Update spec test cases to commit bc76fd79cfe61033d7f4ad4a7e8fc4f996dc5ba8 on Apr. 3
- Update wabt binary to 1.0.34 to support newer spec cases
- Add comparison between table declared elem type and table elem segment value type
- Add a function to decide whether to execute test cases in a running mode
- Keep using interpreter in GC spec because wat2wasm in wabt can't compile if.wast w/o errors
- Re-factoring threads spec test case processing
- Since wabt 1.0.34 release isn't compatible with ubuntu 20.04, compile it from source code
- Disable CI to run aot multi-module temporarily, and will enable it in another PR
2024-05-17 10:40:47 +08:00
Enrico Loparco
6b1d81650d
Allow not copying the wasm binary in wasm-c-api and not referring to the binary in wasm/aot loader (#3389)
Add flag `LoadArgs.clone_wasm_binary` to control whether to clone the wasm/aot
binary in wasm-c-api module. If false, API `wasm_module_new_ex` won't clone the
binary, which may reduce the footprint.

Add flag `LoadArgs.wasm_binary_freeable` to control whether the wasm/aot binary
may be freed after instantiation for wamr API `wasm_runtime_load_ex`, if yes, then
for some running modes, the wasm/aot module doesn't refer to the input binary
again so developer can free it after instantiation to reduce the footprint.

And add API `wasm_module_is_underlying_binary_freeable` and
`wasm_runtime_is_underlying_binary_freeable` to check whether the input binary
can be freed after instantiation for wasm-c-api and wamr api.

And add sample to illustrate it.
2024-05-17 09:00:08 +08:00
YAMAMOTO Takashi
51ecfd6673
libc-wasi: Fix a locking botch (#3437) 2024-05-15 15:41:40 +08:00
Wenyong Huang
7949df96f4
Fix fast interp RECOVER_BR_INFO and local set/tee (#3434)
When copying two cells from src offsets to dst offsets in RECOVER_BR_INFO,
the offsets may be overlapped and the src data may be overwritten, use
GET_I64_FROM_ADDR and then SET_I64_FROM_ADDR instead to resolve it.

And handling VALUE_TYPE_FUNCREF/VALUE_TYPE_EXTERNREF for opcode
local.set and local.tee when reference types feature is enabled.

This PR fixes issue #3401 and #3402.
2024-05-15 15:20:21 +08:00
Wenyong Huang
49c9fa31da
Fix typo of WAMR_CONFIGUABLE_BOUNDS_CHECKS (#3424)
Change to WAMR_CONFIGURABLE_BOUNDS_CHECKS, and fix CodeQL compilation errors
which were introduced by PR #3406.

ps.
https://github.com/bytecodealliance/wasm-micro-runtime/pull/3393#discussion_r1591810998
https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/9055318553/job/24876266629
2024-05-14 14:33:09 +08:00
liang.he
df82ae8774
ci/coding_guidelines_check.py: Allow some well-known file names to contain '-' (#3428)
And shorten pathlib.Path to Path.
2024-05-14 12:35:18 +08:00
YAMAMOTO Takashi
267eaa1747
product-mini/platforms/posix/main.c: Adapt to WASM_MEM_DUAL_BUS_MIRROR (#3427) 2024-05-14 12:16:19 +08:00
Benbuck Nason
0f17a1464e
Add comments to global type function declarations (#3431) 2024-05-14 11:38:18 +08:00
YAMAMOTO Takashi
b1529bc803
nuttx/esp32s3: Apply ibus/dbus adjustment to internal ram 1 as well (#3421) 2024-05-14 11:28:24 +08:00
Wenyong Huang
773efc006d
Change WASM_ANYREF to WASM_EXTERNREF (#3426)
wasm-c-api wasm.h had changed WASM_ANYREF to WASM_EXTERNREF,
we had better change it in WAMR also:
2ce1367c9d/include/wasm.h (L185)
2024-05-14 11:08:16 +08:00
Wenyong Huang
004d07bb86
Remove unused macros which were moved to wamr-app-framework (#3425)
Some macros are not related to WAMR and have been moved to wamr-app-framework,
we remove them in WAMR.

ps.
https://github.com/bytecodealliance/wasm-micro-runtime/pull/3393#discussion_r1591812319
https://github.com/bytecodealliance/wamr-app-framework/pull/9
2024-05-14 10:52:05 +08:00