Skip to content
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

Merge branch main into dev/checkpoint_and_restore #3511

Merged
merged 23 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a2a8b32
Fix test-wamr-ide CI failure (#3485)
wenyongh May 30, 2024
d29802c
Fix two issues to make fuzzing test quit earlier (#3471)
lum1n0us May 30, 2024
115a476
Bump requests from 2.31.0 to 2.32.2 in /build-scripts (#3474)
dependabot[bot] May 30, 2024
1f8a78d
posix iwasm: Make the timeout logic a bit more robust (#3478)
yamt May 30, 2024
5623e4d
Fix memory64 handling find_block_addr and execute_main (#3480)
wenyongh May 30, 2024
67638e2
wasm-mutator-fuzz: Generate more kinds of corpus (#3487)
lum1n0us May 31, 2024
23e1d51
Fix loader parse block type and calculate dynamic offset for loop arg…
wenyongh May 31, 2024
f635ab9
Enable building static library on Android platform (#3488)
wenyongh May 31, 2024
ab4e17b
Modify logging for windows exception handler and remove unused functi…
TianlongLiang May 31, 2024
082cfa1
Correct nuttx repo names (#3484)
wenyongh May 31, 2024
0a80cc4
Fix wasm loader check data segment count (#3492)
wenyongh Jun 3, 2024
380cd7b
Add unit test suites (#3490)
yzha107 Jun 4, 2024
56b4290
Fix internal global getter types (#3495)
bnason-nf Jun 4, 2024
0712c7f
Fix CI build and run unit tests (#3499)
wenyongh Jun 4, 2024
3fbb7fc
Update version to 2.1.0 and update release notes (#3481)
loganek Jun 4, 2024
8239dd4
Add wasm_export.h APIs to expose memory type (#3496)
bnason-nf Jun 6, 2024
421a6c4
Fix posix build when libc wasi is disabled and debug interp is enable…
bnason-nf Jun 6, 2024
5d1f19f
Fix wasm_mini_loader.c build when jit or multi-module is enabled (#3502)
bnason-nf Jun 6, 2024
53f26e4
Bump requests from 2.32.2 to 2.32.3 in /build-scripts (#3494)
dependabot[bot] Jun 6, 2024
8f86b37
Update release notes (#3506)
wenyongh Jun 6, 2024
dc21c62
Add missing functions to make RIOT work with the 2.x.x version (#3508)
bmewen Jun 7, 2024
bd44117
Add wasi-nn example as smoke test case (#3501)
lum1n0us Jun 7, 2024
028f43b
Fix compilation warnings of wasi-nn (#3497)
lum1n0us Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 67 additions & 2 deletions .github/workflows/compilation_on_android_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "tests/unit/**"
- "wamr-compiler/**"
- "test-tools/wamr-ide/**"
# will be triggered on push events
Expand All @@ -36,6 +37,7 @@ on:
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "tests/unit/**"
- "wamr-compiler/**"
- "test-tools/wamr-ide/**"
# allow to be triggered manually
Expand Down Expand Up @@ -272,10 +274,73 @@ jobs:
cmake --build . --config Release --parallel 4
working-directory: product-mini/platforms/${{ matrix.platform }}

build_unit_tests:
needs:
[
build_llvm_libraries_on_ubuntu_2204,
build_wamrc
]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
wasi_sdk_release:
[
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
]
wabt_release:
[
"https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
]
include:
- os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
steps:
- name: checkout
uses: actions/checkout@v4

- name: Get LLVM libraries
id: retrieve_llvm_libs
uses: actions/cache@v4
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ${{ matrix.llvm_cache_key }}

- name: Quit if cache miss
if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
run: echo "::error::can not get prebuilt llvm libraries" && exit 1

- name: download and install wasi-sdk
run: |
cd /opt
sudo wget ${{ matrix.wasi_sdk_release }}
sudo tar -xzf wasi-sdk-*.tar.gz
sudo ln -sf wasi-sdk-20.0 wasi-sdk

- name: download and install wabt
run: |
cd /opt
sudo wget ${{ matrix.wabt_release }}
sudo tar -xzf wabt-1.0.31-*.tar.gz
sudo mv wabt-1.0.31 wabt

- name: Build wamrc
run: |
mkdir build && cd build
cmake ..
cmake --build . --config Release --parallel 4
working-directory: wamr-compiler

- name: Build and run unit tests
run: |
mkdir build-unittests && cd build-unittests
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
mkdir build && cd build
cmake ..
cmake --build . --config Release --parallel 4
ctest
working-directory: tests/unit
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/compilation_on_nuttx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ jobs:
- name: Checkout NuttX
uses: actions/checkout@v4
with:
repository: apache/incubator-nuttx
repository: apache/nuttx
ref: releases/12.4
path: nuttx

- name: Checkout NuttX Apps
uses: actions/checkout@v4
with:
repository: apache/incubator-nuttx-apps
repository: apache/nuttx-apps
ref: releases/12.4
path: apps

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spec_test_on_nuttx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ jobs:
- name: Checkout NuttX
uses: actions/checkout@v4
with:
repository: apache/incubator-nuttx
repository: apache/nuttx
ref: releases/12.4
path: nuttx

- name: Checkout NuttX Apps
uses: actions/checkout@v4
with:
repository: apache/incubator-nuttx-apps
repository: apache/nuttx-apps
ref: releases/12.4
path: apps

Expand Down
2 changes: 1 addition & 1 deletion ATTRIBUTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The WAMR fast interpreter is a clean room development. We would acknowledge the
| uvwasi | unspecified | v0.0.12 | https://github.com/nodejs/uvwasi | |
| asmjit | unspecified | unspecified | https://github.com/asmjit/asmjit | |
| zydis | unspecified | e14a07895136182a5b53e181eec3b1c6e0b434de | https://github.com/zyantific/zydis | |
| NuttX ELF headers | 72313301e23f9c2de969fb64b9a0f67bb4c284df | 10.3.0 | https://github.com/apache/incubator-nuttx | |
| NuttX ELF headers | 72313301e23f9c2de969fb64b9a0f67bb4c284df | 10.3.0 | https://github.com/apache/nuttx | |
| Dhrystone | 2.1 | 2.1 | https://fossies.org/linux/privat/old/ | |

## Licenses
Expand Down
98 changes: 98 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,101 @@
## WAMR-2.1.0

### Breaking Changes

### New Features
- Add wasm_export.h APIs to expose memory type (#3496)
- Add api to get export global instance (#3452)
- Add wasm-mutator-fuzz test (#3420)
- Implement Memory64 support for AOT (#3362)
- Add wasm module global type information APIs (#3406)
- Add aot binary analysis tool aot-analyzer (#3379)
- Expose API to get import/export function's param/result valkind (#3363)
- Add WASI support for esp-idf platform (#3348)

### Bug Fixes
- Fix posix build when libc wasi is disabled and debug interp is enabled (#3503)
- Fix wasm_mini_loader.c build when jit or multi-module is enabled (#3502)
- Fix wasm loader check data segment count (#3492)
- Fix loader parse block type and calculate dynamic offset for loop args (#3482)
- Fix memory64 handling find_block_addr and execute_main (#3480)
- Fix two issues to make fuzzing test quit earlier (#3471)
- Fix test-wamr-ide CI failure (#3485)
- NuttX: Fix a dbus-related crash on esp32s3 (#3470)
- Clone data segments when specified with load args (#3463)
- Fix codeql compilation error (#3461)
- Fix several typos and fix bh_log calculate mills (#3441)
- ssp_config.h: Fix ifdef for android random api (#3444)
- libc-wasi: Fix a locking botch (#3437)
- Fix fast interp RECOVER_BR_INFO and local set/tee (#3434)
- aot compiler: Fix a type mismatch in compile_op_float_min_max (#3423)
- Correct Exception Handling tag type when GC is enabled (#3413)
- wasm loader: Fix handling if block without op else (#3404)
- ref-types: Correct default value for function local variables (#3397)
- aot compiler: Fix the length type passed to aot_memmove/aot_memset (#3378)
- Fix loader and mini-loader select potiential error (#3374)
- Fix aot debugger compilation error on windows (#3370)
- A few native stack detection fixes for macOS/arm64 (#3368)
- Fix ESP32-S3 compiling error (#3359)
- Fix a few native stack address calculations (#3351)

### Enhancements
- Modify logging for windows exception handler and remove unused function (#3489)
- posix iwasm: Make the timeout logic a bit more robust (#3478)
- libc-builtin: Enhance buffered print for printf_wrapper (#3460)
- Enhance GC const initializer expression to support nested struct/array new (#3447)
- wasi: Tweak the configuration for nuttx and explain why (#3451)
- NuttX: Replace esp32s3 bits with the OS-provided APIs (#3439)
- Allow not copying the wasm binary in wasm-c-api and not referring to the binary in wasm/aot loader (#3389)
- aot: Make precheck functions use short-call for xtensa (#3418)
- Add wasm_runtime_detect_native_stack_overflow_size (#3355)
- Enhance wasm loader checks for opcode br_table (#3352)

### Others
- Bump requests from 2.32.2 to 2.32.3 in /build-scripts (#3494)
- Enable building static library on Android platform (#3488)
- wasm-mutator-fuzz: Generate more kinds of corpus (#3487)
- Correct nuttx repo names (#3484)
- Bump requests from 2.31.0 to 2.32.2 in /build-scripts (#3474)
- wasm-mutator-fuzz: Adapt to oss-fuzz compilation (#3464)
- Add regression tests of BA issue cases (#3462)
- Add malformed test cases (#3459)
- NuttX: Rename a few recently-added nuttx options (#3449)
- wamr-test-suites: Enable AOT multi-module spec tests (#3450)
- Remove install_wasi_sdk from workload preparation script (#3445)
- Add cmake static/shared library build settings (#3443)
- Update spec test to latest commit (#3293)
- Fix typo of WAMR_CONFIGUABLE_BOUNDS_CHECKS (#3424)
- ci/coding_guidelines_check.py: Allow some well-known file names to contain '-' (#3428)
- product-mini/platforms/posix/main.c: Adapt to WASM_MEM_DUAL_BUS_MIRROR (#3427)
- Add comments to global type function declarations (#3431)
- nuttx/esp32s3: Apply ibus/dbus adjustment to internal ram 1 as well (#3421)
- Change WASM_ANYREF to WASM_EXTERNREF (#3426)
- Remove unused macros which were moved to wamr-app-framework (#3425)
- Add WASM_V128 in wasm_valkind_enum (#3412)
- Fix basic example, parameter missmatch between host and wasm (#3415)
- Fix workspaces path in build_wamr.sh (#3414)
- core/iwasm/compilation: Remove stale function prototypes (#3408)
- Add test cases for the requirements of "gc-aot" feature (#3399)
- append_aot_to_wasm.py: Add --ver-str option to emit more info in custom section name (#3398)
- Fix clang compile warnings (#3396)
- Fix some more spelling issues (#3393)
- Fix some spelling issues (#3385)
- samples/native-stack-overflow: Examine native functions with signature (#3382)
- Add some more comments on WASM_STACK_GUARD_SIZE (#3380)
- Fix typo for 'native' in wasm_export.h (#3376)
- CI: Use macos-13 instead of macos-latest (#3366)
- Test more samples in nightly-run CI (#3358)
- Random improvements to samples/native-stack-overflow (#3353)
- Reduce WASM_STACK_GUARD_SIZE a bit for posix-like platforms (#3350)
- doc: Add ADOPTERS.md (#3324)
- Update binary size info in README.md (#3030)
- core/config.h: Bump the default WASM_STACK_GUARD_SIZE (#3344)
- Add unit test suites (#3490)
- Fix internal global getter types (#3495)
- Fix CI build and run unit tests (#3499)

---

## WAMR-2.0.0

### Breaking Changes
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
requests==2.31.0
requests==2.32.3
13 changes: 13 additions & 0 deletions core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,4 +663,17 @@
#define WASM_MEM_ALLOC_WITH_USAGE 0
#endif

#ifndef WASM_ENABLE_FUZZ_TEST
#define WASM_ENABLE_FUZZ_TEST 0
#endif

#ifndef WASM_MEM_ALLOC_MAX_SIZE
#if WASM_ENABLE_FUZZ_TEST != 0
/* In oss-fuzz, the maximum RAM is ~2.5G */
#define WASM_MEM_ALLOC_MAX_SIZE (2U * 1024 * 1024 * 1024)
#else
#define WASM_MEM_ALLOC_MAX_SIZE UINT32_MAX
#endif
#endif

#endif /* end of _CONFIG_H_ */
14 changes: 7 additions & 7 deletions core/iwasm/aot/aot_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,16 +1043,16 @@ load_memory_info(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
}

for (i = 0; i < module->memory_count; i++) {
read_uint32(buf, buf_end, module->memories[i].memory_flags);
read_uint32(buf, buf_end, module->memories[i].flags);

if (!wasm_memory_check_flags(module->memories[i].memory_flags,
error_buf, error_buf_size, true)) {
if (!wasm_memory_check_flags(module->memories[i].flags, error_buf,
error_buf_size, true)) {
return false;
}

read_uint32(buf, buf_end, module->memories[i].num_bytes_per_page);
read_uint32(buf, buf_end, module->memories[i].mem_init_page_count);
read_uint32(buf, buf_end, module->memories[i].mem_max_page_count);
read_uint32(buf, buf_end, module->memories[i].init_page_count);
read_uint32(buf, buf_end, module->memories[i].max_page_count);
}

read_uint32(buf, buf_end, module->mem_init_data_count);
Expand Down Expand Up @@ -3637,9 +3637,9 @@ has_module_memory64(AOTModule *module)
/* TODO: multi-memories for now assuming the memory idx type is consistent
* across multi-memories */
if (module->import_memory_count > 0)
return !!(module->import_memories[0].memory_flags & MEMORY64_FLAG);
return !!(module->import_memories[0].mem_type.flags & MEMORY64_FLAG);
else if (module->memory_count > 0)
return !!(module->memories[0].memory_flags & MEMORY64_FLAG);
return !!(module->memories[0].flags & MEMORY64_FLAG);

return false;
}
Expand Down
13 changes: 6 additions & 7 deletions core/iwasm/aot/aot_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,22 +789,21 @@ memory_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
{
void *heap_handle;
uint32 num_bytes_per_page = memory->num_bytes_per_page;
uint32 init_page_count = memory->mem_init_page_count;
uint32 max_page_count =
wasm_runtime_get_max_mem(max_memory_pages, memory->mem_init_page_count,
memory->mem_max_page_count);
uint32 init_page_count = memory->init_page_count;
uint32 max_page_count = wasm_runtime_get_max_mem(
max_memory_pages, memory->init_page_count, memory->max_page_count);
uint32 default_max_pages;
uint32 inc_page_count, global_idx;
uint32 bytes_of_last_page, bytes_to_page_end;
uint64 aux_heap_base,
heap_offset = (uint64)num_bytes_per_page * init_page_count;
uint64 memory_data_size, max_memory_data_size;
uint8 *p = NULL, *global_addr;
bool is_memory64 = memory->memory_flags & MEMORY64_FLAG;
bool is_memory64 = memory->flags & MEMORY64_FLAG;

bool is_shared_memory = false;
#if WASM_ENABLE_SHARED_MEMORY != 0
is_shared_memory = memory->memory_flags & SHARED_MEMORY_FLAG ? true : false;
is_shared_memory = memory->flags & SHARED_MEMORY_FLAG ? true : false;
/* Shared memory */
if (is_shared_memory && parent != NULL) {
AOTMemoryInstance *shared_memory_instance;
Expand Down Expand Up @@ -1946,7 +1945,7 @@ aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst)

if (!is_sub_inst) {
#if WASM_ENABLE_WASI_NN != 0
wasi_nn_destroy(module_inst);
wasi_nn_destroy((WASMModuleInstanceCommon *)module_inst);
#endif
wasm_native_call_context_dtors((WASMModuleInstanceCommon *)module_inst);
}
Expand Down
6 changes: 0 additions & 6 deletions core/iwasm/common/gc/gc_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,12 +846,6 @@ wasm_is_reftype_supers_of_func(uint8 type)
return (type == REF_TYPE_FUNCREF) ? true : false;
}

inline static bool
wasm_is_reftype_supers_of_extern(uint8 type)
{
return (type == REF_TYPE_EXTERNREF) ? true : false;
}

#if WASM_ENABLE_STRINGREF != 0
inline static bool
wasm_is_reftype_supers_of_string(uint8 type)
Expand Down
28 changes: 25 additions & 3 deletions core/iwasm/common/wasm_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,23 @@ execute_main(WASMModuleInstanceCommon *module_inst, int32 argc, char *argv[])
if (func_type->param_count) {
for (i = 0; i < argc; i++)
total_argv_size += (uint32)(strlen(argv[i]) + 1);
total_argv_size = align_uint(total_argv_size, 4);
#if WASM_ENABLE_MEMORY64 != 0
if (is_memory64)
/* `char **argv` is an array of 64-bit elements in memory64 */
total_argv_size = align_uint(total_argv_size, 8);
else
#endif
total_argv_size = align_uint(total_argv_size, 4);

total_size = (uint64)total_argv_size + sizeof(int32) * (uint64)argc;
#if WASM_ENABLE_MEMORY64 != 0
if (is_memory64)
/* `char **argv` is an array of 64-bit elements in memory64 */
total_size =
(uint64)total_argv_size + sizeof(uint64) * (uint64)argc;
else
#endif
total_size =
(uint64)total_argv_size + sizeof(uint32) * (uint64)argc;

if (total_size >= UINT32_MAX
|| !(argv_buf_offset = wasm_runtime_module_malloc(
Expand All @@ -219,7 +233,15 @@ execute_main(WASMModuleInstanceCommon *module_inst, int32 argc, char *argv[])
for (i = 0; i < argc; i++) {
bh_memcpy_s(p, (uint32)(p_end - p), argv[i],
(uint32)(strlen(argv[i]) + 1));
argv_offsets[i] = (uint32)argv_buf_offset + (uint32)(p - argv_buf);
#if WASM_ENABLE_MEMORY64 != 0
if (is_memory64)
/* `char **argv` is an array of 64-bit elements in memory64 */
((uint64 *)argv_offsets)[i] =
(uint32)argv_buf_offset + (uint32)(p - argv_buf);
else
#endif
argv_offsets[i] =
(uint32)argv_buf_offset + (uint32)(p - argv_buf);
p += strlen(argv[i]) + 1;
}

Expand Down
Loading
Loading