Commit Graph

1845 Commits

Author SHA1 Message Date
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
Benbuck Nason
dbd8790681
Add WASM_V128 in wasm_valkind_enum (#3412)
Add WASM_V128 in wasm_valkind_enum and handle the the type accordingly
in wasm_c_api.c and wasm_runtime_common.c, and fix a typo in V128 union.
2024-05-14 10:22:42 +08:00
YAMAMOTO Takashi
456e2f6919
aot compiler: Fix a type mismatch in compile_op_float_min_max (#3423)
Fixes https://github.com/bytecodealliance/wasm-micro-runtime/issues/3422
2024-05-14 10:06:48 +08:00
YAMAMOTO Takashi
8f098a5905
aot: Make precheck functions use short-call for xtensa (#3418)
Note: this breaks AOT ABI for xtensa again because of a revert of an ABI-breaking change.
2024-05-13 16:55:00 +08:00
TianlongLiang
c6d42db598
Correct Exception Handling tag type when GC is enabled (#3413)
Use `WASMFuncType` to represent tag_type in `WASMTagImport` and
`WASMTag` so that the type definition is consistent no matter to GC is
enabled or not.

This PR fixes https://github.com/bytecodealliance/wasm-micro-runtime/issues/3409.
2024-05-13 16:42:01 +08:00
Hendra Darwintha
22eef3d88d
Fix basic example, parameter missmatch between host and wasm (#3415)
Revert the mistaken change by PR #3209.
2024-05-13 12:37:28 +08:00
Benbuck Nason
b349d844f8
Fix workspaces path in build_wamr.sh (#3414)
This should match the path inside of .devcontainer/Dockerfile.
2024-05-13 11:47:28 +08:00
Marcin Kolny
fe5e7a9981
Implement Memory64 support for AOT (#3362)
Refer to:
https://github.com/bytecodealliance/wasm-micro-runtime/pull/3266
https://github.com/bytecodealliance/wasm-micro-runtime/issues/3091
2024-05-13 11:03:38 +08:00
Benbuck Nason
c85bada2a9
Add wasm module global type information APIs (#3406)
Support getting global type from `wasm_runtime_get_import_type` and
`wasm_runtime_get_export_type`, and add two APIs:

```C
wasm_valkind_t
wasm_global_type_get_valkind(const wasm_global_type_t global_type);

bool
wasm_global_type_get_mutable(const wasm_global_type_t global_type);
```
2024-05-10 09:15:58 +08:00
YAMAMOTO Takashi
46f83cf486
core/iwasm/compilation: Remove stale function prototypes (#3408) 2024-05-09 16:55:32 +08:00
Wenyong Huang
a6c0cb74c9
wasm loader: Fix handling if block without op else (#3404)
If there is no else branch, make a virtual else opcode for easier integrity
check and to copy the correct results to the block return address for
fast-interp mode: change if block from `if ... end` to `if ... else end`.

Reported in issue #3386, #3387, #3388.
2024-05-09 16:46:26 +08:00
TianlongLiang
ea13d47a41
ref-types: Correct default value for function local variables (#3397)
In classic interpreter, fast interpreter and fast-jit running modes, set the local
variables' default value to NULL_REF (0xFFFFFFFF) rather than 0 if they are type
of externref or funcref.

The issue was reported in #3390 and #3391.
2024-05-09 16:31:21 +08:00
Zhang, Yi
f729da7656
Add test cases for the requirements of "gc-aot" feature (#3399) 2024-05-09 16:15:44 +08:00
liang.he
480ee02615
append_aot_to_wasm.py: Add --ver-str option to emit more info in custom section name (#3398)
``` shell
$ python3 append_aot_to_wasm.py --wasm waf.wasm --aot waf.aot -o waf.aot.wasm
$ /opt/wabt-1.0.34/bin/wasm-objdump -h waf.aot.wasm | grep wamr-aot
  Custom start=0x007520c7 end=0x00e021a0 (size=0x006b00d9) "wamr-aot"

$ python3 append_aot_to_wasm.py --wasm waf.wasm --aot waf.aot --ver-str 2.0.0 -o waf.aot.wasm
$ /opt/wabt-1.0.34/bin/wasm-objdump -h waf.aot.wasm | grep wamr-aot
  Custom start=0x007520c7 end=0x00e021a4 (size=0x006b00dd) "wamr-aot-2.0.0"
```
2024-05-08 18:06:54 +08:00
Benbuck Nason
432a940735
Fix clang compile warnings (#3396) 2024-05-08 16:43:47 +08:00
GanJingSaiyan
07eae7c424
Add aot binary analysis tool aot-analyzer (#3379)
Add aot binary analysis tool aot-analyzer, samples:

```bash
# parse example.aot, and print basic information about AoT file
$ ./aot-analyzer -i example.aot

# parse example.aot, and print the size of text section of the AoT file
$ ./aot-analyzer -t example.aot

# compare these two files, and show the difference in function size between them
$ ./aot-analyzer -c example.aot example.wasm
```

Signed-off-by: ganjing <ganjing@xiaomi.com>
2024-05-08 16:31:39 +08:00
Benbuck Nason
1c2a8fca4e
Fix some more spelling issues (#3393) 2024-05-08 09:30:29 +08:00
Benbuck Nason
ca61184ced
Fix some spelling issues (#3385)
Fix some of the spelling issues found by CSpell.
2024-05-06 07:56:48 +08:00
Benbuck Nason
c0e33f08b0
Expose API to get import/export function's param/result valkind (#3363)
Export API:
```C
   wasm_func_type_get_param_count
   wasm_func_type_get_param_valkind
   wasm_func_type_get_result_count
   wasm_func_type_get_result_valkind
```
And change wasm_import_type/wasm_export_type to wasm_import_t/wasm_export_t.
2024-05-03 09:41:08 +08:00