Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bf78863
Wasm loader enhancement: check code size in code entry (#3892)
TianlongLiang Nov 7, 2024
397f663
fix(uwp): Gate NTSTATUS definition behind WINAPI_PARTITION_DESKTOP fo…
fadss Nov 8, 2024
58f242f
Merge pull request #3897 from bafadumi/main
loganek Nov 12, 2024
fdda259
Fix linked global initialization in multimodule (#3905)
sjamesr Nov 13, 2024
75f5fa4
build(deps): bump github/codeql-action from 3.27.0 to 3.27.1 (#3902)
dependabot[bot] Nov 13, 2024
226bf22
GlobalValueSet was moved to IRPartitionLayer recently, but we have a …
sjamesr Nov 13, 2024
0e4dffc
Fix a leak in wasm_loader_emit_br_info (#3900)
TianlongLiang Nov 13, 2024
0119b17
Correct the table index calculation in aot_instantiation (#3903)
lum1n0us Nov 18, 2024
2975e2f
build(deps): bump github/codeql-action from 3.27.1 to 3.27.4 (#3912)
dependabot[bot] Nov 19, 2024
f2b87d7
Support external toolchain on Windows for aot compiler (#3911)
TianlongLiang Nov 19, 2024
f1d03db
Fix CI wamr-ide error (#3913)
TianlongLiang Nov 20, 2024
62aca17
Check possible integer overflow in aot memory boundary check (#3920)
TianlongLiang Nov 22, 2024
00c2aa1
Drop declarative elements on module instantiation (#3922)
sjamesr Nov 24, 2024
9d8150e
Fix WASI Path Mapping Processing (#3923)
dpjohnst Nov 24, 2024
dbdf3df
Use plain assignment rather than bh_memcpy_s (#3924)
sjamesr Nov 24, 2024
b0c6d5c
add testcases for shared heap and fix POP_MEM_OFFSET of memory64 (#3916)
WenLY1 Nov 24, 2024
1d111a3
Fix loader small bug (#3928)
TianlongLiang Nov 26, 2024
7b553cd
Enable ref types by default (#3894)
Zzzabiyaka Nov 27, 2024
27d96aa
Update README.md to clarify Windows toolchain support and ESP-IDF ref…
lum1n0us Nov 27, 2024
fd91b51
build(deps): bump github/codeql-action from 3.27.4 to 3.27.5 (#3931)
dependabot[bot] Nov 28, 2024
8698d22
add thread cpu time for zephyr (#3937)
TianlongLiang Nov 28, 2024
e09613c
support WASM_FUNCREF return type in argv_to_results (#3936)
sjamesr Nov 28, 2024
838dd81
don't return an uninitialized trap if argv_to_results fails (#3935)
sjamesr Nov 28, 2024
739efd7
Fix incorrect assignment in win_file.c (#3939)
dpjohnst Dec 1, 2024
aabe830
Improvements for platform thread APIs on Windows and Zephyr (#3941)
TianlongLiang Dec 6, 2024
c32a6ce
Refactor SConscript and add file checks in iwasm.c (#3945)
zhkag Dec 6, 2024
f665e7b
build(deps): bump github/codeql-action from 3.27.5 to 3.27.6
dependabot[bot] Dec 9, 2024
591b740
Consume the placeholders that were put when emitting table info (#3940)
lum1n0us Dec 10, 2024
bebdd4a
Fix aot table instantiate (#3946)
wenyongh Dec 10, 2024
1fb0862
Merge pull request #3951 from bytecodealliance/dependabot/github_acti…
loganek Dec 10, 2024
cde2d25
Merge branch 'dev/zephyr_file_socket' into tmp_for_merge_main_to_dev/…
wenyongh Dec 10, 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
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/[email protected].0
uses: github/codeql-action/[email protected].6
with:
languages: ${{ matrix.language }}

Expand All @@ -70,7 +70,7 @@ jobs:
- run: |
./.github/scripts/codeql_buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/[email protected].0
uses: github/codeql-action/[email protected].6
with:
category: "/language:${{matrix.language}}"
upload: false
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif

- name: Upload CodeQL results to code scanning
uses: github/codeql-action/[email protected].0
uses: github/codeql-action/[email protected].6
with:
sarif_file: ${{ steps.step1.outputs.sarif-output }}
category: "/language:${{matrix.language}}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compilation_on_android_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DWAMR_BUILD_DEBUG_INTERP=1
cmake .. -DWAMR_BUILD_DEBUG_INTERP=1 -DWAMR_BUILD_REF_TYPES=1
make
working-directory: product-mini/platforms/linux

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/supply_chain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@3aa71356c75a8edd8430d54dff2982203a28be45 # v2.2.4
uses: github/codeql-action/upload-sarif@6f9e628e6f9a18c785dd746325ba455111df1b67 # v2.2.4
with:
sarif_file: results.sarif
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ if (NOT DEFINED WAMR_BUILD_SIMD)
endif ()

if (NOT DEFINED WAMR_BUILD_REF_TYPES)
# Disable reference types by default
set (WAMR_BUILD_REF_TYPES 0)
# Enable reference types by default
set (WAMR_BUILD_REF_TYPES 1)
endif ()

set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ The WAMR VMcore supports the following architectures:
- XTENSA, MIPS, ARC

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.
- [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)
- [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)
- [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)
- [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)


## Getting started
Expand Down
20 changes: 18 additions & 2 deletions build-scripts/build_llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,27 @@ def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_fl
"default": [],
}

experimental_backends = ["ARC", "Xtensa"]
normal_backends = [s for s in backends if s not in experimental_backends]

LLVM_TARGETS_TO_BUILD = [
'-DLLVM_TARGETS_TO_BUILD:STRING="' + ";".join(backends) + '"'
if backends
'-DLLVM_TARGETS_TO_BUILD:STRING="' + ";".join(normal_backends) + '"'
if normal_backends
else '-DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;Mips;RISCV;X86"'
]

# if not on ARC platform, but want to add expeirmental backend ARC as target
if platform != "ARC" and "ARC" in backends:
LLVM_TARGETS_TO_BUILD.extend(
LLVM_EXTRA_COMPILE_OPTIONS["arc"]
)

if platform != "Xtensa" and "Xtensa" in backends:
print(
"Currently it's not supported to build Xtensa backend on non-Xtensa platform"
)
return None

LLVM_PROJECTS_TO_BUILD = [
'-DLLVM_ENABLE_PROJECTS:STRING="' + ";".join(projects) + '"' if projects else ""
]
Expand Down Expand Up @@ -240,6 +255,7 @@ def main():
"X86",
"Xtensa",
],
default=[],
help="identify LLVM supported backends, separate by space, like '--arch ARM Mips X86'",
)
parser.add_argument(
Expand Down
12 changes: 11 additions & 1 deletion core/iwasm/aot/aot_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,12 @@ load_import_table_list(const uint8 **p_buf, const uint8 *buf_end,
if (wasm_is_type_multi_byte_type(import_table->table_type.elem_type)) {
read_uint8(buf, buf_end, ref_type.ref_ht_common.nullable);
}
else
#endif
{
/* Skip 1 byte */
buf += 1;
}
read_uint32(buf, buf_end, import_table->table_type.init_size);
read_uint32(buf, buf_end, import_table->table_type.max_size);
#if WASM_ENABLE_GC != 0
Expand Down Expand Up @@ -1393,7 +1398,12 @@ load_table_list(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
if (wasm_is_type_multi_byte_type(table->table_type.elem_type)) {
read_uint8(buf, buf_end, ref_type.ref_ht_common.nullable);
}
else
#endif
{
/* Skip 1 byte */
buf += 1;
}
read_uint32(buf, buf_end, table->table_type.init_size);
read_uint32(buf, buf_end, table->table_type.max_size);
#if WASM_ENABLE_GC != 0
Expand Down Expand Up @@ -1481,7 +1491,7 @@ load_table_init_data_list(const uint8 **p_buf, const uint8 *buf_end,
else
#endif
{
/* Skip 8 byte for ref type info */
/* Skip 8 byte(2+2+4) for ref type info */
buf += 8;
}

Expand Down
23 changes: 16 additions & 7 deletions core/iwasm/aot/aot_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,20 +689,23 @@ tables_instantiate(AOTModuleInstance *module_inst, AOTModule *module,
tbl_inst->cur_size = import_table->table_type.init_size;
tbl_inst->max_size =
aot_get_imp_tbl_data_slots(import_table, false);
tbl_inst->elem_type = module->tables[i].table_type.elem_type;
tbl_inst->elem_type = import_table->table_type.elem_type;
tbl_inst->is_table64 =
import_table->table_type.flags & TABLE64_FLAG;
#if WASM_ENABLE_GC != 0
tbl_inst->elem_ref_type.elem_ref_type =
module->tables[i].table_type.elem_ref_type;
import_table->table_type.elem_ref_type;
#endif
}
else {
AOTTable *table = module->tables + (i - module->import_table_count);
tbl_inst->cur_size = table->table_type.init_size;
tbl_inst->max_size = aot_get_tbl_data_slots(table, false);
tbl_inst->elem_type = module->tables[i].table_type.elem_type;
tbl_inst->elem_type = table->table_type.elem_type;
tbl_inst->is_table64 = table->table_type.flags & TABLE64_FLAG;
#if WASM_ENABLE_GC != 0
tbl_inst->elem_ref_type.elem_ref_type =
module->tables[i].table_type.elem_ref_type;
table->table_type.elem_ref_type;
#endif
}

Expand Down Expand Up @@ -1785,7 +1788,7 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
bool ret = false;
#endif

/* Check heap size */
/* Align and validate heap size */
heap_size = align_uint(heap_size, 8);
if (heap_size > APP_HEAP_SIZE_MAX)
heap_size = APP_HEAP_SIZE_MAX;
Expand Down Expand Up @@ -1905,7 +1908,9 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
goto fail;
}
for (i = 0; i < module->table_init_data_count; i++) {
if (wasm_elem_is_active(module->table_init_data_list[i]->mode))
if (wasm_elem_is_active(module->table_init_data_list[i]->mode)
|| wasm_elem_is_declarative(
module->table_init_data_list[i]->mode))
bh_bitmap_set_bit(common->elem_dropped, i);
}
}
Expand Down Expand Up @@ -2001,7 +2006,11 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
AOTTableInstance *table_inst;
table_elem_type_t *table_data;

table = &module->tables[i];
/* bypass imported table since AOTImportTable doesn't have init_expr */
if (i < module->import_table_count)
continue;

table = &module->tables[i - module->import_table_count];
bh_assert(table);

if (table->init_expr.init_expr_type == INIT_EXPR_NONE) {
Expand Down
11 changes: 4 additions & 7 deletions core/iwasm/common/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ cwd = GetCurrentDir()

src = Glob('*.c')

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

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

Expand Down
3 changes: 2 additions & 1 deletion core/iwasm/common/wasm_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ execute_main(WASMModuleInstanceCommon *module_inst, int32 argc, char *argv[])
bool ret, is_import_func = true, is_memory64 = false;
#if WASM_ENABLE_MEMORY64 != 0
WASMModuleInstance *wasm_module_inst = (WASMModuleInstance *)module_inst;
is_memory64 = wasm_module_inst->memories[0]->is_memory64;
if (wasm_module_inst->memory_count > 0)
is_memory64 = wasm_module_inst->memories[0]->is_memory64;
#endif

exec_env = wasm_runtime_get_exec_env_singleton(module_inst);
Expand Down
3 changes: 3 additions & 0 deletions core/iwasm/common/wasm_c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -3330,6 +3330,7 @@ argv_to_results(const uint32 *argv, const wasm_valtype_vec_t *result_defs,
break;
#if WASM_ENABLE_GC == 0 && WASM_ENABLE_REF_TYPES != 0
case WASM_EXTERNREF:
case WASM_FUNCREF:
result->of.ref = (struct wasm_ref_t *)(*(uintptr_t *)argv);
argv += sizeof(uintptr_t) / sizeof(uint32);
break;
Expand Down Expand Up @@ -3441,6 +3442,8 @@ wasm_func_call(const wasm_func_t *func, const wasm_val_vec_t *params,
if (result_count) {
if (!argv_to_results(argv, wasm_functype_results(func->type),
results)) {
wasm_runtime_set_exception(func->inst_comm_rt,
"argv_to_results failed");
goto failed;
}
results->num_elems = result_count;
Expand Down
10 changes: 8 additions & 2 deletions core/iwasm/common/wasm_runtime_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -3631,8 +3631,14 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,

bh_memcpy_s(mapping_copy, max_len, map_dir_list[i],
(uint32)(strlen(map_dir_list[i]) + 1));
map_mapped = strtok(mapping_copy, "::");
map_host = strtok(NULL, "::");

const char *delim = "::";
char *delim_pos = strstr(mapping_copy, delim);
if (delim_pos) {
*delim_pos = '\0';
map_mapped = mapping_copy;
map_host = delim_pos + strlen(delim);
}

if (!map_mapped || !map_host) {
if (error_buf)
Expand Down
43 changes: 4 additions & 39 deletions core/iwasm/compilation/aot_compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -4093,39 +4093,6 @@ aot_compile_wasm(AOTCompContext *comp_ctx)
return true;
}

#if !(defined(_WIN32) || defined(_WIN32_))
char *
aot_generate_tempfile_name(const char *prefix, const char *extension,
char *buffer, uint32 len)
{
int fd, name_len;

name_len = snprintf(buffer, len, "%s-XXXXXX", prefix);

if ((fd = mkstemp(buffer)) <= 0) {
aot_set_last_error("make temp file failed.");
return NULL;
}

/* close and remove temp file */
close(fd);
unlink(buffer);

/* Check if buffer length is enough */
/* name_len + '.' + extension + '\0' */
if (name_len + 1 + strlen(extension) + 1 > len) {
aot_set_last_error("temp file name too long.");
return NULL;
}

snprintf(buffer + name_len, len - name_len, ".%s", extension);
return buffer;
}
#else

errno_t
_mktemp_s(char *nameTemplate, size_t sizeInChars);

char *
aot_generate_tempfile_name(const char *prefix, const char *extension,
char *buffer, uint32 len)
Expand All @@ -4134,7 +4101,8 @@ aot_generate_tempfile_name(const char *prefix, const char *extension,

name_len = snprintf(buffer, len, "%s-XXXXXX", prefix);

if (_mktemp_s(buffer, name_len + 1) != 0) {
if (!bh_mkstemp(buffer, name_len + 1)) {
aot_set_last_error("make temp file failed.");
return NULL;
}

Expand All @@ -4148,7 +4116,6 @@ aot_generate_tempfile_name(const char *prefix, const char *extension,
snprintf(buffer + name_len, len - name_len, ".%s", extension);
return buffer;
}
#endif /* end of !(defined(_WIN32) || defined(_WIN32_)) */

bool
aot_emit_llvm_file(AOTCompContext *comp_ctx, const char *file_name)
Expand Down Expand Up @@ -4227,7 +4194,6 @@ aot_emit_object_file(AOTCompContext *comp_ctx, char *file_name)

bh_print_time("Begin to emit object file");

#if !(defined(_WIN32) || defined(_WIN32_))
if (comp_ctx->external_llc_compiler || comp_ctx->external_asm_compiler) {
char cmd[1024];
int ret;
Expand Down Expand Up @@ -4270,7 +4236,7 @@ aot_emit_object_file(AOTCompContext *comp_ctx, char *file_name)
file_name, bc_file_name);
LOG_VERBOSE("invoking external LLC compiler:\n\t%s", cmd);

ret = system(cmd);
ret = bh_system(cmd);
/* remove temp bitcode file */
unlink(bc_file_name);

Expand Down Expand Up @@ -4323,7 +4289,7 @@ aot_emit_object_file(AOTCompContext *comp_ctx, char *file_name)
file_name, asm_file_name);
LOG_VERBOSE("invoking external ASM compiler:\n\t%s", cmd);

ret = system(cmd);
ret = bh_system(cmd);
/* remove temp assembly file */
unlink(asm_file_name);

Expand All @@ -4336,7 +4302,6 @@ aot_emit_object_file(AOTCompContext *comp_ctx, char *file_name)

return true;
}
#endif /* end of !(defined(_WIN32) || defined(_WIN32_)) */

if (!strncmp(LLVMGetTargetName(target), "arc", 3))
/* Emit to assembly file instead for arc target
Expand Down
Loading
Loading