Commit Graph

51 Commits

Author SHA1 Message Date
b554a9d05d Implement wasm-c-api frame/trap APIs for interpreter mode (#660)
And enable to cache compiled AOT file buffer for wasm-c-api JIT mode
Avoid checks that rely on undefined C behavior
Fix issues of wasm-c-api sample trap and callback_chain

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-07-06 17:05:59 +08:00
c6783ef258 IO: support populate fds into WASM application (#655)
Add new API wasm_runtime_set_wasi_args_ex to support populate stdio fds

Signed-off-by: LiFeng <lifeng68@huawei.com>
2021-06-22 14:41:49 +08:00
ba922b0d0d Refine the wasm-c-api native func call process of aot mode (#640) 2021-05-26 20:57:30 +08:00
684d766e2b Refine aot call func procedure and fix zephyr timer overflow issue (#617)
1. Refine the aot call function procedure

2. fix timer integer overflow issue on zephyr platform

3. move wasm_exec_env_set_thread_info into lower layer
2021-04-19 21:06:56 +08:00
03d45f1d62 Import reference-types feature (#612)
Implement spec reference-types proposal for interpreter, AOT and JIT, update documents and add sample. And upgrade AOT_CURRENT_VERSION to 3 as AOT file format and AOT module instance layout are changed.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-04-15 11:29:20 +08:00
09eb858a02 add realloc wrapper, fix pthread_join overwrite issue (#605) 2021-04-09 15:27:12 +08:00
77c3ddf7d0 Implement aux stack overflow/underflow check for AOT/interp (#601) 2021-04-07 03:15:59 -05:00
22bcfe204e fix aux stack overwritten issue when lib-pthread is enabled (#596) 2021-04-01 15:07:00 +08:00
02d27e13ee Fix some compilation warnings and enable Windows JIT (#586) 2021-03-22 19:28:51 +08:00
b06ae7272f Remove heap size check when creating wasi ctx (#565)
Remove check for heap_size==0 when creating wasi ctx, as the related data structures are allocated from global heap instead of app heap now, so it also works when app heap isn't created.
Also add v128 type for Windows so as to fix wamrc compilation error in Windows platform.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-03-10 16:25:07 +08:00
fe76ce3b68 Update global initialization process for latest spec cases (#553) 2021-03-02 18:24:15 +08:00
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
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
da8c879953 Implement riscv support for interpreter (#505) 2021-01-25 18:41:48 +08:00
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
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
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
a84d51271c Support AssemblyScript's new/retain/release APIs (#460) 2020-12-07 16:37:49 +08:00
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
91b9458ebd Add more checks to enhance app heap's security (#428) 2020-10-22 18:52:33 +08:00
4787b150b8 Enable multi-module support for wasm-c-api (#426)
it is allowed that all imported functions and globals can be
linked by multi-module feature automatically or by wasm-c-api manually
2020-10-16 17:43:57 +08:00
c13746c22c move memory_data out from MemoryInstance, add call stack (#408) 2020-09-28 18:38:15 +08:00
0bf7f7310b Add NULL check for memory inst in aot/wasm module malloc/free (#403)
* Add NULL check for memory page in aot/wasm module malloc/free

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

* Update aot_runtime.c

* Update wasm_runtime.c

Co-authored-by: Huang Qi <huangqi3@xiaomi.com>
Co-authored-by: Wenyong Huang <wenyong.huang@intel.com>
2020-09-28 12:44:23 +08:00
e501a6963b Fix some coding style issues, fix doc typo and refine some codes (#392) 2020-09-20 08:20:45 +08:00
0226dbbb3d introduce WAMR memory profiling tool (experimental) (#390) 2020-09-18 18:04:56 +08:00
2135badc54 fix problem in wasm_module_malloc (#374) 2020-09-07 17:32:00 +08:00
034606b0a9 Change wasm app offset type from int32 to uint32 (#361)
And fix some sign/unsigned conversion compilation warnings.
2020-08-26 18:33:29 +08:00
0103f6429c Refactor error/exception strings to reduce binary size (#359) 2020-08-21 15:11:31 +08:00
89d2937cde Refactor app heap and memory boundary check, and fix os_printf compilation error (#356)
Insert app heap before __heap_base, or before new page
Fix os_printf compilation error in some platforms
2020-08-20 12:43:12 +08:00
6aeefbebb2 implement atomics opcodes for interpreter (#344) 2020-08-10 19:43:58 +08:00
08d01b65c5 Eable post-MVP feature wasm-c-api (#315) 2020-07-23 16:54:13 +08:00
32b2943369 enable pthread for AoT && update AOT current version to 2 (#311) 2020-07-16 20:35:04 +08:00
1a85051415 Implement multi-value feature and import binarydump tool (#308) 2020-07-10 16:29:15 +08:00
d98ab63e5c Enable shared memory && add pthread support (#282) 2020-06-15 19:04:04 +08:00
7a287fd1a9 Implement wasm mini loader and refine footprint of loader and runtime (#276) 2020-06-08 11:19:09 +08:00
752826a667 Implement multi-module feature and bulk-memory feature (#271)
Refine wasm loader and aot loader
Fix potential issue of os_mmap/os_munmap
Update document
2020-06-02 14:53:06 +08:00
a0bb761beb Update API comments, refine footprint of wasm loader (#256)
and fix issues of get native stack boundary
2020-05-15 17:44:36 +08:00
44ccfd20ad Fix issue of condition settings of app boundary check (#249) 2020-05-08 13:34:07 +08:00
e8e45aeecd Refine aot stack overflow check and enhance wasm loader malformed checks (#248)
And separate global data from wasm memory instance
2020-05-08 12:38:59 +08:00
d381b0fdec Implement post-MVP features and native stack overflow check (#243)
Implement native thread stack overflow check
Implement post-MVP: Non-trapping float-to-int conversions
Implement post-MVP: Sign-extension operators
Enhance WASM loader checks
2020-04-30 17:52:11 +08:00
f72e848114 Refine aot memory boundary check, add more llvm passes (#236)
Fix issue of some error info mismatch with spec cases
2020-04-22 18:43:50 +08:00
b40e79c160 Make heap and linear memory contiguous to refine compilation time and footprint (#233)
Use FastISel for JIT mode
Use united aot version in aot file and aot runtime
Disable check signature failed warning for wamrc
Fix fast interpreter x86_32 float issue
Remove unused empty lvgl folder
2020-04-13 10:49:40 +08:00
5e196253f6 Fix function type not set issue of aot_call_indirect (#229)
Add registration of libc-wasi to 'wasi_snapshot_preview1' to support cargo-wasi
change zephyr build method from cmake to west
fix problem when preserve space for local vars
fix wasi authority problem
2020-04-07 11:04:46 +08:00
f1a0e75ab7 re-org platform APIs, simplify porting process (#201)
Co-authored-by: Xu Jun <jun1.xu@intel.com>
2020-03-16 16:43:57 +08:00
0fdd49ea31 Re-org memory allocation interfaces, add --stack-size and --heap-size option (#193) 2020-03-10 19:54:44 +08:00
180ee4c78a Add realloc func argument for memory allocator (#191) 2020-03-08 21:18:18 +08:00
057c849fc0 re-org bh_definition.c && introduce wamr fast interpreter (#189)
Co-authored-by: Xu Jun
2020-03-07 22:20:38 +08:00
0d3f304191 Implement native function pointer check, addr conversion and register, update documents (#185)
Modified WASM runtime API:
- wasm_runtime_module_malloc()
- wasm_runtime_lookup_function()
Introduced runtime API
- wasm_runtime_register_natives()
2020-03-04 20:12:38 +08:00
e62bbeb9e8 Refine wasm loader and interpreter, enhance wamrc to support SGX (#167)
Former-commit-id: 76f4a121d3c2a67114414fc60e80eba4bf49aa8e [formerly b1ab47945a40e6b249c9aa205d61281301585ea6]
Former-commit-id: 8e5c6e895eae22051a79a8d337a87cd2f431b6bc
2020-02-18 15:15:24 +08:00
256ecdfdf9 Refine interpreter to improve performance, refine memory usage (#161) 2020-02-10 12:36:45 +08:00