Skip to content

Commit 87ffe3f

Browse files
committed
Merge branch main into dev/zephyr_file_socket
2 parents 0464262 + 1fb0862 commit 87ffe3f

40 files changed

+560
-179
lines changed

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454
# Initializes the CodeQL tools for scanning.
5555
- name: Initialize CodeQL
56-
uses: github/codeql-action/init@v3.27.0
56+
uses: github/codeql-action/init@v3.27.6
5757
with:
5858
languages: ${{ matrix.language }}
5959

@@ -70,7 +70,7 @@ jobs:
7070
- run: |
7171
./.github/scripts/codeql_buildscript.sh
7272
- name: Perform CodeQL Analysis
73-
uses: github/codeql-action/analyze@v3.27.0
73+
uses: github/codeql-action/analyze@v3.27.6
7474
with:
7575
category: "/language:${{matrix.language}}"
7676
upload: false
@@ -99,7 +99,7 @@ jobs:
9999
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
100100

101101
- name: Upload CodeQL results to code scanning
102-
uses: github/codeql-action/upload-sarif@v3.27.0
102+
uses: github/codeql-action/upload-sarif@v3.27.6
103103
with:
104104
sarif_file: ${{ steps.step1.outputs.sarif-output }}
105105
category: "/language:${{matrix.language}}"

.github/workflows/compilation_on_android_ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ jobs:
828828
run: |
829829
mkdir build
830830
cd build
831-
cmake .. -DWAMR_BUILD_DEBUG_INTERP=1
831+
cmake .. -DWAMR_BUILD_DEBUG_INTERP=1 -DWAMR_BUILD_REF_TYPES=1
832832
make
833833
working-directory: product-mini/platforms/linux
834834

.github/workflows/supply_chain.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ jobs:
6060

6161
# Upload the results to GitHub's code scanning dashboard.
6262
- name: "Upload to code-scanning"
63-
uses: github/codeql-action/upload-sarif@3aa71356c75a8edd8430d54dff2982203a28be45 # v2.2.4
63+
uses: github/codeql-action/upload-sarif@6f9e628e6f9a18c785dd746325ba455111df1b67 # v2.2.4
6464
with:
6565
sarif_file: results.sarif

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ if (NOT DEFINED WAMR_BUILD_SIMD)
113113
endif ()
114114

115115
if (NOT DEFINED WAMR_BUILD_REF_TYPES)
116-
# Disable reference types by default
117-
set (WAMR_BUILD_REF_TYPES 0)
116+
# Enable reference types by default
117+
set (WAMR_BUILD_REF_TYPES 1)
118118
endif ()
119119

120120
set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ The WAMR VMcore supports the following architectures:
5858
- XTENSA, MIPS, ARC
5959

6060
The following platforms are supported, click each link below for how to build iwasm on that platform. Refer to [WAMR porting guide](./doc/port_wamr.md) for how to port WAMR to a new platform.
61-
- [Linux](./product-mini/README.md#linux), [Linux SGX (Intel Software Guard Extension)](./doc/linux_sgx.md), [MacOS](./product-mini/README.md#macos), [Android](./product-mini/README.md#android), [Windows](./product-mini/README.md#windows), [Windows (MinGW)](./product-mini/README.md#mingw)
62-
- [Zephyr](./product-mini/README.md#zephyr), [AliOS-Things](./product-mini/README.md#alios-things), [VxWorks](./product-mini/README.md#vxworks), [NuttX](./product-mini/README.md#nuttx), [RT-Thread](./product-mini/README.md#RT-Thread), [ESP-IDF](./product-mini/README.md#esp-idf)
61+
- [Linux](./product-mini/README.md#linux), [Linux SGX (Intel Software Guard Extension)](./doc/linux_sgx.md), [MacOS](./product-mini/README.md#macos), [Android](./product-mini/README.md#android), [Windows](./product-mini/README.md#windows), [Windows (MinGW, MSVC)](./product-mini/README.md#mingw)
62+
- [Zephyr](./product-mini/README.md#zephyr), [AliOS-Things](./product-mini/README.md#alios-things), [VxWorks](./product-mini/README.md#vxworks), [NuttX](./product-mini/README.md#nuttx), [RT-Thread](./product-mini/README.md#RT-Thread), [ESP-IDF(FreeRTOS)](./product-mini/README.md#esp-idf)
6363

6464

6565
## Getting started

build-scripts/build_llvm.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,27 @@ def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_fl
102102
"default": [],
103103
}
104104

105+
experimental_backends = ["ARC", "Xtensa"]
106+
normal_backends = [s for s in backends if s not in experimental_backends]
107+
105108
LLVM_TARGETS_TO_BUILD = [
106-
'-DLLVM_TARGETS_TO_BUILD:STRING="' + ";".join(backends) + '"'
107-
if backends
109+
'-DLLVM_TARGETS_TO_BUILD:STRING="' + ";".join(normal_backends) + '"'
110+
if normal_backends
108111
else '-DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;Mips;RISCV;X86"'
109112
]
110113

114+
# if not on ARC platform, but want to add expeirmental backend ARC as target
115+
if platform != "ARC" and "ARC" in backends:
116+
LLVM_TARGETS_TO_BUILD.extend(
117+
LLVM_EXTRA_COMPILE_OPTIONS["arc"]
118+
)
119+
120+
if platform != "Xtensa" and "Xtensa" in backends:
121+
print(
122+
"Currently it's not supported to build Xtensa backend on non-Xtensa platform"
123+
)
124+
return None
125+
111126
LLVM_PROJECTS_TO_BUILD = [
112127
'-DLLVM_ENABLE_PROJECTS:STRING="' + ";".join(projects) + '"' if projects else ""
113128
]
@@ -240,6 +255,7 @@ def main():
240255
"X86",
241256
"Xtensa",
242257
],
258+
default=[],
243259
help="identify LLVM supported backends, separate by space, like '--arch ARM Mips X86'",
244260
)
245261
parser.add_argument(

core/iwasm/aot/aot_loader.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,12 @@ load_import_table_list(const uint8 **p_buf, const uint8 *buf_end,
13331333
if (wasm_is_type_multi_byte_type(import_table->table_type.elem_type)) {
13341334
read_uint8(buf, buf_end, ref_type.ref_ht_common.nullable);
13351335
}
1336+
else
13361337
#endif
1338+
{
1339+
/* Skip 1 byte */
1340+
buf += 1;
1341+
}
13371342
read_uint32(buf, buf_end, import_table->table_type.init_size);
13381343
read_uint32(buf, buf_end, import_table->table_type.max_size);
13391344
#if WASM_ENABLE_GC != 0
@@ -1393,7 +1398,12 @@ load_table_list(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
13931398
if (wasm_is_type_multi_byte_type(table->table_type.elem_type)) {
13941399
read_uint8(buf, buf_end, ref_type.ref_ht_common.nullable);
13951400
}
1401+
else
13961402
#endif
1403+
{
1404+
/* Skip 1 byte */
1405+
buf += 1;
1406+
}
13971407
read_uint32(buf, buf_end, table->table_type.init_size);
13981408
read_uint32(buf, buf_end, table->table_type.max_size);
13991409
#if WASM_ENABLE_GC != 0
@@ -1481,7 +1491,7 @@ load_table_init_data_list(const uint8 **p_buf, const uint8 *buf_end,
14811491
else
14821492
#endif
14831493
{
1484-
/* Skip 8 byte for ref type info */
1494+
/* Skip 8 byte(2+2+4) for ref type info */
14851495
buf += 8;
14861496
}
14871497

core/iwasm/aot/aot_runtime.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -689,20 +689,23 @@ tables_instantiate(AOTModuleInstance *module_inst, AOTModule *module,
689689
tbl_inst->cur_size = import_table->table_type.init_size;
690690
tbl_inst->max_size =
691691
aot_get_imp_tbl_data_slots(import_table, false);
692-
tbl_inst->elem_type = module->tables[i].table_type.elem_type;
692+
tbl_inst->elem_type = import_table->table_type.elem_type;
693+
tbl_inst->is_table64 =
694+
import_table->table_type.flags & TABLE64_FLAG;
693695
#if WASM_ENABLE_GC != 0
694696
tbl_inst->elem_ref_type.elem_ref_type =
695-
module->tables[i].table_type.elem_ref_type;
697+
import_table->table_type.elem_ref_type;
696698
#endif
697699
}
698700
else {
699701
AOTTable *table = module->tables + (i - module->import_table_count);
700702
tbl_inst->cur_size = table->table_type.init_size;
701703
tbl_inst->max_size = aot_get_tbl_data_slots(table, false);
702-
tbl_inst->elem_type = module->tables[i].table_type.elem_type;
704+
tbl_inst->elem_type = table->table_type.elem_type;
705+
tbl_inst->is_table64 = table->table_type.flags & TABLE64_FLAG;
703706
#if WASM_ENABLE_GC != 0
704707
tbl_inst->elem_ref_type.elem_ref_type =
705-
module->tables[i].table_type.elem_ref_type;
708+
table->table_type.elem_ref_type;
706709
#endif
707710
}
708711

@@ -1785,7 +1788,7 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
17851788
bool ret = false;
17861789
#endif
17871790

1788-
/* Check heap size */
1791+
/* Align and validate heap size */
17891792
heap_size = align_uint(heap_size, 8);
17901793
if (heap_size > APP_HEAP_SIZE_MAX)
17911794
heap_size = APP_HEAP_SIZE_MAX;
@@ -1905,7 +1908,9 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
19051908
goto fail;
19061909
}
19071910
for (i = 0; i < module->table_init_data_count; i++) {
1908-
if (wasm_elem_is_active(module->table_init_data_list[i]->mode))
1911+
if (wasm_elem_is_active(module->table_init_data_list[i]->mode)
1912+
|| wasm_elem_is_declarative(
1913+
module->table_init_data_list[i]->mode))
19091914
bh_bitmap_set_bit(common->elem_dropped, i);
19101915
}
19111916
}
@@ -2001,7 +2006,11 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
20012006
AOTTableInstance *table_inst;
20022007
table_elem_type_t *table_data;
20032008

2004-
table = &module->tables[i];
2009+
/* bypass imported table since AOTImportTable doesn't have init_expr */
2010+
if (i < module->import_table_count)
2011+
continue;
2012+
2013+
table = &module->tables[i - module->import_table_count];
20052014
bh_assert(table);
20062015

20072016
if (table->init_expr.init_expr_type == INIT_EXPR_NONE) {

core/iwasm/common/SConscript

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ cwd = GetCurrentDir()
1313

1414
src = Glob('*.c')
1515

16-
if rtconfig.ARCH == 'arm':
17-
if re.match('^cortex-m.*', rtconfig.CPU):
18-
src += ['arch/invokeNative_thumb.s']
19-
elif re.match('^cortex-a.*', rtconfig.CPU):
20-
src += ['arch/invokeNative_arm.s']
21-
elif rtconfig.ARCH == 'ia32':
22-
src += ['arch/invokeNative_ia32.s']
16+
if rtconfig.ARCH == 'arm' and re.match('^cortex-m.*', rtconfig.CPU):
17+
src += ['arch/invokeNative_thumb.s']
18+
else:
19+
src.append(f"arch/invokeNative_{rtconfig.ARCH}.s")
2320

2421
CPPPATH = [cwd, cwd + '/../include']
2522

core/iwasm/common/wasm_application.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ execute_main(WASMModuleInstanceCommon *module_inst, int32 argc, char *argv[])
105105
bool ret, is_import_func = true, is_memory64 = false;
106106
#if WASM_ENABLE_MEMORY64 != 0
107107
WASMModuleInstance *wasm_module_inst = (WASMModuleInstance *)module_inst;
108-
is_memory64 = wasm_module_inst->memories[0]->is_memory64;
108+
if (wasm_module_inst->memory_count > 0)
109+
is_memory64 = wasm_module_inst->memories[0]->is_memory64;
109110
#endif
110111

111112
exec_env = wasm_runtime_get_exec_env_singleton(module_inst);

0 commit comments

Comments
 (0)