Commit Graph
100 Commits
Author SHA1 Message Date
Huang QiandGitHub 269b695f85 Refactor reloc symbols for riscv (#2894) 2023-12-11 14:44:41 +08:00
Huang QiandGitHub c6848e45a1 Using docker image for nuttx spectest (#2887)
And disable running the nuttx spectest CI every time PR merged since
it will consume too much runners to slow down the other checks.
2023-12-11 09:48:59 +08:00
Huang QiandGitHub 2fb3dc3ec0 Add arm64 to nuttx compilation test (#2886) 2023-12-08 18:21:47 +08:00
Huang QiandGitHub a58e596995 compilation_on_nuttx.yml: Use docker image to simplify env setup (#2878) 2023-12-07 18:03:07 +08:00
Huang QiandGitHub 39d0fabda3 Using stable branch for NuttX relative CI (#2872) 2023-12-06 16:09:17 +08:00
Huang QiandGitHub 49cd2e011b Fix float argument handling for riscv32 ilp32d (#2871) 2023-12-06 11:30:07 +08:00
Huang QiandGitHub 47993ec72d Don't launch extra cores in QEMU to save resource (#2867) 2023-12-06 09:46:50 +08:00
Huang QiandGitHub 7308b1eb00 Update FPU configuration in spec_test_on_nuttx.yml (#2856) 2023-12-04 18:57:18 +08:00
Huang QiandGitHub e350e65b12 Don't add "+d" to riscv cpu features if already given (#2855) 2023-12-04 17:00:21 +08:00
Huang QiandGitHub 453a29a9d4 Enable spectest on riscv64 (#2843)
Fix relocation issues on riscv and update test scripts and CI to enable
test spec cases on riscv QEMU.
2023-12-04 14:22:47 +08:00
Huang QiandGitHub d7608690c0 Run spec test for classic/fast-interp in NuttX CI (#2817) 2023-11-27 15:24:02 +08:00
Huang QiandGitHub cb44e56b4e Fix Zifencei extension issue in RISC-V (#2807)
Refer to:
https://github.com/bytecodealliance/wasm-micro-runtime/pull/2805
2023-11-23 10:23:33 +08:00
Huang QiandGitHub 0b29904f26 Fix configurable bounds checks typo (#2809) 2023-11-21 17:32:45 +08:00
Huang QiandGitHub 9ad42290d8 Fix formatting in wasm_dump_perf_profiling (#2799)
Changes %d to %PRIu32.
2023-11-20 18:06:35 +08:00
Huang QiandGitHub aebe30426f Fix formatting in aot_dump_perf_profiling (#2796)
Changes %d to %PRIu32.
2023-11-20 12:11:02 +08:00
Huang QiandGitHub 73cd1969f4 Add support for custom sections in nuttx (#2795) 2023-11-20 11:37:51 +08:00
Huang QiandGitHub e8c8f7fca6 Fix return type in wasm_loader_get_custom_section (#2794)
Should return NULL instead of false.
2023-11-20 10:36:15 +08:00
Huang QiandGitHub 748e745088 Disable FPU in NuttX spec test (#2781)
Fix spec test failure on NuttX with #2780, see:
https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/6910450452
2023-11-18 09:09:30 +08:00
Huang QiandGitHub be05af79fb Refine atomic operation flags in bh_atomic.h (#2780) 2023-11-18 08:59:58 +08:00
Huang QiandGitHub b92906464e Fix printing ref.extern addresses in wasm_application.c (#2774) 2023-11-16 15:10:58 +08:00
Huang QiandGitHub 24aa1cb408 Extend os_mmap to support map file from fd (#2763)
Add an extra argument `os_file_handle file` for `os_mmap` to support
mapping file from a file fd, and remove `os_get_invalid_handle` from
`posix_file.c` and `win_file.c`, instead, add it in the `platform_internal.h`
files to remove the dependency on libc-wasi.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-11-16 08:28:54 +08:00
Huang QiandGitHub 56bfae774c Update RISC-V compilers in Nuttx compilation CI and spec test CI (#2756)
Update RISC-V compilers in Nuttx compilation CI and spec test CI
to test workflows.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-11-14 09:21:58 +08:00
Huang QiandGitHub e4353b4e1f Add eabihf ABI support and set vendor-sys of bare-metal targets (#2745)
Set the vendor-sys of bare-metal targets to "-unknown-none-",
and currently only add "thumbxxx" to the bare-metal target list.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-11-13 18:01:15 +08:00
Huang QiandGitHub 051dfbbb9e Fix a typo in is_win_platform (#2490) 2023-08-22 11:50:11 +08:00
Huang QiandGitHub 4b1f027690 Re-organize intrinsics in aot_reloc_riscv.c to fix some FPU issues (#2414) 2023-08-01 17:28:57 +08:00
Huang QiandGitHub 10b18d85cd Fix ExpandMemoryOpPass doesn't work properly (#2399)
The old method may not work for some cases. This PR iterates over all instructions
in the function, looking for memcpy, memmove and memset instructions, putting
them into a set, and finally expands them into a loop one by one.

And move this LLVM Pass after building the pipe line of pass builder to ensure that
the memcpy/memmove/memset instrinsics are generated before applying the pass.
2023-07-29 10:28:09 +08:00
Huang QiandGitHub aafea39b8c Add "--enable-builtin-intrinsics=<flags>" option to wamrc (#2341)
Refer to doc/xip.md for details.
2023-07-06 18:20:35 +08:00
Huang QiandGitHub 6a310cc88a Add "--native-lib=<lib>" option to wamrc (#2342) 2023-07-06 12:25:28 +08:00
Huang QiandGitHub ae4069df41 Migrate ExpandMemoryOpPass to llvm new pass manager (#2334)
Fix #2328
2023-07-04 17:17:15 +08:00
Huang QiandGitHub 18092f86cc Make memory access boundary check behavior configurable (#2289)
Allow to use `cmake -DWAMR_CONFIGURABLE_BOUNDS_CHECKS=1` to
build iwasm, and then run `iwasm --disable-bounds-checks` to disable the
memory access boundary checks.

And add two APIs:
`wasm_runtime_set_bounds_checks` and `wasm_runtime_is_bounds_checks_enabled`
2023-07-04 16:21:30 +08:00
Huang QiandGitHub 44f4b4f062 Add "--enable-llvm-passes=<passes>" option to wamrc (#2335)
Add "--enable-llvm-passes=<passes>" option to wamrc for customizing LLVM passes
2023-07-04 12:20:52 +08:00
Huang QiandGitHub df98d9fb4a Add "--xip" option for wamrc (#2336)
Add shorthand "--xip" option for wamrc, which is equal to
"--enalbe-indirect-mode --disable-llvm-intrinsics"
2023-07-04 12:03:40 +08:00
Huang QiandGitHub 7ec77598dd Fix format warning by PRIu32 in [wasm|aot] dump call stack (#2251) 2023-06-11 11:30:25 +08:00
Huang QiandGitHub d692878484 Nuttx CI: Ignore the expired certificate for riscv gcc toolchain (#2222) 2023-05-17 15:15:23 +08:00
Huang QiandGitHub 19ab3b8812 spectest/nuttx: Increase stack size of iwasm task (#2082) 2023-03-29 17:24:44 +08:00
Huang QiandGitHub ea50bd2aca Support dump call stack on exception and dump call stack on nuttx (#2042) 2023-03-22 18:11:53 +08:00
Huang QiandGitHub 2a5a2243e3 ci: Setup wasi-sdk for compilation on nuttx to fix break (#2012) 2023-03-07 12:06:38 +08:00
Huang QiandGitHub 8ed6687696 Fix CI compilation error on nuttx (#1940) 2023-02-07 12:42:59 +08:00
Huang QiandGitHub 2c8375ee67 wamr-test-suites: Save .wasm/.aot file to the report dir if test failed (#1937) 2023-02-06 11:04:28 +08:00
Huang QiandGitHub 58316635d4 ci: Enable libc-wasi compilation test on NuttX (#1918) 2023-01-28 12:39:14 +08:00
Huang QiandGitHub cb7ac8fee3 nuttx: Mock socket APIs if NET is disabled (#1896) 2023-01-18 09:16:13 +08:00
Huang QiandGitHub a1786428e6 nuttx: Remove fdopendir (#1895)
The newer version of nuttx has implemented fdopendir, and the compiler
reports multiple definitions of it.
2023-01-17 11:16:01 +08:00
Huang QiandGitHub f818f4c43f Simplify fcmp intrinsic logic for AOT/XIP (#1881) 2023-01-12 12:05:53 +08:00
Huang QiandGitHub d5aa354d41 Return result directly if float cmp is called in AOT XIP (#1851) 2022-12-30 16:45:39 +08:00
Huang QiandGitHub d309091706 Register missing symbols for f32 to 64 bit integer conversion (#1850) 2022-12-30 15:21:25 +08:00
Huang QiandGitHub d1fe589d43 Fix fmin/fmax in AOT XIP intrinsics (#1848) 2022-12-29 18:48:55 +08:00
Huang QiandGitHub 41eb938a95 Fix equal check in AOT XIP float cmp intrinsic (#1847) 2022-12-29 18:11:05 +08:00
Huang QiandGitHub 6c7ca90229 Use float version library routine for XIP aot_intrinsic_xxx APIs (#1846) 2022-12-29 16:49:27 +08:00
Huang QiandGitHub b5f8a2bd08 Add missing soft float intrinsics for risc-v AOT (#1845) 2022-12-29 16:00:33 +08:00
Huang QiandGitHub 5d006ad263 Reuse build llvm libraries for spec test on nuttx (#1838)
Fix daily CI break on NuttX.
2022-12-26 14:22:15 +08:00
Huang QiandWenyong Huang dbec3f0202 Enable XIP in CI daily test (#1793) 2022-12-20 14:37:07 +08:00
Huang QiandWenyong Huang c613866bac Implement i32.div_s (#1792) 2022-12-20 14:37:07 +08:00
Huang QiandWenyong Huang bfd57558a7 Implement i32.rem_s and i32.rem_u intrinsic (#1789) 2022-12-20 14:37:07 +08:00
Huang QiandGitHub d827315122 Enable XIP in CI daily test (#1793) 2022-12-13 11:32:35 +08:00
Huang QiandGitHub ef4e795dba Implement i32.div_s (#1792) 2022-12-13 10:48:51 +08:00
Huang QiandGitHub f6bef1e604 Implement i32.rem_s and i32.rem_u intrinsic (#1789) 2022-12-08 09:38:20 +08:00
Huang QiandGitHub 371310fdee Dump more info when spec test fails with XIP mode (#1779) 2022-12-05 10:00:50 +08:00
Huang QiandGitHub a29344ae6c Enable spec test on nuttx and daily run it (#1763)
- Spec test needs about 15 min
- Skip some test cases that cannot pass now, most of which are FP relative
  (due to potential bugs in NuttX's libc)
2022-12-02 12:39:46 +08:00
Huang QiandGitHub 9c5e1cb600 wamr-test-suites: Add support for ARM/RISCV by QEMU (#1704)
Enhance wamr-test-suites to add QEMU and Firmware options:
`./test_wamr.sh -Q <qemu> -F <firmware>`
2022-11-28 10:45:32 +08:00
Huang QiandGitHub 93d3d09aa1 Clear some warnings and enable -Werror for NuttX (#1756) 2022-11-28 09:44:33 +08:00
Huang QiandGitHub 0456043d8d Fix missing intrinsics for risc-v which were reported by spec test (#1750) 2022-11-25 09:20:38 +08:00
Huang QiandGitHub 4e5ba6f6ef Fix issue of thumb relocation R_ARM_THM_MOVT_ABS (#1723) 2022-11-19 19:36:02 +08:00
Huang QiandGitHub b5efadf205 nuttx: Enable ref types by Kconfig (#1711) 2022-11-17 11:56:59 +08:00
Huang QiandGitHub 4b0660cf24 Fix missing float cmp for XIP (#1699) 2022-11-14 11:58:38 +08:00
Huang QiandGitHub 810007857b wamr-test-suites: Update runtest.py to support python3 (#1684)
Update runtest.py of wamr-test-suites to support both python2 and python3
2022-11-07 14:16:10 +08:00
Huang QiandGitHub 4b6e4e1732 Correct the arch name for armv7a on NuttX (#1678) 2022-11-03 21:54:05 +08:00
Huang QiandGitHub c8cacbd883 Add LLVM_BUILD_OP_OR_INTRINSIC to avoid code dup (#1672) 2022-11-03 11:48:48 +08:00
Huang QiandGitHub 94cecbe4cb Fix XIP issues of fp to int cast and int rem/div (#1654) 2022-11-01 20:29:07 +08:00
Huang QiandGitHub 4a1e522c53 Move indirect mode optimization to the last of LLVM pipelines (#1627)
The general optimizations may create some intrinsic function calls
like llvm.memset, so we move indirect mode optimization after them
to remove these function calls at last.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-10-24 10:20:05 +08:00
Huang QiandGitHub 73809efb5d Fix XIP issue caused by rem_s on RISC-V (#1619) 2022-10-19 16:46:26 +08:00
Huang QiandGitHub 86d3f30600 Implement R_ARM_THM_MOVT_[ABS|REPL] for thumb (#1615) 2022-10-19 06:08:51 +08:00
Huang QiandGitHub d7c2e9a6ea Fix NuttX CI break by install missing dependencies (#1532) 2022-09-29 12:31:56 +08:00
Huang QiandGitHub bbea005db6 Make libc-builtin buffered printf be a common feature (#1483)
Add macros to control whether to use the libc-builtin buffered printf
and the buffer size.
2022-09-15 15:09:01 +08:00
Huang QiandGitHub 8fcc556e50 ci: Cover more configurations & targets on NuttX (#1448)
Enable building iwasm on Nuttx for target:
* x86
* cortex-m0
* cortex-m4
* cortex-m7
* rv32imac
* rv64imac
* rv64gc
2022-09-05 12:12:32 +08:00
Huang QiandGitHub 531a011700 Move WASM_ENABLE_SPEC_TEST to correct place (#1447)
Fix compilation warning:
```
wamr/product-mini/platforms/nuttx/../posix/main.c:622:5: warning: "WASM_ENABLE_SPEC_TEST" is not defined, evaluates to 0 [-Wundef]
  622 | #if WASM_ENABLE_SPEC_TEST != 0
```

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-09-03 08:18:45 +08:00
Huang QiandGitHub c56fd8bd5b Introduce basic CI for nuttx (#1444) 2022-09-02 11:07:59 +08:00
Huang QiandGitHub c64186b704 Fix potential warning of printf in main.c of posix and windows (#1440) 2022-09-01 14:11:00 +08:00
Huang QiandGitHub 77c516ac80 Add a new API to get free memory in memory pool (#1430) 2022-08-31 16:39:25 +08:00
Huang QiandGitHub 2178787664 Implement i64.div and i64.rem intrinsics (#1375) 2022-08-12 11:09:06 +08:00
Huang QiandGitHub 88cf1e36c1 Support custom stack guard size (#1368)
Add a new option WAMR_BUILD_STACK_GUARD_SIZE to set the custom
stack guard size. For most RTOS systems, we use the native stack base
address as the check boundary which may be not safe as POSIX based
systems (like Linux).
2022-08-12 10:17:11 +08:00
Huang QiandGitHub 2ee01657a6 Add semaphore support for NuttX (#1367) 2022-08-09 19:35:16 +08:00
Huang QiandGitHub f3f8d684b3 Implement POSIX semaphore support for linux platform (#1345)
Implement POSIX semaphore support for linux platform
2022-08-08 19:59:46 +08:00
Huang QiandGitHub 0065743075 Correct DPFPU and FPU handling for NuttX (#1027)
Since DPFPU depends on FPU, if FPU is enabled we will never enter DPFPU
branch since `ifeq (${CONFIG_ARCH_FPU}, y)` is always true.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-03-08 13:31:38 +08:00
Huang QiandGitHub 44d75cec3c Ignore .cache used by clangd (#1018)
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

> And another question, I got many warnings while compiling wamr by clang like:
> 
> ```
> [10/67] Building C object CMakeFiles/vmlib.dir/home/huang/Work/wasm-micro-runtime/core/iwasm/common/wasm_exec_env.c.o
> In file included from /home/huang/Work/wasm-micro-runtime/core/iwasm/common/wasm_exec_env.c:6:
> In file included from /home/huang/Work/wasm-micro-runtime/core/iwasm/common/wasm_exec_env.h:11:
> /home/huang/Work/wasm-micro-runtime/core/iwasm/common/../interpreter/wasm.h:573:53: warning: unused parameter 'type_count' [-Wunused-parameter]
> wasm_get_smallest_type_idx(WASMType **types, uint32 type_count,
>                                                     ^
> 1 warning generated.
> [15/67] Building C object CMakeFiles/vmlib.dir/home/huang/Work/wasm-micro-runtime/core/iwasm/common/wasm_application.c.o
> In file included from /home/huang/Work/wasm-micro-runtime/core/iwasm/common/wasm_application.c:8:
> In file included from /home/huang/Work/wasm-micro-runtime/core/iwasm/common/../interpreter/wasm_runtime.h:9:
> /home/huang/Work/wasm-micro-runtime/core/iwasm/interpreter/wasm.h:573:53: warning: unused parameter 'type_count' [-Wunused-parameter]
> wasm_get_smallest_type_idx(WASMType **types, uint32 type_count,
>                                                     ^
> 1 warning generated.
> ```
> 
> It can be fixed simply by -Wno-unused-parameter, but should we fix it by `UNUSED(xxx)` manually ?

It would be great to fix these warnings, but it really takes efforts.
2022-02-23 11:21:14 +08:00
Huang QiandGitHub c2d041ce94 Improve riscv target option compatibility for NuttX (#987)
Improve riscv target option compatibility for NuttX

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: I100793e0f00e7e4929e295c4bb1ef1ec21d83fe9
2022-01-28 09:13:41 +08:00
Huang QiandGitHub 2c743dbd51 Add log info for heap and stack like wasm loader in aot loader (#968)
Add log info for heap and stack like wasm loader in aot loader

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: I349848d75f1a26cde29217c14cfb6e779c976a8b
2022-01-19 08:55:59 +08:00
Huang QiandGitHub e0511fe822 Correct stack base calculation on Mac and NuttX (#963)
The return address of pthread_get_stackaddr_np() in MacOS and NuttX
may be the base address or the end (boundary) address of the native stack,
if it is the end address, we get the base address according to it and the
stack size, so as to get the actual stack boundary address correctly.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-17 20:45:55 +08:00
Huang QiandGitHub 9d2576d8e0 Wrap data width according to atomic opcode specified (#936)
Wrap data width according to atomic opcode specified

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-06 11:43:34 +08:00
Huang QiandGitHub 9169eff8bb Remove hardcoded stack size in thread_manager.c (#931)
Remove hardcoded stack size in thread_manager.c

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-05 13:16:25 +08:00
Huang QiandGitHub 4cc4625a2b Cleanup output format warnings (#904)
Use `PRIxxx` related macros to format the output strings so as to clear
compile warnings, e.g. PRIu32, PRId32, PRIX32, PRIX64 and so on.
And add the related macro definitions in platform_common.h if they
are not defined, as some compilers might not support them.
2021-12-20 15:51:36 +08:00
Huang QiandGitHub a41c1ad85c Don't use constant float table on arm and riscv (#903)
Don't use constant float table on arm and riscv as LLVM doesn't generate
.LPCI/.rodata like relocations on them, the float/double constants are encoded
into instructions directly, so no need to lookup them from constant table.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-12-20 11:10:52 +08:00
Huang QiandGitHub 915b26b0ec Remove hardcoded stack size while creating pthread (#881)
Use original module instance's default_wasm_stack_size instead,
which is the stack size used to instantiate it.
2021-12-10 15:11:45 +08:00
Huang QiandGitHub 208cafc776 Add new E_TYPE_XIP to indicate XIP mode (#874)
Emit e_type = E_TYPE_XIP in target info section to indicate that it is
an XIP file, and replace related checks in aot loader.
2021-12-08 18:43:08 +08:00
Huang QiandGitHub c8fe1004aa Don't throw exception while module_malloc failed (#860)
Don't throw exception when module_malloc memory failed:
- Exception will terminate the wasm app, it's not necessary since app can
  check the result of dynamic allocation and do some cleanup or fallback
  operation on failure instead of 'crash' directly.
- In acquire_wait_info, call hasn_map_find only when the address isn't NULL,
  or there are many senseless error logs
2021-12-03 17:00:18 +08:00
Huang QiandGitHub 8d1c56bda4 Implement atomic and memset/memmove/memcpy intrinsic for riscv (#841)
- Lower aotmic instruction to non-atomic form on some platforms
- Lower memset/memmove/memcpy for XIP
- Disable rtti in cmake
2021-11-30 17:10:14 +08:00
Huang QiandGitHub 0af7522e3e Fix fail to get builtin functions in indirect call (XIP) mode (#829)
Fix fail to get builtin functions in indirect call (XIP) mode, e.g.
function aot_alloc_frame, aot_memory_init, aot_table_init and so on.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-11-11 14:14:21 +08:00
Huang QiandGitHub 3fa91df754 Simplify some string size calculation when emitting AOT file (#813)
Simplify some string size calculation when emitting AOT file

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-11-01 20:03:13 +08:00
Huang QiandGitHub 51a00a4c2b Disable source debugging by default (#804)
For cmake based project, there are default values in .cmake,
but for other build system, may these symbols were not defined in their
build system and warnings (XXX is not defined) were generated while building.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-10-26 18:52:30 +08:00
Huang QiandGitHub a121e45a1e Simplify build setup for zephyr (#789)
Zephyr can apply board specific .conf and .overlay automatically,
move .conf to boards to make it easy to support different board without
addition command parameters.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-10-15 20:15:17 +08:00
Huang Qi b31804b64e Apply aot intrinsics to riscv
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: If1e813f5f8ead2c0d9b640f8ea4e87e2155db534
2021-09-09 07:59:12 +00:00