Commit Graph

207 Commits

Author SHA1 Message Date
Huang Qi
58ca02bc5f
Add support for RISCV32 ILP32F (#3708)
Some checks are pending
compilation on SGX / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Waiting to run
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $AOT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-20.04, linux-sgx, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com/WebA… (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-20.04, linux-sgx, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://gith… (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-20.04, linux-sgx, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.… (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_JIT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-20.04, linux-sgx, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com… (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, aot, -x -p -s spec -P) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, aot, -x -p -s spec -S -P) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, aot, -x -p -s spec -X -P) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, classic-interp, -x -p -s spec -P) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, fast-interp, -x -p -s spec -P) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, fast-jit, -x -p -s spec -P) (push) Blocked by required conditions
compilation on windows-latest / build (-DWAMR_BUILD_AOT=0) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_DEBUG_INTERP=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIB_PTHREAD=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIB_WASI_THREADS=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_REF_TYPES=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_SIMD=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_TAIL_CALL=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_DISABLE_HW_BOUND_CHECK=1) (push) Waiting to run
compilation on windows-latest / test (classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
2024-08-15 15:17:42 +08:00
Luís Freitas
f1fabd5559
Update devcontainer.md (#3628)
Tiny typo fix: from `.devontainer` to `.devcontainer`.
2024-07-16 08:38:55 +08:00
Enrico Loparco
6b1d81650d
Allow not copying the wasm binary in wasm-c-api and not referring to the binary in wasm/aot loader (#3389)
Add flag `LoadArgs.clone_wasm_binary` to control whether to clone the wasm/aot
binary in wasm-c-api module. If false, API `wasm_module_new_ex` won't clone the
binary, which may reduce the footprint.

Add flag `LoadArgs.wasm_binary_freeable` to control whether the wasm/aot binary
may be freed after instantiation for wamr API `wasm_runtime_load_ex`, if yes, then
for some running modes, the wasm/aot module doesn't refer to the input binary
again so developer can free it after instantiation to reduce the footprint.

And add API `wasm_module_is_underlying_binary_freeable` and
`wasm_runtime_is_underlying_binary_freeable` to check whether the input binary
can be freed after instantiation for wasm-c-api and wamr api.

And add sample to illustrate it.
2024-05-17 09:00:08 +08:00
Wenyong Huang
49c9fa31da
Fix typo of WAMR_CONFIGUABLE_BOUNDS_CHECKS (#3424)
Change to WAMR_CONFIGURABLE_BOUNDS_CHECKS, and fix CodeQL compilation errors
which were introduced by PR #3406.

ps.
https://github.com/bytecodealliance/wasm-micro-runtime/pull/3393#discussion_r1591810998
https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/9055318553/job/24876266629
2024-05-14 14:33:09 +08:00
Marcin Kolny
fe5e7a9981
Implement Memory64 support for AOT (#3362)
Refer to:
https://github.com/bytecodealliance/wasm-micro-runtime/pull/3266
https://github.com/bytecodealliance/wasm-micro-runtime/issues/3091
2024-05-13 11:03:38 +08:00
Benbuck Nason
1c2a8fca4e
Fix some more spelling issues (#3393) 2024-05-08 09:30:29 +08:00
Wenyong Huang
a6e008bca7
document: Update description about segue opt, update README (#3338) 2024-04-22 14:34:52 +08:00
dongsheng28849455
ba59e56e19
User defined memory allocator for different purposes (#3316)
Some issues are related with memory fragmentation, which may cause
the linear memory cannot be allocated. In WAMR, the memory managed
by the system is often trivial, but linear memory usually directly allocates
a large block and often remains unchanged for a long time. Their sensitivity
and contribution to fragmentation are different, which is suitable for
different allocation strategies. If we can control the linear memory's allocation,
do not make it from system heap, the overhead of heap management might
be avoided.

Add `mem_alloc_usage_t usage` as the first argument for user defined
malloc/realloc/free functions when `WAMR_BUILD_ALLOC_WITH_USAGE` cmake
variable is set as 1, and make passing `Alloc_For_LinearMemory` to the
argument when allocating the linear memory.
2024-04-18 19:40:57 +08:00
TianlongLiang
cee9b826a5
Update document for GC, exception handling and memory64 features (#3284)
Add GC, exception handling and memory64 to README.md post MVP feature list,
and update build_wamr.md for how to build them.

And remove `Non-trapping float-to-int conversions`, `Sign-extension operators`,
`Multi-value` links in README since they are in wasm MVP and very common now.
2024-04-07 14:54:02 +08:00
Wenyong Huang
9c8551cf75
Add cmake flag to control aot intrinsics (#3261)
Add cmake variable `-DWAMR_BUILD_AOT_INTRINSICS=1/0` to enable/disable
the aot intrinsic functions, which are normally used by AOT XIP feature, and
can be disabled to reduce the aot runtime binary size.

And refactor the code in aot_intrinsics.h/.c.
2024-04-01 11:26:05 +08:00
Xu Jinyang
cef88deedb
Add wasi_ephemeral_nn module support (#3241)
Add `wasi_ephemeral_nn` module support with optional cmake variable,
which was mentioned in #3229.
2024-03-21 21:05:34 +08:00
liang.he
8c1269d44d
trans_wasm_func_name.py: Correct function index during translation (#3232)
Adding the N from "aot_func#N" with the import function count is the correct
wasm function index.
2024-03-18 10:32:55 +08:00
TianlongLiang
c3e33a96ea
Remove unused argument in wasm_runtime_lookup_function and refactor WASMModuleInstance (#3218)
Remove the unused parameter `signature` from `wasm_runtime_lookup_function`.

Refactor the layout of WASMModuleInstance structure:
- move common data members `c_api_func_imports` and `cur_exec_env` from
  `WASMModuleInstanceExtraCommon` to `WASMModuleInstance`
- In `WASMModuleInstance`, enlarge `reserved[3]` to `reserved[5]` in case that
  we need to add more fields in the future

ps.
https://github.com/bytecodealliance/wasm-micro-runtime/issues/2530
https://github.com/bytecodealliance/wasm-micro-runtime/issues/3202
2024-03-13 12:28:45 +08:00
Wenyong Huang
0ee5ffce85
Refactor APIs and data structures as preliminary work for Memory64 (#3209)
# Change the data type representing linear memory address from u32 to u64

## APIs signature changes
- (Export)wasm_runtime_module_malloc
  - wasm_module_malloc
    - wasm_module_malloc_internal
  - aot_module_malloc
    - aot_module_malloc_internal
- wasm_runtime_module_realloc
  - wasm_module_realloc
    - wasm_module_realloc_internal
  - aot_module_realloc
    - aot_module_realloc_internal
- (Export)wasm_runtime_module_free
  - wasm_module_free
    - wasm_module_free_internal
  - aot_module_malloc
    - aot_module_free_internal
- (Export)wasm_runtime_module_dup_data
  - wasm_module_dup_data
  - aot_module_dup_data
- (Export)wasm_runtime_validate_app_addr
- (Export)wasm_runtime_validate_app_str_addr
- (Export)wasm_runtime_validate_native_addr
- (Export)wasm_runtime_addr_app_to_native
- (Export)wasm_runtime_addr_native_to_app
- (Export)wasm_runtime_get_app_addr_range
- aot_set_aux_stack
- aot_get_aux_stack
- wasm_set_aux_stack
- wasm_get_aux_stack
- aot_check_app_addr_and_convert, wasm_check_app_addr_and_convert
  and jit_check_app_addr_and_convert
- wasm_exec_env_set_aux_stack
- wasm_exec_env_get_aux_stack
- wasm_cluster_create_thread
- wasm_cluster_allocate_aux_stack
- wasm_cluster_free_aux_stack

## Data structure changes
- WASMModule and AOTModule
  - field aux_data_end, aux_heap_base and aux_stack_bottom
- WASMExecEnv
  - field aux_stack_boundary and aux_stack_bottom
- AOTCompData
  - field aux_data_end, aux_heap_base and aux_stack_bottom
- WASMMemoryInstance(AOTMemoryInstance)
  - field memory_data_size and change __padding to is_memory64
- WASMModuleInstMemConsumption
  - field total_size and memories_size
- WASMDebugExecutionMemory
  - field start_offset and current_pos
- WASMCluster
  - field stack_tops

## Components that are affected by the APIs and data structure changes
- libc-builtin
- libc-emcc
- libc-uvwasi
- libc-wasi
- Python and Go Language Embedding
- Interpreter Debug engine
- Multi-thread: lib-pthread, wasi-threads and thread manager
2024-03-12 11:38:50 +08:00
Enrico Loparco
8493ffa1cc
Add vprintf override for android and esp-idf (#3174)
And update document.
2024-02-22 17:02:46 +08:00
Wenyong Huang
63cd567b3f
Separate app-manager and app-framework from WAMR (#3129)
As planned, the app-manager and app-framework are to be migrated to
https://github.com/bytecodealliance/wamr-app-framework.

ps.
https://github.com/bytecodealliance/wasm-micro-runtime/issues/2329
https://github.com/bytecodealliance/wasm-micro-runtime/wiki/TSC-meeting-notes
2024-02-20 18:12:36 +08:00
Wenyong Huang
16a4d71b34
Implement GC (Garbage Collection) feature for interpreter, AOT and LLVM-JIT (#3125)
Implement the GC (Garbage Collection) feature for interpreter mode,
AOT mode and LLVM-JIT mode, and support most features of the latest
spec proposal, and also enable the stringref feature.

Use `cmake -DWAMR_BUILD_GC=1/0` to enable/disable the feature,
and `wamrc --enable-gc` to generate the AOT file with GC supported.

And update the AOT file version from 2 to 3 since there are many AOT
ABI breaks, including the changes of AOT file format, the changes of
AOT module/memory instance layouts, the AOT runtime APIs for the
AOT code to invoke and so on.
2024-02-06 20:47:11 +08:00
Marcin Kolny
a27ddece7f
Always allocate linear memory using mmap (#3052)
With this approach we can omit using memset() for the newly allocated memory
therefore the physical pages are not being used unless touched by the program.

This also simplifies the implementation.
2024-02-02 22:17:44 +08:00
Huang Qi
ad46290770
Update outdated reference link in multi_module.md (#3092) 2024-01-26 16:55:27 +08:00
Bruce Mitchener
61fe78c9ff
Fix download link for wasi-sdk (#3077)
The wasi-sdk repo moved from CraneStation to the WebAssembly org
on GitHub.
2024-01-24 13:42:45 +08:00
Enrico Loparco
3fcd79867d
Forward log and log level to custom bh_log callback (#3070)
Follow-up on #2907. The log level is needed in the host embedder to
better integrate with the embedder's logger.

Allow the developer to customize his bh_log callback with
`cmake -DWAMR_BH_LOG=<log_callback>`,
and update sample/basic to show the usage.
2024-01-24 13:05:07 +08:00
Wenyong Huang
0eb788d711
build_wamr.md: Update the document (#3074)
Add description for `WAMR_BUILD_LINUX_PERF`, `WAMR_BUILD_QUICK_AOT_ENTRY`
and `WAMR_BUILD_MODULE_INST_CONTEXT`.
And add some reference links.
2024-01-24 09:45:57 +08:00
Wenyong Huang
7f035d4206
perf_tune.md: Add refine the calling processes between host and wasm (#3065) 2024-01-23 12:20:28 +08:00
liang.he
9121db5671
Fix a bug when emit the custom name section to aot file (#2987)
The content in custom name section is changed after loaded since the strings
are adjusted with '\0' appended, the emitted AOT file then cannot be loaded.
The PR disables changing the content for AOT compiler to resolve it.

And disable emitting custom name section for `wamrc --enable-dump-call-stack`,
instead, use `wamrc --emit-custom-sections=name` to emit it.
2024-01-11 13:14:54 +08:00
YAMAMOTO Takashi
49ac1e0636
doc/build_wasm_app.md: Add a note about aot abi compatibility (#2993) 2024-01-10 12:10:40 +08:00
YAMAMOTO Takashi
5edd85d055
doc: Separate source_debugging.md into two files (#2932)
The original file was confusing as it contains both of
interpreter and aot debugging information intermixed.
2023-12-27 15:51:51 +08:00
liang.he
40b430fd24
Add a script to translate jitted function names in flamegraph (#2906) 2023-12-21 10:57:58 +08:00
Daniel Mangum
157c289d07
Fix typos of CIDR in docs and help text (#2851)
Fixes typos of CIDR in socket documentation and libc WASI help text.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2023-12-04 11:38:54 +08:00
Daniel Mangum
48e24032ba
doc/build_wamr.md: Fix links to RISC-V named ABIs (#2852)
Fixes links to RISC-V application binary interface names.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2023-12-04 10:05:26 +08:00
liang.he
b81abd01ef
Add a user tip about flamegraph (#2827) 2023-11-28 13:46:14 +08:00
liang.he
8aa813f44a
Generate jitdump to support linux perf for LLVM JIT (#2788) 2023-11-27 15:42:00 +08:00
Daniel Mangum
cf0da9a8c7
docs: Fix typo in export native APIs doc (#2750)
Fixes a small typo of conversion for native API documentation.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2023-11-12 08:42:36 +08:00
YAMAMOTO Takashi
ac6435884f
doc/memory_tune.md: "remove malloc" hack is not relevant to wasi-threads (#2603) 2023-09-28 09:27:33 +08:00
YAMAMOTO Takashi
c7a7db21b7
export_native_api.md: Add a note about thread termination (#2572) 2023-09-21 13:32:08 +08:00
YAMAMOTO Takashi
444b159963
Implement async termination of blocking thread (#2516)
Send a signal whose handler is no-op to a blocking thread to wake up
the blocking syscall with either EINTR equivalent or partial success.

Unlike the approach taken in the `dev/interrupt_block_insn` branch (that is,
signal + longjmp similarly to `OS_ENABLE_HW_BOUND_CHECK`), this PR
does not use longjmp because:
* longjmp from signal handler doesn't work on nuttx
  refer to https://github.com/apache/nuttx/issues/10326
* the singal+longjmp approach may be too difficult for average programmers
  who might implement host functions to deal with

See also https://github.com/bytecodealliance/wasm-micro-runtime/issues/1910
2023-09-20 18:11:52 +08:00
Wenyong Huang
fa2f29fd8a
Fix issues in releasing wamr-lldb (#2497)
- Update lldb patch due to swig was upgraded to 4.1 in macos
- Export LD_LIBRARY_PATH for searching libpython3.10.so when validating wamr-lldb
  in Ubuntu-20.04
- Rename lldb-wasm.patch to lldb_wasm.path
2023-08-23 12:56:11 +08:00
tonibofarull
b45d014112
wasi-nn: Improve TPU support (#2447)
1. Allow TPU and GPU support at the same time.
2. Add Dockerfile to run example with [Coral USB](https://coral.ai/products/accelerator/).
2023-08-14 20:03:56 +08:00
YAMAMOTO Takashi
bdd99137a4
embed_wamr.md: Improvements about threads (#2420)
- Some more clarifications
- Mention wasi-threads
- Fix a confusing indentation
2023-08-04 09:28:30 +08:00
Huang Qi
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 Qi
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 Qi
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
Wenyong Huang
ae457ef343
Add performance tunning document (#2286) 2023-06-13 10:57:07 +08:00
Wenyong Huang
fe830d805d
Add cmake variable to disable writing gs register (#2284)
Support to disable writing x86-64 GS segment register by
  `cmake -DWAMR_DISABLE_WRITE_GS_BASE=1`
and update document. Issue was reported in #2273.
2023-06-13 10:26:25 +08:00
Georgii Rylov
e78f63c7ee
Update doc on WAMR_DISABLE_HW_BOUND_CHECK 32-bit (#2262) 2023-06-06 09:34:06 +08:00
YAMAMOTO Takashi
f759a1f960
A few changes related to WAMRC_LLC_COMPILER (#2218)
Print `target triple` for wamrc and set target triple for the LLVM module.
And update document.
2023-05-17 09:56:35 +08:00
Elis Byberi
65f64958f5
Fix URL in embed_wamr.md (#2165)
Fix "Embed WAMR into Python" URL.
2023-05-02 09:13:49 +08:00
YAMAMOTO Takashi
e7b988e6ab
Document the summary of two pthread implementations (#2104)
And add `wasi-threads` to the key feature list in README.md.
2023-04-04 17:22:54 +08:00
Wenyong Huang
7701b379e4
Update documents (#2100)
Fix linkage error, update build wamr document, update socket and sample documents.
2023-04-03 15:54:44 +08:00
Wang Xin
b0f614d77a
Add architecture diagram for wasm globals and classic-interp stack frame (#2058) 2023-03-25 09:39:20 +08:00
Xu Jun
4c2d358980
Update document for source debugging (#2051) 2023-03-23 19:16:56 +08:00