Commit Graph

236 Commits

Author SHA1 Message Date
Huang Qi
5d2882f05f
Make aot intrinsic flags readable (#711)
Make aot intrinsic flags easier to read and understand

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-09-01 18:24:16 +08:00
Huang Qi
6ef74778c7
Correct confusing usage of intirnsic check (#707) 2021-08-27 19:03:18 +08:00
YAMAMOTO Takashi
e80715f352
lib-pthread: Fix pthread_create callback arg issue (#701)
The last argument arg of pthread_create passed from wasm app is opaque
for the library and host, it should be returned back to the wasm app without
any interpretation. There is no point to translate it to a native address.
Actually it harms because the validation seems broken.
2021-08-19 18:21:56 +08:00
Huang Qi
6a7fd3e688
Make sp 8 byte aligned in invokeNative on ARM (#697)
Make sp 8 byte aligned in invokeNative assembly on ARM.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-08-18 10:21:38 +08:00
Wenyong Huang
db695fada4
Implement XIP feature and enable ARC target support (#694)
Implement XIP (Execution In Place) feature for AOT mode to enable running the AOT code inside AOT file directly, without memory mapping the executable memory for AOT code and applying relocations for text section. Developer can use wamrc with "--enable-indirect-mode --disable-llvm-intrinsics" flags to generate the AOT file and run iwasm with "--xip" flag. Known issues: there might still be some relocations in the text section which access the ".rodata" like sections.

And also enable ARC target support for both interpreter mode and AOT mode.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-08-12 17:44:39 +08:00
Huang Qi
8fd89bd415
Implement clock() wrapper for built-in libc (#691) 2021-08-07 21:21:25 +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
Wenyong Huang
edb184f709
Implement most missing wasm-c-api APIs (#303) (#676)
Remove unnecessary functions and implement more APIs:
- wasm_##name##same
- wasm##name##as_ref
- wasm_ref_as##name##
- wasm_ref_delete
- wasm_module_validate
- wasm_table_get/set/size
- wasm_memory_size
- wasm_config_new
- wasm_foreign_new

And add more wasm-c-api samples, update the related documen, add more CI rules.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-07-28 21:53:37 +08:00
Huang Qi
586752735b
Enable to build wamrc with custom llvm and fix some compile warnings (#672)
Enable to build wamrc with custom llvm, enable to auto detect processor on apple silicon, and fix some compile warnings.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-07-26 09:29:19 +08:00
Wenyong Huang
28f104036c
Fix some compile warnings and update document (#670)
And implement clock_gettime wrapper for libc-built.
2021-07-22 19:39:53 +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
0f1ce9ef3d
Implement wasm-c-api frame/trap APIs for AOT mode (#663)
And update CI workflow to build/cache llvm and run wasm-c-api samples.
2021-07-13 09:01:03 +08:00
Wenyong Huang
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
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
LiFeng
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
Wenyong Huang
77c71e559a
Add wasm-c-api nested function calls sample (#652)
And enable to copy back the return value of wasm main function when calling wasm_application_execute_main, add license headers in wasm-c-api samples, fix several issues reported by klocwork.
2021-06-16 15:26:28 +08:00
Wenyong Huang
1a4aa5ac2f
Enable multi-thread for tensorflow sample, update wasm-c-api document (#651) 2021-06-14 08:58:32 +08:00
Wenyong Huang
a5ffd656fa
Fix wasm-c-api trap message format issue (#644)
And fix two compile warnings.
2021-06-01 15:05:35 +08:00
YAMAMOTO Takashi
15dd651539
Fix os_cond_timedwait and other issues for NuttX sim/macOS (#562) 2021-05-31 09:56:47 +08:00
Wenyong Huang
ba922b0d0d
Refine the wasm-c-api native func call process of aot mode (#640) 2021-05-26 20:57:30 +08:00
Wenyong Huang
1b34606940
Move application entry APIs out of wasm_runtime_common.c (#639)
And fix libc-builtin print float issue
Add a list to track all third party components
Fix compile error when MEMORY_TRACING is enabled

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-05-26 13:22:03 +08:00
Xu Jun
f637438e4e
Spread module custom data to all threads, enable libc-builtin float print (#633) 2021-05-19 14:57:31 +08:00
Wenyong Huang
a14a4487bb
Re-org thread env init/destroy for HW bound check (#631)
And fix cmake_minimum_required() deprecation warning since envoy is using cmake 3.16 or higher version.
2021-05-14 11:13:12 +08:00
Wenyong Huang
17a2167485
Fix wasm-c-api JIT issue and update makefile (#630) 2021-05-13 15:13:52 +08:00
Wenyong Huang
64b5459066
Implement Windows thread/mutex/cond APIs to support multi-thread (#627)
Implement Windows thread/mutex/cond related APIs to support Windows multi-thread feature
Change Windows HW boundary check implementation for multi-thread: change SEH to VEH
Fix wasm-c-api issue of getting AOTFunctionInstance by index, fix wasm-c-api compile warnings
Enable to build invokeNative_general.c with cmake variable
Fix several issues in lib-pthread
Disable two LLVM passes in multi-thread mode to reserve volatile semantic
Update docker script and document to build iwasm with Docker image

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-05-11 16:48:49 +08:00
Wenyong Huang
9710d9325f
Fix wasm-c-api JIT mode issue and enable set LLVM_DIR in cmd line (#624) 2021-04-30 09:13:29 +08:00
Wenyong Huang
fa5f4fe940
Implement Windows boundary check with hardware trap (#623) 2021-04-27 17:18:27 +08:00
Wenyong Huang
eb29385963
Implement more wasm-c-apis and enable Envoy integration (#622)
Implement more wasm-c-api APIs to support Envoy integration:
- sync up with latest c-api definition
- change CMakeLists to export necessary headers and install the static library of iwasm
- enable to export tables and memories
- support memorytype and tabletype APIs
- update wasm-c-api sampels
- enable to export importtype APIs

And refine bazel scripts for sample XNNPACK workload, add license headers for sample simple.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-04-27 17:05:40 +08:00
Bao Haojun
a332a49a0d
Enable sample/simple for aarch64 (#616)
Fixed a typo in aot_reloc_aarch64.c.
Remove -m32 option in host tool CMakeLists.txt and change data type of structure fields to make host tool work in 64-bit.

Signed-off-by: Bao Haojun <baohaojun@lixiang.com>
2021-04-25 19:12:49 +08:00
Xu Jun
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
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
7706e4b151
Re-org SIMD code structure for non-x86 target (#611) 2021-04-13 15:23:22 +08:00
Xiaokang Qin
46db353017
Enable SIMD for AARCH64 Platform (#11) (#610)
Signed-off-by: Wu Zhongmin <zhongmin.wzm@antgroup.com>
Signed-off-by: Xiaokang Qin <xiaokang.qxk@antgroup.com>

Co-authored-by: Wu Zhongmin <zhongmin.wzm@antgroup.com>

Co-authored-by: Wu Zhongmin <zhongmin.wzm@antgroup.com>
2021-04-13 14:45:51 +08:00
Wenyong Huang
8b96f4fb71
Update sample workload's scripts to align with latest emcc (#609)
And enable auxiliary stack overflow/underflow check in JIT mode
2021-04-13 13:42:08 +08:00
Wenyong Huang
ee97618bdb
Fix llvm target vendor-sys-abi not correctly set issue on windows platform (#606) 2021-04-09 17:24:01 +08:00
Xu Jun
09eb858a02
add realloc wrapper, fix pthread_join overwrite issue (#605) 2021-04-09 15:27:12 +08:00
Wenyong Huang
dfe52ab42f
Fix compile warnings on windows platform: dll linkage and others (#604) 2021-04-09 14:55:58 +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
fe76c89c25
Fix aot code failed to run on darwin/android issue (#599) 2021-04-02 12:34:21 +08: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
Xu Jun
22bcfe204e
fix aux stack overwritten issue when lib-pthread is enabled (#596) 2021-04-01 15:07:00 +08:00
Wenyong Huang
5a13e1bbbc
Fix compile warnings of wasm-c-api and add more checks (#592) 2021-03-25 10:13:34 +08:00
Javan
8f902fa9ae
Enable Android libc wasi support. (#590)
Some libc APIs required by wasi native lib are missing in some Android API versions, only when the version >= 24, all APIs are supported. Add the missing APIs in android platform layer, leave them empty, report error and return failed if they are called. Also update CMakeLists.txt to enable libc wasi by default.

Co-authored-by: Wenyong Huang <wenyong.huang@intel.com>
2021-03-24 15:53:55 +08:00
Wenyong Huang
02d27e13ee
Fix some compilation warnings and enable Windows JIT (#586) 2021-03-22 19:28:51 +08:00
Wenyong Huang
68ff3a830e
Set AOT code and data readonly after relocation (#579) 2021-03-18 20:03:40 +08:00
Javan
ca67af91bc
Call asc app exported new/pin/unpin APIs to align with its latest compiler (#577)
AssemblyScript's latest compiler 0.18 exports  __new__/__pin__/unpin APIs to allocate/retain/free memory instead of __new/__retain/__release APIs in older version, we lookup functions of both version to make it compatible for both version.
2021-03-18 16:33:02 +08:00
Wenyong Huang
fda3a26903
Fix some relocation type issues in windows (#574)
Implement Windows PE file relocation type IMAGE_REL_AMD64_ADDR64/ADDR32/REL32, implement relocation for symbol "__xmm@xxx"/"__plt@xxx"/".rdata", implement Windows invokeNative simd asm code and enable SIMD by default for windows platform. Also update wamrc tool.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-03-16 16:59:16 +08:00
Wenyong Huang
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