Commit Graph

491 Commits

Author SHA1 Message Date
Wenyong Huang
a1568825e8
Enable to use BH_VPRINTF macro to redirect stdout output (#560)
Enable to use BH_VPRINTF macro for platform Linux/Windows/Darwin/VxWorks to redirect the stdout output from platform os_printf/os_vprintf, or the wasi output from wasm app to the vprintf like callback function specified by BH_VPRINTF macro of cmake WAMR_BH_VPRINTF variable.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-03-06 22:29:58 +08:00
Wenyong Huang
a4239f1ffd
Enable SIMD by default for wamrc and iwasm (#559)
Enable SIMD by default for wamrc on x86-64 target, for iwasm on platform Linux and Darwin. And update build wamr document, fix app manager compile warning.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-03-06 21:30:14 +08:00
Wenyong Huang
54e82ec439
Fix app manager fail to install large app file issue (#555)
Remove the limit of app file size no larger than 1 MB, fix possible memory leak issues when fail to install app file, change message size of aee_host_msg_callback() from uint16 type to uint32 type to fix possible integer overflow issue, and fix some coding style issues of app manager.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-03-03 20:19:24 +08:00
Wenyong Huang
fe76ce3b68
Update global initialization process for latest spec cases (#553) 2021-03-02 18:24:15 +08:00
Wenyong Huang
686733170c
Enhance ems memory allocator (#544)
The total size actually allocated by ealloc_hmu() might be larger than the size required to allocate, we reset the total size after allocating, so that if heap verification feature is enabled, the data to verify can be written to the right place of the suffix verification area. And in gc_realloc_vo_internal(), free the heap lock until the original data is copied to new object to return.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-02-25 11:53:17 +08:00
Huang Qi
3cafb2f9c1
platforms/nuttx: Add FPU relative macro for thumb vfp (#541)
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

Co-authored-by: Huang Qi <huangqi3@xiaomi.com>
2021-02-24 10:03:43 +08:00
Jonathan
79afa493aa
Fix windows aot loader fail to resolve symbol issue (#540) 2021-02-23 20:55:50 +08:00
Xu Jun
fc50404115
add uvwasi implementation to support wasi on windows [experimental] (#534)
add uvwasi implementation to support wasi on windows [experimental] and update windows.yml

Co-authored-by: Wenyong Huang <wenyong.huang@intel.com>
2021-02-22 14:17:46 +08:00
Xu Jun
370cc83fbd
Fix loader fail to lookup registered native symbol issue (#529) 2021-02-19 11:14:40 +08:00
Wenyong Huang
3849ece496
Fix auxiliary stack size not 16-byte aligned issue (#524) 2021-02-10 10:11:32 +08:00
Xu Jun
52f422dba0
fix pthread library issues: (#522)
1. pthread_join can't get return value from exited threads
2. pthread_cond_wait return success when timeout
2021-02-09 10:36:44 +08:00
Wenyong Huang
1630cb2524
Fix duplicated destroy shared memory's lock issue (#514)
And add native symbol node to list head when registering native symbol, so as to lookup developer's registered node firstly when linking.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-02-07 11:05:48 +08:00
Xu Jun
5947ea492d
Update invokeNative_em64.asm (#511)
Fix the issue of WIN64 parameter passing
2021-02-04 08:50:15 +08:00
Wenyong Huang
a5188f5574
Add checks to avoid wasm_runtime_malloc memory with size 0 (#507)
In some platforms, allocating memory with size 0 may return NULL but not an empty memory block, which causes runtime load, instantiate or execute wasm/aot file failed. We add checks to try to avoid allocating memory in runtime if the size is 0. And in wasm_runtime_malloc/free, output warning if allocate memory with size 0 and free memory with NULL ptr.
Also fix some coding style issues, fix handle riscv32 ilp32d issue, and fix several wasm-c-api issues.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-01-28 16:16:02 +08:00
Wenyong Huang
efd648959c
Update README.md 2021-01-25 18:43:44 +08:00
Wang Ning
da8c879953
Implement riscv support for interpreter (#505) 2021-01-25 18:41:48 +08:00
Huang Qi
4c9cb30ed9
Auto detect host platform for wamr-compiler (#504)
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

Co-authored-by: Huang Qi <huangqi3@xiaomi.com>
2021-01-22 10:01:44 +08:00
Huang Qi
ee217d5af1
Add some missing intrinsic symbols for thumb ISA (#503)
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

Co-authored-by: Huang Qi <huangqi3@xiaomi.com>
2021-01-21 16:07:07 +08:00
alvkeke
6847e15f64
Fix failed in loading wasm byte-code if return NULL while size == 0 in os_malloc (#500) 2021-01-18 13:24:10 +08:00
Wenyong Huang
240ca2ed46
Implement performance profiler and call stack dump, and update toolchain document (#501)
And remove redundant FAST_INTERP macros in wasm_interp_fast.c, and fix wamrc --help wrong line order issue.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-01-18 13:23:10 +08:00
alvkeke
794028a968
1. fix error while building project with RT-Thread Studio. (#497)
2. add macro to enable/disable export native method of rt-thread.
2021-01-14 18:47:52 +08:00
alvkeke
8ec03a5165
add porting codes of rt-thread (#494) 2021-01-14 11:26:35 +08:00
Wenyong Huang
8a477786f1
Remove unused block_addr_cache buffer in wasm loader (#493)
And fix possible memory leak issue in aot loader when apply relocation failed.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-01-08 19:11:12 +08:00
Wenyong Huang
788cbf2a19
Refine aot call_indirect opcode translation (#492)
Re-implement aot call_indirect opcode translation: when calling non-import function, translate it by LLVM call IR to call the function in AOTed code, so as to avoid calling runtime aot_call_indirect API which is much slower. For import function, keep calling aot_call_indirect API due to the possible pointer/string argument conversion.

And add prompt info while app heap is corrupted, change emit_leb to emit_uint32 inter fast-interp to refine footprint.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-01-05 18:05:30 +08:00
Javan
f2a63d8623
Fix aot bh_assert failed issue on darwin platform x86_64 target (#476) (#488)
Modify the macro control sentences as darwin platform doesn't support mmap with MAP_32BIT flag to put the mapping address into 0-2G range.

Co-authored-by: Wenyong Huang <wenyong.huang@intel.com>
2020-12-30 21:01:36 +08:00
Xiaokang Qin
6c967b71f1
Fix two issues for wasm-c-api (#487)
Fix incorrect func_type unpacking for results
Fix crash for multiple instance usage due to wrong size provided

Signed-off-by: Kanghua Yu <kanghua.ykh@antgroup.com>
Signed-off-by: Xiaokang Qin <xiaokang.qxk@antgroup.com>

Co-authored-by: Kanghua Yu <kanghua.ykh@antgroup.com>
2020-12-30 13:37:19 +08:00
Wenyong Huang
365ec6360b
Update build scripts and documents of workload samples for wasi-sdk-12.0 (#484)
Update the build scripts of sample workloads (meshoptimizer/bwa/wasm-av1) to use the wasi-sdk-12.0 firstly to build the workload and discard clang-11, as wasi-sdk-12 supports wasi, simd and pthread better. And update the related documents.
Also modify wasm mini loader to sync up with the change of wasm normal loader.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2020-12-29 14:41:09 +08:00
Wenyong Huang
724858c731
Update wasm app build scripts for wasi-sdk-12 and refine interpreter (#481)
Update wasm app build scripts for wasi-sdk-12.0: add --export=__main_argc_argv, remove --no-threads
Lookup function with name "__main_argc_argv" as main function besides "main"
Change module_malloc to runtime_malloc in wasi native lib
Refine classic interpreter op_block and op_br_table
Refine faster interpreter op_br_table

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2020-12-28 10:46:31 +08:00
Max Desiatov
13f0b2485b
Update darwin CMakeLists.txt to support Apple Silicon on macOS (#480)
Without this change in a corresponding `CMakeLists.txt` it attempts to build `invokeNative` assembly for `X86_64` on Macs with Apple Silicon.

Co-authored-by: Wenyong Huang <wenyong.huang@intel.com>
2020-12-27 12:16:46 +08:00
Max Desiatov
50f9a3e340
NFC: fix typo in invokeNative_aarch64.s comment (#479)
`inteter` -> `integer`
2020-12-26 09:45:11 +08:00
Yuta Saito
cb0e593c15
Remove debris tlsf in git repo (#475) 2020-12-21 18:24:14 +08:00
Wenyong Huang
adb05ea719
Enable SIMD support for Linux SGX platform (#474) 2020-12-21 15:17:36 +08:00
Yuta Saito
a2294877f5
Fix struct stat fields for darwin (#473)
Darwin doesn't support POSIX compatible stat fields when -fmodule
2020-12-21 10:56:33 +08:00
Wenyong Huang
ad35c3c21b
Implement SIMD float ceil/floor/trunc/nearest opcodes (#472)
Implement SIMD f32x4/f64x2 ceil/floor/trunc/nearest opcodes

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2020-12-16 15:33:25 +08:00
Wenyong Huang
16e6f41b3a
Fix wamr compiler issues and refine some error messages (#470)
Fix potential memory leak issue when using llvm::EngineBuilder().selectTarget()
Fix issue of accessing aot_value's fields after it is freed
Fix JIT not print failed to link import warning
Change some error messages: 'fail to' to 'failed to'
Update error message when SIMD isn't enabled
Fix install littlevgl wasm app of wasi version failed

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2020-12-15 13:05:39 +08:00
Huang Qi
619c2b383c
product-mini/nuttx: Use readline for repl mode (#469)
The EOL of NuttX is configurable (CR/LF/CRLF), the implementation
of getline in NuttX need CR or LF as line delimiter(CRLF not supported).
Then we should use readline for better compatibility.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

Co-authored-by: Huang Qi <huangqi3@xiaomi.com>
2020-12-11 19:48:35 +08:00
Huang Qi
7f4e519edc
product-mini/nuttx: Add support for repl mode (#466)
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

Co-authored-by: Huang Qi <huangqi3@xiaomi.com>
2020-12-09 16:45:41 +08:00
Huang Qi
35acc7f336
platform/NuttX: Add support for lib pthread (#463)
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

Co-authored-by: Huang Qi <huangqi3@xiaomi.com>
2020-12-08 17:44:08 +08:00
Huang Qi
b75224ce03
Using posix thread implementation for NuttX (#462)
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

Co-authored-by: Huang Qi <huangqi3@xiaomi.com>
2020-12-07 21:15:41 +08:00
Wenyong Huang
388530c738
Modify os_cond_reltimedwait to support long time wait (#461)
Modify the argument of os_cond_reltimedwait to uint64 type to support long time wait, and handle possible integer overflow.
2020-12-07 17:37:53 +08:00
Xu Jun
a84d51271c
Support AssemblyScript's new/retain/release APIs (#460) 2020-12-07 16:37:49 +08:00
Wenyong Huang
5176fe2595
Fix timer setTimeout issue and some coding style issues (#459) 2020-12-04 18:07:52 +08:00
Wenyong Huang
2f530e67fc
Fix app manager install atomics app issue and optimize workload scripts (#458) 2020-12-04 15:35:45 +08:00
sophy228
c8b0a1cee1
Fix some issues for Arm platform. (#457)
Motivation:
we found some issues during enable the WAMR on arm devices, such as relocation issues, stack alignment issues.

Proposed change:
We optimized the relocation process for arm platform, for relocation jump table, the SP should be aligned to 16 bytes. And we also make "getentropy" worked for other non-supported platform.
2020-12-02 10:22:55 +08:00
Wenyong Huang
591e4ce536
Refine aot exception throw, remove unnecessary labels (#456) 2020-11-30 17:57:22 +08:00
Wenyong Huang
0700dc9cd4
Fix wasi ctx memory free issue when app heap is corrupted (#455) 2020-11-30 17:00:53 +08:00
Wenyong Huang
282831eba5
Fix some compilation warnings and add esp-idf platform for experiment (#454)
And fix some code indent issues.
2020-11-30 16:03:51 +08:00
Karl Fessel
7d8b79a7a7
Addapt to RIOT changes (#452)
RIOT removed kernel_types.h in favor of sched.h
2020-11-27 09:10:00 +08:00
Wenyong Huang
0359805c82
Import FreeRTOS platform experiment codes for further development (#451) 2020-11-26 19:10:05 +08:00
Wenyong Huang
74be7a0b7c
Add more checks to enhance security (#446)
add more checks to enhance security
clear "wasi proc exit" exception before return to caller in wasm/aot call functions
fix memory profiling issue
change movdqa to movdqu in simd invokeNative asm codes to fix issue of unaligned address access
move setjmp/longjmp from libc-builtin to libc-emcc
fix zephyr platform compilation issue in latest zephyr version
2020-11-24 14:00:09 +08:00