Skip to content

Commit 9423fee

Browse files
authored
Merge pull request #3739 from bytecodealliance/main
Merge branch main into dev/merge_aot_data_text
2 parents 5f517e4 + f4383a9 commit 9423fee

53 files changed

Lines changed: 1231 additions & 641 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build_wamr_vscode_ext.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v4
2222

23-
- name: Use Node.js 16.x
23+
- name: Use Node.js 18.x
2424
uses: actions/setup-node@v4
2525
with:
26-
node-version: 16.x
26+
node-version: 18.x
2727

2828
- name: set vscode extension to correct version
2929
run: |
@@ -33,7 +33,7 @@ jobs:
3333

3434
- name: generate wamr ide vscode extension
3535
run: |
36-
npm install -g vsce
36+
npm install -g @vscode/vsce
3737
rm -rf node_modules
3838
npm install
3939
vsce package

.github/workflows/compilation_on_nuttx.yml

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,17 @@ jobs:
6868
# arm64
6969
"boards/arm64/qemu/qemu-armv8a/configs/nsh",
7070
]
71-
wamr_config_option: [
72-
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_FAST=y\\n",
73-
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_FAST=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\\n",
74-
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_FAST=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\\n",
75-
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\\n",
76-
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_WASI=y\\n",
77-
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\\n",
78-
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\nCONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN=y\\n",
79-
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_AOT=y\\n",
80-
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_FAST=y\\n",
81-
"CONFIG_INTERPRETERS_WAMR=y\\nCONFIG_INTERPRETERS_WAMR_CLASSIC=y\\n",
82-
]
71+
72+
wamr_config_option:
73+
- "CONFIG_INTERPRETERS_WAMR_AOT"
74+
- "CONFIG_INTERPRETERS_WAMR_FAST"
75+
- "CONFIG_INTERPRETERS_WAMR_CLASSIC"
76+
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST"
77+
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_WASI"
78+
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN"
79+
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC"
80+
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC CONFIG_INTERPRETERS_WAMR_LIBC_WASI"
81+
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC CONFIG_INTERPRETERS_WAMR_LIBC_WASI"
8382

8483
steps:
8584
- name: Checkout NuttX
@@ -102,16 +101,22 @@ jobs:
102101
repository: ${{ github.repository }}
103102
path: apps/interpreters/wamr/wamr
104103

105-
- name: Enable WAMR for NuttX
104+
- name: Configure WAMR
105+
working-directory: nuttx
106106
run: |
107-
find nuttx/boards -name defconfig | xargs sed -i '$a\CONFIG_EOL_IS_LF=y\n${{ matrix.wamr_config_option }}'
108-
find nuttx/boards/sim -name defconfig | xargs sed -i '$a\CONFIG_LIBM=y\n'
107+
tools/configure.sh ${{ matrix.nuttx_board_config }}
108+
kconfig-tweak --enable CONFIG_PSEUDOFS_SOFTLINKS
109+
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR
110+
kconfig-tweak --enable CONFIG_INTERPRETERS_IWASM_TASK
111+
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_PRIORITY 100
112+
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACKSIZE 8192
113+
for x in ${{ matrix.wamr_config_option }}; do
114+
kconfig-tweak --enable $x
115+
done
109116
110117
- name: Build
111-
run: |
112-
cd nuttx
113-
tools/configure.sh ${{ matrix.nuttx_board_config }}
114-
make -j$(nproc) EXTRAFLAGS=-Werror
118+
working-directory: nuttx
119+
run: make -j$(nproc) EXTRAFLAGS=-Werror
115120

116121
- name: Checkout Bloaty
117122
uses: actions/checkout@v3

.github/workflows/spec_test_on_nuttx.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ jobs:
7474
target: "riscv32",
7575
fpu_type: "none"
7676
},
77+
{
78+
config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
79+
target: "riscv32_ilp32f",
80+
fpu_type: "fp"
81+
},
7782
# {
7883
# config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
7984
# target: "riscv32_ilp32d",

ATTRIBUTIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ WAMR project reused some components from other open source project:
1616
- **asmjit**: for the Fast JIT x86-64 codegen implementation
1717
- **zydis**: for the Fast JIT x86-64 codegen implementation
1818
- **NuttX ELF headers**: used in core/iwasm/aot/debug/elf_parser.c
19-
- **Dhrystone**: for the test benchmakr dhrystone
19+
- **Dhrystone**: for the test benchmark dhrystone
2020

2121
The WAMR fast interpreter is a clean room development. We would acknowledge the inspirations by [WASM3](https://github.com/wasm3/wasm3) open source project for the approach of pre-calculated operand stack location.
2222

RELEASE_NOTES.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,77 @@
1+
## WAMR-2.1.2
2+
3+
### Breaking Changes
4+
- wasi-nn: Apply new architecture (#3692)
5+
6+
### New Features
7+
- [wasi-nn] Add a new wasi-nn backend openvino (#3603)
8+
- Add APIs into wasm_c_api.h to summary wasm function execution duration (#3639)
9+
- Add support for RISCV32 ILP32F (#3708)
10+
11+
### Bug Fixes
12+
- libc-builtin: Fix function prototype for wasm_runtime_module_realloc (#3702)
13+
- Fix potential memory leak in insert_native_symbol (#3712)
14+
- aot compiler: Fix NaN handling for opcode f32/f64.const in XIP mode (#3721)
15+
- Fix table idx resolving in op call_indirect/return_call_indirect (#3726)
16+
17+
### Enhancements
18+
- Remove a few hardcoded spec test knowledge from the core library (#3648)
19+
- Change log of import function to be consistent (#3656)
20+
- libc-builtin: Fix a printf format (#3652)
21+
- Set compile symbol visibility to hidden in cmake (#3655)
22+
- wamrc: Add --mllvm= option (#3658)
23+
- wamr-compiler: Avoid size-level tweak if target is specified (#3659)
24+
- aot runtime: Add missing arm/thumb relocations (#3660)
25+
- aot compiler: Enlarge AOTNativeSymbol->symbol (#3662)
26+
- aot compiler: Bail out on too long native symbol names (#3663)
27+
- Support more features for rt-thread (#3661)
28+
- Zephyr User Mode Support (#3650)
29+
- Set posix thread name for debug build (#3657)
30+
- Add emscripten_sleep() wrapper to libc-emcc (#3669)
31+
- Fix a compilation warning (#3682)
32+
- wamrc: Add some help text for --size-level (#3689)
33+
- Restore linux iwasm default visibility (#3691)
34+
- posix_thread.c: Restore old signal alternate stack before thread exit (#3693)
35+
- libc-wasi: Make rights of STDIN/STDOUT/STDERR fixed and overlook their access modes (#3694)
36+
- [refactoring] Extract read leb to a separate file, share the code between loader and mini loader (#3701)
37+
- debug-interp: Only add lock when signal_flag is SIG_SINGSTEP (#3704)
38+
- Fix compilation warnings (#3707)
39+
- Add missing headers in bh_atomic.h and aot_llvm_extra.cpp (#3715)
40+
- Update std atomic check and simd compatibility check for arc compiler (#3716)
41+
- aot compiler: Track non-0x00 tableindex as ref types use (#3695)
42+
- compilation: Use the dedicated stack-sizes section only for AOT (#3732)
43+
- riscv: Add missing relocation intrinsics for __fixdfsi/__ltdf2 (#3733)
44+
45+
### Others
46+
- Fix night run CI (#3640)
47+
- spec-test-script/runtest.py: Don't assume the tmp dir path (#3632)
48+
- wamr-test-suites: Remove dead code (wasi_test) (#3634)
49+
- wamr-test-suites/test_wamr.sh: Add an option to specify wamrc binary (#3635)
50+
- CI: Build llvm for xtensa (#3637)
51+
- spec-test-script/runtest.py: Avoid specifying -v=0 unnecessarily (#3642)
52+
- spec-test-script: Add xtensa case (#3643)
53+
- spec-test-script/runtest.py: Move "--size-level=1" to common place for RISCV64 (#3644)
54+
- spec-test-script/runtest.py: Use a shorter timeout when expected to fail (#3647)
55+
- spec-test-script: Make case_last_words larger (#3651)
56+
- spec-test-script/runtest.py: Reduce stack size for aot w/o gc (#3653)
57+
- spec-test-script: Skip a few tests for xtensa qemu (#3664)
58+
- spec-test-script: Use -mtext-section-literals for xtensa xip (#3666)
59+
- spec_test_on_nuttx.yml: Add xtensa (#3665)
60+
- spec_test_on_nuttx.yml: Enable xip (#3671)
61+
- spec_test_on_nuttx.yml: Record more logs (#3670)
62+
- spec_test_on_nuttx.yml: Replace sed with kconfig-tweak (#3672)
63+
- spec_test_on_nuttx.yml: Retire CONFIG_EOL_IS_LF (#3676)
64+
- spec-test-script/runtest.py: Use wamrc --xip option for xip (#3683)
65+
- CI: Bump NuttX version to 12.6 (#3684)
66+
- wamr-test-suites: Clean up generated tmp files after spec test (#3700)
67+
- test_wamr.sh: Fix build wabt tool (#3703)
68+
- NuttX: Retire CONFIG_ARCH_RV32IM and CONFIG_ARCH_RV64GC (#3717)
69+
- runtest.py: Normallize option handling for XIP mode (#3722)
70+
- CI: Enable XIP spectest for RISCV32 ILP32F (#3727)
71+
- CI: Unify configuration stage for NuttX (#3725)
72+
73+
---
74+
175
## WAMR-2.1.1
276

377
### Breaking Changes

build-scripts/config_common.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ elseif (WAMR_BUILD_TARGET STREQUAL "RISCV64_LP64")
3939
add_definitions(-DBUILD_TARGET_RISCV64_LP64)
4040
elseif (WAMR_BUILD_TARGET STREQUAL "RISCV32" OR WAMR_BUILD_TARGET STREQUAL "RISCV32_ILP32D")
4141
add_definitions(-DBUILD_TARGET_RISCV32_ILP32D)
42+
elseif (WAMR_BUILD_TARGET STREQUAL "RISCV32_ILP32F")
43+
add_definitions(-DBUILD_TARGET_RISCV32_ILP32F)
4244
elseif (WAMR_BUILD_TARGET STREQUAL "RISCV32_ILP32")
4345
add_definitions(-DBUILD_TARGET_RISCV32_ILP32)
4446
elseif (WAMR_BUILD_TARGET STREQUAL "ARC")
@@ -438,12 +440,13 @@ if (WAMR_BUILD_WASI_NN EQUAL 1)
438440
if (NOT WAMR_BUILD_WASI_NN_TFLITE EQUAL 1 AND NOT WAMR_BUILD_WASI_NN_OPENVINO EQUAL 1)
439441
message (FATAL_ERROR " Need to select a backend for WASI-NN")
440442
endif ()
443+
441444
if (WAMR_BUILD_WASI_NN_TFLITE EQUAL 1)
442-
message (" WASI-NN backend tflite enabled")
445+
message (" WASI-NN: backend tflite enabled")
443446
add_definitions (-DWASM_ENABLE_WASI_NN_TFLITE)
444447
endif ()
445448
if (WAMR_BUILD_WASI_NN_OPENVINO EQUAL 1)
446-
message (" WASI-NN backend openvino enabled")
449+
message (" WASI-NN: backend openvino enabled")
447450
add_definitions (-DWASM_ENABLE_WASI_NN_OPENVINO)
448451
endif ()
449452
# Variant devices
@@ -459,7 +462,7 @@ if (WAMR_BUILD_WASI_NN EQUAL 1)
459462
add_definitions (-DWASM_WASI_NN_EXTERNAL_DELEGATE_PATH="${WAMR_BUILD_WASI_NN_EXTERNAL_DELEGATE_PATH}")
460463
endif ()
461464
if (WAMR_BUILD_WASI_EPHEMERAL_NN EQUAL 1)
462-
message (" WASI-NN: WASI-Ephemeral-NN enabled")
465+
message (" WASI-NN: use 'wasi_ephemeral_nn' instead of 'wasi-nn'")
463466
add_definitions (-DWASM_ENABLE_WASI_EPHEMERAL_NN=1)
464467
endif()
465468
endif ()

core/config.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
&& !defined(BUILD_TARGET_RISCV64_LP64D) \
2121
&& !defined(BUILD_TARGET_RISCV64_LP64) \
2222
&& !defined(BUILD_TARGET_RISCV32_ILP32D) \
23+
&& !defined(BUILD_TARGET_RISCV32_ILP32F) \
2324
&& !defined(BUILD_TARGET_RISCV32_ILP32) \
2425
&& !defined(BUILD_TARGET_ARC)
2526
/* clang-format on */
@@ -43,7 +44,11 @@
4344
#define BUILD_TARGET_XTENSA
4445
#elif defined(__riscv) && (__riscv_xlen == 64)
4546
#define BUILD_TARGET_RISCV64_LP64D
46-
#elif defined(__riscv) && (__riscv_xlen == 32)
47+
#elif defined(__riscv) && (__riscv_xlen == 32) && !defined(__riscv_flen)
48+
#define BUILD_TARGET_RISCV32_ILP32
49+
#elif defined(__riscv) && (__riscv_xlen == 32) && (__riscv_flen == 32)
50+
#define BUILD_TARGET_RISCV32_ILP32F
51+
#elif defined(__riscv) && (__riscv_xlen == 32) && (__riscv_flen == 64)
4752
#define BUILD_TARGET_RISCV32_ILP32D
4853
#elif defined(__arc__)
4954
#define BUILD_TARGET_ARC

core/iwasm/aot/arch/aot_reloc_riscv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ static SymbolMap target_sym_map[] = {
134134
REG_SYM(__eqdf2),
135135
REG_SYM(__extendsfdf2),
136136
REG_SYM(__fixdfdi),
137+
REG_SYM(__fixdfsi),
137138
REG_SYM(__fixunsdfdi),
138139
REG_SYM(__fixunsdfsi),
139140
REG_SYM(__floatdidf),
@@ -143,6 +144,7 @@ static SymbolMap target_sym_map[] = {
143144
REG_SYM(__gedf2),
144145
REG_SYM(__gtdf2),
145146
REG_SYM(__ledf2),
147+
REG_SYM(__ltdf2),
146148
REG_SYM(__muldf3),
147149
REG_SYM(__nedf2),
148150
REG_SYM(__negdf2),

core/iwasm/common/wasm_loader_common.c

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
*/
55
#include "wasm_loader_common.h"
6+
#include "bh_leb128.h"
67
#include "bh_log.h"
78
#if WASM_ENABLE_GC != 0
89
#include "../common/gc/gc_type.h"
910
#endif
1011

11-
static void
12-
set_error_buf(char *error_buf, uint32 error_buf_size, const char *string,
13-
bool is_aot)
12+
void
13+
wasm_loader_set_error_buf(char *error_buf, uint32 error_buf_size,
14+
const char *string, bool is_aot)
1415
{
1516
if (error_buf != NULL) {
1617
snprintf(error_buf, error_buf_size, "%s module load failed: %s",
@@ -29,30 +30,30 @@ wasm_memory_check_flags(const uint8 mem_flag, char *error_buf,
2930
if (mem_flag & SHARED_MEMORY_FLAG) {
3031
LOG_VERBOSE("shared memory flag was found, please enable shared "
3132
"memory, lib-pthread or lib-wasi-threads");
32-
set_error_buf(error_buf, error_buf_size, "invalid limits flags",
33-
is_aot);
33+
wasm_loader_set_error_buf(error_buf, error_buf_size,
34+
"invalid limits flags", is_aot);
3435
return false;
3536
}
3637
#endif
3738
#if WASM_ENABLE_MEMORY64 == 0
3839
if (mem_flag & MEMORY64_FLAG) {
3940
LOG_VERBOSE("memory64 flag was found, please enable memory64");
40-
set_error_buf(error_buf, error_buf_size, "invalid limits flags",
41-
is_aot);
41+
wasm_loader_set_error_buf(error_buf, error_buf_size,
42+
"invalid limits flags", is_aot);
4243
return false;
4344
}
4445
#endif
4546
}
4647

4748
if (mem_flag > MAX_PAGE_COUNT_FLAG + SHARED_MEMORY_FLAG + MEMORY64_FLAG) {
48-
set_error_buf(error_buf, error_buf_size, "invalid limits flags",
49-
is_aot);
49+
wasm_loader_set_error_buf(error_buf, error_buf_size,
50+
"invalid limits flags", is_aot);
5051
return false;
5152
}
5253
else if ((mem_flag & SHARED_MEMORY_FLAG)
5354
&& !(mem_flag & MAX_PAGE_COUNT_FLAG)) {
54-
set_error_buf(error_buf, error_buf_size,
55-
"shared memory must have maximum", is_aot);
55+
wasm_loader_set_error_buf(error_buf, error_buf_size,
56+
"shared memory must have maximum", is_aot);
5657
return false;
5758
}
5859

@@ -130,3 +131,33 @@ is_indices_overflow(uint32 import, uint32 other, char *error_buf,
130131

131132
return false;
132133
}
134+
135+
bool
136+
read_leb(uint8 **p_buf, const uint8 *buf_end, uint32 maxbits, bool sign,
137+
uint64 *p_result, char *error_buf, uint32 error_buf_size)
138+
{
139+
size_t offset = 0;
140+
bh_leb_read_status_t status =
141+
bh_leb_read(*p_buf, buf_end, maxbits, sign, p_result, &offset);
142+
143+
switch (status) {
144+
case BH_LEB_READ_SUCCESS:
145+
*p_buf += offset;
146+
return true;
147+
case BH_LEB_READ_TOO_LONG:
148+
wasm_loader_set_error_buf(error_buf, error_buf_size,
149+
"integer representation too long", false);
150+
return false;
151+
case BH_LEB_READ_OVERFLOW:
152+
wasm_loader_set_error_buf(error_buf, error_buf_size,
153+
"integer too large", false);
154+
return false;
155+
case BH_LEB_READ_UNEXPECTED_END:
156+
wasm_loader_set_error_buf(error_buf, error_buf_size,
157+
"unexpected end", false);
158+
return false;
159+
default:
160+
bh_assert(false);
161+
return false;
162+
}
163+
}

core/iwasm/common/wasm_loader_common.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ bool
3030
is_indices_overflow(uint32 import, uint32 other, char *error_buf,
3131
uint32 error_buf_size);
3232

33+
bool
34+
read_leb(uint8 **p_buf, const uint8 *buf_end, uint32 maxbits, bool sign,
35+
uint64 *p_result, char *error_buf, uint32 error_buf_size);
36+
37+
void
38+
wasm_loader_set_error_buf(char *error_buf, uint32 error_buf_size,
39+
const char *string, bool is_aot);
40+
3341
#ifdef __cplusplus
3442
}
3543
#endif

0 commit comments

Comments
 (0)