Commit Graph

47 Commits

Author SHA1 Message Date
Huang Qi
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 Qi
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
Wenyong Huang
5547924e28
Refine codes and fix several issues (#882)
Refine some codes in wasm loader
Add -Wshadow to gcc compile flags and fix some variable shadowed issues
Fix function parameter/return types not checked issue
Fix fast-interp loader reserve_block_ret() not handle V128 return type issue
Fix mini loader load_table_segment_section() failed issue
Add detailed comments for argc argument in wasm_runtime_call_wasm()
2021-12-10 18:13:17 +08:00
Javan
788e14ed6c
Enable emitting custom name section to aot file (#794)
Enable emitting custom name section to aot file when adding
`--enable-dump-call-stack` or `--enable-dump-call-stack` to
wamrc and there is custom name section in wasm file, which
can be generated by wasi-sdk/emcc "-g" option. So aot runtime
can also get the function name from the custom name section
instead of export section,  to which developer should use
`--export-all` for wasi-sdk/emcc to generate export function
names.
2021-10-26 16:32:52 +08:00
Wenyong Huang
6415e1b006
Apply clang-format for interpreter source files (#772)
And update source debugging document.
2021-10-08 11:44:39 +08:00
Wenyong Huang
ed32693fc8
Fix calling multi-module import func issue (#748)
Before calling import function of sub module inst in multi-module mode,
we should copy the arguments to output area by using the func inst of
sub module inst but not func inst of current module inst.
2021-09-14 11:28:44 +08:00
Wenyong Huang
541f577164
Implement wasm_runtime_init_thread_env for Windows platform (#683)
Implement wasm_runtime_init_thread_env() for Windows platform by calling os_thread_env_init(): if current thread is created by developer himself but not runtime, developer should call wasm_runtime_init_thread_env() to init the thread environment before calling wasm function, and call wasm_runtime_destroy_thread_env() before thread exits.
And clear compile warnings for Windows platform, fix compile error for AliOS-Things platform

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-08-03 10:49:50 +08:00
Wenyong Huang
7cdfc9fe11
Fix issues reported by gcc -fsanitize flag (#678)
And refine some coding styles, fix JIT compiler data wasm table create issue, add license header for some files.
2021-07-30 15:21:17 +08:00
Huang Qi
e4023c8e02
Implement AOT support for RISCV (#649)
Enable RISCV AOT support, the supported ABIs are LP64 and LP64D for riscv64, ILP32 and ILP32D for riscv32.
For wamrc:
    use --target=riscv64/riscv32 to specify the target arch of output AOT file,
    use --target-abi=lp64d/lp64/ilp32d/ilp32 to specify the target ABI,
    if --target-abi isn't specified, by default lp64d is used for riscv64, and ilp32d is used for riscv32.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Co-authored-by: wenyongh <wenyong.huang@intel.com>
2021-07-22 11:16:47 +08:00
Wenyong Huang
ea06c19a9d
Implement wasm-c-api wasm_config related APIs (#665)
And add wasm_engine_new_with_args() declaration in wasm_c_api.h
Fix wasm-c-api frame func_offset issue in fast interp mode
Remove sanitize compiler flag in product-mini linux CMakeLists.txt
2021-07-15 10:47:40 +08:00
Wenyong Huang
cba4c78273
Enable call wasm-c-api native func directly from interpreter (#656)
And update loader error messages for latest spec cases, fix aot compiler build error based on latest LLVM code base.
2021-06-28 11:59:49 +08:00
Wenyong Huang
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
Wenyong Huang
77c3ddf7d0
Implement aux stack overflow/underflow check for AOT/interp (#601) 2021-04-07 03:15:59 -05:00
Wenyong Huang
7db2221ad9
Re-org address unalignment access for fast-interp (#597)
And clear some compile warnings on wasm loader, add ${UV_A_LIBS} for some CMakeLists.txt.
2021-04-01 16:50:46 +08:00
Wenyong Huang
e9e75a6b09
Fix interpreter not update memory size after call native func (#563)
The native function might call wasm function exported, in which the memory.grow opcode might be executed, and interpreter should update memory size after that, or load/store opcodes may run failed with "out of bounds memory access" exception thrown.

Update tensorflow sample patch, allow tensorflow wasm app to grow memory so as to run more models. And fix some compile issues of littlevgl zephyr sample for latest zephyr source code.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-03-10 15:07:16 +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
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
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
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
lum1n0us
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
Xiaokang Qin
c83a5713f9
Add the fast-interp tail call support (#409)
And also fix one bug in loader for tail-call

Signed-off-by: Xiaokang Qin <xiaokang.qxk@antgroup.com>
2020-09-29 10:35:10 +08:00
Xu Jun
c13746c22c
move memory_data out from MemoryInstance, add call stack (#408) 2020-09-28 18:38:15 +08:00
Xiaokang Qin
a70daed17d
Add the tail-call feature support for classic-interp (#401)
* Add the tail-call feature support for classic-interp

Signed-off-by: Xiaokang Qin <xiaokang.qxk@antgroup.com>

* add CI for tail call and custom name section

* add CI for tail call and custom name section

* update CI for mac

Co-authored-by: Xu Jun <693788454@qq.com>
2020-09-24 12:38:54 +08:00
Wenyong Huang
e501a6963b
Fix some coding style issues, fix doc typo and refine some codes (#392) 2020-09-20 08:20:45 +08:00
Xu Jun
0226dbbb3d
introduce WAMR memory profiling tool (experimental) (#390) 2020-09-18 18:04:56 +08:00
Wenyong Huang
0103f6429c
Refactor error/exception strings to reduce binary size (#359) 2020-08-21 15:11:31 +08:00
Wenyong Huang
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
Xu Jun
6aeefbebb2
implement atomics opcodes for interpreter (#344) 2020-08-10 19:43:58 +08:00
Wenyong Huang
056b824ac4
Fix fast interpreter i64 shift issue for non-x86 arch (#319) 2020-07-28 13:46:37 +08:00
Xu Jun
32b2943369
enable pthread for AoT && update AOT current version to 2 (#311) 2020-07-16 20:35:04 +08:00
Weining
1a85051415
Implement multi-value feature and import binarydump tool (#308) 2020-07-10 16:29:15 +08:00
wenyongh
847dccaa34
Refine get/set global opcodes for interpreter (#294) 2020-06-29 14:17:27 +08:00
wenyongh
ee315e4049
Implement memory access bound check with hardware trap for 64-bit platforms (#293)
Also implement native stack overflow check with hardware trap for 64-bit platforms
Refine classic interpreter and fast interpreter to improve performance
Update document
2020-06-28 15:41:25 +08:00
Xu Jun
d98ab63e5c
Enable shared memory && add pthread support (#282) 2020-06-15 19:04:04 +08:00
wenyongh
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
wenyongh
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
wenyongh
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
wenyongh
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
wenyongh
c1a0e6d877
Implement register/call native API with raw (unextracted) arguments (#222) 2020-04-01 12:52:08 +08:00
yzha107
e07381c4a8
Fix a WASM_OP_SET_LOCAL type check issue (#205) 2020-03-20 13:28:18 +08:00
wenyongh
c6042c45a3
Sync with internal feature (#204) 2020-03-18 17:49:23 +08:00
Xu Jun
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
wenyongh
751a3b5865
Enhance interpreter performance (#196) 2020-03-12 08:59:02 +08:00
Weining
aa42335a4e
minor changes (#195) 2020-03-11 13:49:52 +08:00
wenyongh
0fdd49ea31
Re-org memory allocation interfaces, add --stack-size and --heap-size option (#193) 2020-03-10 19:54:44 +08:00
Xu Jun
381859d530
fix unaligned 64bit access on MCU (#192) 2020-03-10 11:48:28 +08:00
Xu Jun
057c849fc0
re-org bh_definition.c && introduce wamr fast interpreter (#189)
Co-authored-by: Xu Jun
2020-03-07 22:20:38 +08:00