Compare commits

...

9 Commits

Author SHA1 Message Date
Stefan Wallentowitz
399c4cbf4f
Merge ed152e847a into 1996c18c4b 2025-05-07 00:38:30 +00:00
YAMAMOTO Takashi
1996c18c4b
samples/wasm-c-api: skip aot compilation unless necessary (#4239) 2025-05-07 07:09:44 +08:00
dependabot[bot]
d053f5534a
build(deps): Bump github/codeql-action from 3.28.15 to 3.28.17 (#4243)
Some checks are pending
compilation on SGX / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux-sgx) (push) Waiting to run
compilation on SGX / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux-sgx) (push) Waiting to run
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $AOT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_JIT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $SIMD_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $XIP_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, fast-jit, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / build (-DWAMR_BUILD_AOT=0) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_DEBUG_INTERP=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIB_PTHREAD=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIB_WASI_THREADS=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_REF_TYPES=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_SIMD=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_TAIL_CALL=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_DISABLE_HW_BOUND_CHECK=1) (push) Waiting to run
compilation on windows-latest / test (classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.15 to 3.28.17.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.28.15...v3.28.17)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.28.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-06 11:16:45 +08:00
YAMAMOTO Takashi
4735956eeb
fix return types of our 64-bit clz/ctz/popcount intrinsics (#4238)
the corresponding LLVM intrinsics' return types are same as
their first argument. eg. i64 for llvm.cttz.i64.
cf. https://llvm.org/docs/LangRef.html#llvm-cttz-intrinsic

this commit changes the return types of our versions of the
intrinsics to match llvm versions as our aot compiler,
specifically __call_llvm_intrinsic, assumes.

strictly speaking, this is a potential AOT ABI change.
however, I suppose it isn't a problem for many of 64-bit ABIs
out there, where (lower half of) a 64-bit register is used to
return a 32-bit value anyway.  (for such ABIs, this commit
would fix the upper 32-bit value of the register.)
2025-05-06 10:15:00 +08:00
liang.he
5910e5cd21
Use --target to pass a triple in wamrc (#4199)
Provide a triple string in the format of <arch>-<vendor>-<os>-<abi>
via --target.
2025-05-06 06:56:06 +08:00
Huang Qi
5bdbba0dbe
platform/nuttx: Fix dcache operation in os_dcache_flush (#4225)
Replace up_invalidate_dcache_all() with up_flush_dcache_all() in
os_dcache_flush() to properly flush the data cache instead of just
invalidating it. This ensures that any modified data in the cache
is written back to memory before execution.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-05-06 06:55:53 +08:00
YAMAMOTO Takashi
382aa9e6c3
run_clang_format_diff: mention homebrew for clang-format installation (#4237) 2025-05-06 06:55:42 +08:00
YAMAMOTO Takashi
3232bdf2f7
teach aot emitter/loader about .srodata and .srodata.cst* sections (#4240)
LLVM 19 and later started to use srodata ("small read only data")
sections for RISCV.  cf. https://github.com/llvm/llvm-project/pull/82214
this commit makes our aot emitter/loader deal with those sections.

an alternative would be to disable small data sections completely by
setting the "SmallDataLimit" module attribute to zero. however, i feel
this commit is more straightforward and consisitent as we are already
dealing with sdata sections.
2025-05-06 06:55:35 +08:00
Stefan Wallentowitz
ed152e847a
execute_func: Newline only for non-empty returns
For void functions, the return value array is empty. Don't print the newline then.
2024-07-22 18:33:15 +02:00
12 changed files with 62 additions and 22 deletions

View File

@ -53,7 +53,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3.28.15
uses: github/codeql-action/init@v3.28.17
with:
languages: ${{ matrix.language }}
@ -70,7 +70,7 @@ jobs:
- run: |
./.github/scripts/codeql_buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.28.15
uses: github/codeql-action/analyze@v3.28.17
with:
category: "/language:${{matrix.language}}"
upload: false
@ -99,7 +99,7 @@ jobs:
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
- name: Upload CodeQL results to code scanning
uses: github/codeql-action/upload-sarif@v3.28.15
uses: github/codeql-action/upload-sarif@v3.28.17
with:
sarif_file: ${{ steps.step1.outputs.sarif-output }}
category: "/language:${{matrix.language}}"

View File

@ -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@4c3e5362829f0b0bb62ff5f6c938d7f95574c306
uses: github/codeql-action/upload-sarif@5eb3ed6614230b1931d5c08df9e096e4ba524f21
with:
sarif_file: results.sarif

View File

@ -98,9 +98,19 @@ def run_clang_format_diff(root: Path, commits: str) -> bool:
code before committing the PR, or it might fail to pass the CI check:
1. Install clang-format-14.0.0
Normally we can install it by `sudo apt-get install clang-format-14`,
or download the package from https://github.com/llvm/llvm-project/releases
and install it
You can download the package from
https://github.com/llvm/llvm-project/releases
and install it.
For Debian/Ubuntu, we can probably use
`sudo apt-get install clang-format-14`.
Homebrew has it as a part of llvm@14.
```shell
brew install llvm@14
/usr/local/opt/llvm@14/bin/clang-format
```
2. Format the C/C++ source file
``` shell

View File

@ -194,7 +194,7 @@ aot_intrinsic_clz_i32(uint32 type)
return num;
}
uint32
uint64
aot_intrinsic_clz_i64(uint64 type)
{
uint32 num = 0;
@ -220,7 +220,7 @@ aot_intrinsic_ctz_i32(uint32 type)
return num;
}
uint32
uint64
aot_intrinsic_ctz_i64(uint64 type)
{
uint32 num = 0;
@ -244,7 +244,7 @@ aot_intrinsic_popcnt_i32(uint32 u)
return ret;
}
uint32
uint64
aot_intrinsic_popcnt_i64(uint64 u)
{
uint32 ret = 0;

View File

@ -186,19 +186,19 @@ aot_intrinsic_fmax_f64(float64 a, float64 b);
uint32
aot_intrinsic_clz_i32(uint32 type);
uint32
uint64
aot_intrinsic_clz_i64(uint64 type);
uint32
aot_intrinsic_ctz_i32(uint32 type);
uint32
uint64
aot_intrinsic_ctz_i64(uint64 type);
uint32
aot_intrinsic_popcnt_i32(uint32 u);
uint32
uint64
aot_intrinsic_popcnt_i64(uint64 u);
float32

View File

@ -3189,10 +3189,12 @@ do_text_relocation(AOTModule *module, AOTRelocationGroup *group,
symbol_addr = module->code;
}
else if (!strcmp(symbol, ".data") || !strcmp(symbol, ".sdata")
|| !strcmp(symbol, ".rdata")
|| !strcmp(symbol, ".rodata")
|| !strcmp(symbol, ".rdata") || !strcmp(symbol, ".rodata")
|| !strcmp(symbol, ".srodata")
/* ".rodata.cst4/8/16/.." */
|| !strncmp(symbol, ".rodata.cst", strlen(".rodata.cst"))
/* ".srodata.cst4/8/16/.." */
|| !strncmp(symbol, ".srodata.cst", strlen(".srodata.cst"))
/* ".rodata.strn.m" */
|| !strncmp(symbol, ".rodata.str", strlen(".rodata.str"))
|| !strcmp(symbol, AOT_STACK_SIZES_SECTION_NAME)

View File

@ -875,7 +875,9 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
if (j < (uint32)(type->result_count - 1))
os_printf(",");
}
os_printf("\n");
if (type->result_count > 0) {
os_printf("\n");
}
#if WASM_ENABLE_GC != 0
for (j = 0; j < num_local_ref_pushed; j++) {

View File

@ -3270,8 +3270,17 @@ is_data_section(AOTObjectData *obj_data, LLVMSectionIteratorRef sec_itr,
return (!strcmp(section_name, ".data") || !strcmp(section_name, ".sdata")
|| !strcmp(section_name, ".rodata")
#if LLVM_VERSION_MAJOR >= 19
/* https://github.com/llvm/llvm-project/pull/82214 */
|| !strcmp(section_name, ".srodata")
#endif
/* ".rodata.cst4/8/16/.." */
|| !strncmp(section_name, ".rodata.cst", strlen(".rodata.cst"))
#if LLVM_VERSION_MAJOR >= 19
/* https://github.com/llvm/llvm-project/pull/82214
* ".srodata.cst4/8/16/.." */
|| !strncmp(section_name, ".srodata.cst", strlen(".srodata.cst"))
#endif
/* ".rodata.strn.m" */
|| !strncmp(section_name, ".rodata.str", strlen(".rodata.str"))
|| (!strcmp(section_name, ".rdata")

View File

@ -2742,10 +2742,23 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
}
else {
/* Create LLVM target machine */
arch = option->target_arch;
abi = option->target_abi;
cpu = option->target_cpu;
features = option->cpu_features;
if (!option->target_arch || !strstr(option->target_arch, "-")) {
/* Retrieve the target triple based on user input */
triple = NULL;
arch = option->target_arch;
abi = option->target_abi;
cpu = option->target_cpu;
features = option->cpu_features;
}
else {
/* Form a target triple */
triple = option->target_arch;
arch = NULL;
abi = NULL;
cpu = NULL;
features = NULL;
}
opt_level = option->opt_level;
size_level = option->size_level;
@ -2986,6 +2999,7 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
aot_set_last_error(buf);
goto fail;
}
LOG_VERBOSE("triple: %s => normailized: %s", triple, triple_norm);
if (!cpu)
cpu = "";
}

View File

@ -118,7 +118,7 @@ os_dcache_flush()
up_textheap_data_sync();
#endif
#ifndef CONFIG_BUILD_KERNEL
up_invalidate_dcache_all();
up_flush_dcache_all();
#endif
}

View File

@ -129,7 +129,7 @@ if (${WAT2WASM_VERSION} VERSION_LESS 1.0.26)
set(WAT2WASM_FLAGS "--enable-reference-types")
endif ()
if(${WAMR_BUILD_AOT} EQUAL 1)
if(${WAMR_BUILD_AOT} EQUAL 1 AND ${WAMR_BUILD_INTERP} EQUAL 0)
## locate wamrc
find_program(WAMRC
wamrc

View File

@ -116,6 +116,9 @@ print_help()
printf(" Default is host arch, e.g. x86_64\n");
printf(" <sub> = for ex. on arm or thumb: v5, v6m, v7a, v7m, etc.\n");
printf(" Use --target=help to list supported targets\n");
printf(" Or, provide a triple in the format of <arch>-<vendor>-<os>-<abi>.\n");
printf(" By doing this, --target-abi, --cpu, and --cpu-features will be ignored.\n");
printf(" The triple will only be normalized without any further verification.\n");
printf(" --target-abi=<abi> Set the target ABI, e.g. gnu, eabi, gnueabihf, msvc, etc.\n");
printf(" Default is gnu if target isn't riscv64 or riscv32\n");
printf(" For target riscv64 and riscv32, default is lp64d and ilp32d\n");