Commit Graph

143 Commits

Author SHA1 Message Date
Jämes Ménétrey
6adf9194d4
Normalize how the global heap pool is configured across iwasm apps (#1628)
Use the cmake variable `WAMR_BUILD_GLOBAL_HEAP_POOL` and
`WAMR_BUILD_GLOBAL_HEAP_SIZE` to enable/disable the global heap pool
and set its size. And set the default global heap size in core/config.h and
the cmake files.

As a result, the developers who build iwasm can easily enable/disable the
global heap pool and change its size regardless of the iwasm implementation,
without manually finding and patching the right location for that value.
2022-10-25 21:36:24 +08:00
Wenyong Huang
e87a554616
Refactor LLVM JIT (#1613)
Refactor LLVM JIT for some purposes:
- To simplify the source code of JIT compilation
- To simplify the JIT modes
- To align with LLVM latest changes
- To prepare for the Multi-tier JIT compilation, refer to #1302

The changes mainly include:
- Remove the MCJIT mode, replace it with ORC JIT eager mode
- Remove the LLVM legacy pass manager (only keep the LLVM new pass manager)
- Change the lazy mode's LLVM module/function binding:
  change each function in an individual LLVM module into all functions in a single LLVM module
- Upgraded ORC JIT to ORCv2 JIT to enable lazy compilation

Refer to #1468
2022-10-18 20:17:34 +08:00
YAMAMOTO Takashi
e6c7125851
export_native_api.md: Partially revert "Relax the ground rule" (#1588)
And add some clarifications
2022-10-13 18:33:06 +08:00
YAMAMOTO Takashi
1c89a37899
export_native_api.md: Relax the "ground rule" (#1577)
Nothing wrong with passing structures and function pointers
as far as the native code is aware of and careful about the
ABI used in the wasm module.
2022-10-12 20:04:59 +08:00
Jämes Ménétrey
dfd16f8e4f
linux-sgx: Implement SGX IPFS as POSIX backend for file interaction (#1489)
This PR integrates an Intel SGX feature called Intel Protection File System Library (IPFS)
into the runtime to create, operate and delete files inside the enclave, while guaranteeing
the confidentiality and integrity of the data persisted. IPFS can be referred to here:
https://www.intel.com/content/www/us/en/developer/articles/technical/overview-of-intel-protected-file-system-library-using-software-guard-extensions.html

Introduce a cmake variable `WAMR_BUILD_SGX_IPFS`, when enabled, the files interaction
API of WASI will leverage IPFS, instead of the regular POSIX OCALLs. The implementation
has been written with light changes to sgx platform layer, so all the security aspects
WAMR relies on are conserved.

In addition to this integration, the following changes have been made:
 - The CI workflow has been adapted to test the compilation of the runtime and sample
    with the flag `WAMR_BUILD_SGX_IPFS` set to true
 - Introduction of a new sample that demonstrates the interaction of the files (called `file`),
 - Documentation of this new feature
2022-09-28 13:09:58 +08:00
Wenyong Huang
78b5c5b484
Merge dev/socket into main (#1393)
Implement more socket APIs, refer to #1336 and below PRs:
- Implement wasi_addr_resolve function (#1319)
- Fix socket-api byte order issue when host/network order are the same (#1327)
- Enhance sock_addr_local syscall (#1320)
- Implement sock_addr_remote syscall (#1360)
- Add support for IPv6 in WAMR (#1411)
- Implement ns lookup allowlist (#1420)
- Implement sock_send_to and sock_recv_from system calls (#1457)
- Added http downloader and multicast socket options (#1467)
- Fix `bind()` calls to receive the correct size of `sockaddr` structure (#1490)
- Assert on correct parameters (#1505)
- Copy only received bytes from socket recv buffer into the app buffer (#1497)

Co-authored-by: Marcin Kolny <mkolny@amazon.com>
Co-authored-by: Marcin Kolny <marcin.kolny@gmail.com>
Co-authored-by: Callum Macmillan <callumimacmillan@gmail.com>
2022-09-22 21:46:14 +08:00
TianlongLiang
ee210d019f
Dockerfile lint errors fix (#1493)
Fix the Dockerfile linter errors and most warnings
2022-09-22 13:06:11 +08:00
YAMAMOTO Takashi
12bbb9189c
source_debugging.md: Add some notes about AOT debug (#1496) 2022-09-17 21:01:29 +08:00
YAMAMOTO Takashi
1eedde7c33
Fix several issues related to AOT debug (#1492) 2022-09-16 12:06:46 +08:00
Xu Jun
5722fcc40a
Fix issue in multi-thread sample (#1458)
Set `WAMR_BUILD_LIB_PTHREAD_SEMAPHORE` for the sample,
and update document.
2022-09-07 12:56:50 +08:00
YAMAMOTO Takashi
ef8c6bd98a
doc/build_wasm_app.md: Update a note about LLVM 13 incompatibility (#1441)
Remove the workaround as it wasn't so good.
  (It can cause the lack of ctor calls)
Mention that it's only about a command.
2022-09-05 11:56:24 +08:00
liang.he
717e8a48e2
Enable the semantic version mechanism for WAMR (#1374)
Use the semantic versioning (https://semver.org) to replace the current date
versioning system, which is more general and is requested by some developers,
e.g. issue #1357.

There are three parts in the new version string:
- major. Any incompatible modification on ABIs and APIs will lead to an increment
  in the value of major, which mainly includes: AOT calling conventions, AOT file
  format, wasm_export.h, wasm_c_api.h, and so on.
- minor. It represents new features, including MVP/POST-MVP features, libraries,
  WAMR private ones, and so one.
- patch. It represents patches.

The new version will start from 1.0.0. Update the help info and version showing for
iwasm and wamrc.
2022-08-18 19:01:05 +08:00
Huang Qi
88cf1e36c1
Support custom stack guard size (#1368)
Add a new option WAMR_BUILD_STACK_GUARD_SIZE to set the custom
stack guard size. For most RTOS systems, we use the native stack base
address as the check boundary which may be not safe as POSIX based
systems (like Linux).
2022-08-12 10:17:11 +08:00
Wenyong Huang
6922f3ac68
Implement xtensa XIP (#1202)
Lookup table for i32.const and i64.const for xtensa XIP
Lookup const offset from table for load/store opcodes for xtensa XIP
Fill capability flags for xtensa XIP
Enable lower switch pass for xtensa XIP
2022-08-04 14:42:28 +08:00
Wenyong Huang
bf28030993
Import WAMR Fast JIT (#1343)
Import WAMR Fast JIT which is a lightweight JIT with quick startup, small footprint,
relatively good performance (~40% to ~50% of LLVM JIT) and good portability.

Platforms supported: Linux, MacOS and Linux SGX.
Arch supported: x86-64.
2022-08-02 16:03:50 +08:00
liang.he
ab752cd5c3
Apply latest env variables in github host runner to fix CI (#1334)
Currently we are using `ANDROID_HOME` and `ANDROID_NDK_LATEST_HOME`.
All variables should follow definitions in https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#environment-variables-3
2022-07-27 14:11:51 +08:00
Wenyong Huang
dd62b32b20
Fix interp hw bound check issues (#1322)
Fix build script to enable hw bound check for interpreter when
AOT is disabled, so as to enable spec cases test for interp with
hw bound check. And fix the issues found.
2022-07-23 20:39:01 +08:00
YAMAMOTO Takashi
a67c1c1c01
doc/build_wasm_app.md: Mention a glitch with LLVM 13 and later (#1255)
References:
https://reviews.llvm.org/D81689#3611504
https://github.com/WebAssembly/WASI/issues/471
2022-06-28 19:56:24 +08:00
Xu Jun
53b775aa4b
Support integrate 3rd-party toolchains into wamrc (#1237)
Support integrating 3rd-party toolchain llc compiler or asm compiler
into wamrc by setting environment variable WAMRC_LLC_COMPILER
or WAMRC_ASM_COMPILER, wamrc will use these tools to generate
object file from LLVM IR firstly, and then refactor the object file into
aot file.
2022-06-20 13:13:41 +08:00
Xu Jun
77595c9560
Support emit specified custom sections into AoT file (#1207)
And add API to get the content of custom section with
section name for both wasm file and aot file.
2022-06-10 21:51:13 +08:00
Xu Jun
d404107d85
Fix typo in embed_wamr.md (#1214)
Fix typo in embed_wamr.md reported by #1211
2022-06-09 08:56:45 +08:00
Wenyong Huang
48cdbee4e0
Update documents (#1203)
Mention the Python binding and Go binding in README.md and
embed_wamr.md.
Fix typo of esp-idf link in build_wamr.md.
2022-06-02 14:33:03 +08:00
Wenyong Huang
3d1dad7792
Fix x86-32 compile warning and update document (#1164) 2022-05-10 15:22:20 +08:00
YAMAMOTO Takashi
362bd0cc5c
doc/wasm_c_api.md: Mention relationship with wasm_export.h (#1159) 2022-05-09 16:39:49 +08:00
Wenyong Huang
2007ba38cf
Enable register native with iwasm (#1120)
Enable register native with iwasm application, add sample and update document.
2022-04-27 11:12:50 +08:00
Oscar Spencer
5e0ee67d48
Mention WAMR_BUILD_BULK_MEMORY in build_wamr.md (#1069) 2022-04-01 15:52:16 +08:00
Jämes Ménétrey
106974d915
Implement Berkeley Socket API for Intel SGX (#1061)
Implement Berkeley Socket API for Intel SGX
- bring Berkeley socket API in Intel SGX enclaves,
- adapt the documentation of the socket API to mention Intel SGX enclaves,
- adapt _iwasm_ in the mini-product _linux-sgx_ to support the same option as the one for _linux_,
- tested on the socket sample as provided by WAMR (the TCP client/server).
2022-03-25 17:46:29 +08:00
liang.he
86b79cfb93
Enable lock for Vector to protect wasm-c-api read/write/extend operations (#1010) 2022-03-23 11:42:57 +08:00
Wenyong Huang
e7079eeb17
Update document of embed wamr and code format check (#1054)
Update document embed wamr, add how to embed wamr in cmake and makefile
Update document coding guideline check, add how to install clang-format-12
2022-03-23 11:01:57 +08:00
Wenyong Huang
21d89135da
Enhance uvwasi build process and fix wamrc windows build error (#1046)
And update related document
2022-03-15 21:43:55 +08:00
Wenyong Huang
9c87a1ee17
Implement part of Berkeley Socket API for libc-wasi (#1036)
Refer to [Networking API design](https://github.com/WebAssembly/WASI/issues/370)
and [feat(socket): berkeley socket API v2](https://github.com/WebAssembly/WASI/pull/459):

- Support the socket API of synchronous mode, including `socket/bind/listen/accept/send/recv/close/shutdown`,
    the asynchronous mode isn't supported yet.
- Support adding `--addr-pool=<pool1,pool2,..>` argument for command line to identify the valid ip address range
- Add socket-api sample and update the document
2022-03-10 15:13:38 +08:00
Wenyong Huang
a33a385caa
Fix littlevgl link error issues (#1006)
The littlevgl library had changed its name and domain to [LVGL](https://lvgl.io).
See https://blog.lvgl.io/2020-06-01/announcement
We change some names and links accordingly.

Also remove the cloning for tlsf library as it isn't used now.
2022-02-15 08:41:36 +08:00
Wenyong Huang
bb87180b72
Update document and fix wasm_runtime_call_wasm_a issue (#1005)
Update document memory_tune.md: fix embed wamr link error,
fix description error of wasm operand stack size, update picture.

Fix wasm_runtime_call_wasm_a issue reported by #1003 and update
sample basic to call this API.
2022-02-14 17:36:38 +08:00
lucianoiam
4bdeb909df
Enable Windows MinGW support (#1000)
Allow compilation on Windows MinGW, see build_wamr.md for more details.

Note that WASI and some other smallish details are still not supported, but
we have a starting point. See more discussion at #993
2022-02-06 13:20:38 +08:00
Wenyong Huang
e2403c3ee9
Update documents (#984)
Fix wamr-ide link error, set wamr-ide to experimental and fix README issues
2022-01-25 20:24:33 +08:00
Wenyong Huang
b256cb3a53
Update documents (#981)
Update README.md, add "Getting Started", “Performance and Footprint”,
”Use Cases", and refine some sections.
Add memory tune document and fix wasm-c-api document.
2022-01-25 16:37:31 +08:00
Xu Jun
90a0057d33
Implement pthread_cond_broadcast wrapper for lib-pthread (#982)
Implement pthread_cond_broadcast wrapper for lib-pthread
- support pthread_cond_broadcast wrapper for posix/linux-sgx/windows
- update document for building multi-thread wasm app with emcc
2022-01-25 09:28:02 +08:00
Wenyong Huang
7636d86a76
Refactor Orc JIT to enable lazy compilation (#974)
Refactor LLVM Orc JIT to actually enable the lazy compilation and speedup
the launching process:
  https://llvm.org/docs/ORCv2.html#laziness

Main modifications:
- Create LLVM module for each wasm function, wrap it with thread safe module
  so that the modules can be compiled parallelly
- Lookup function from aot module instance's func_ptrs but not directly call the
  function to decouple the module relationship
- Compile the function when it is first called and hasn't been compiled
- Create threads to pre-compile the WASM functions parallelly when loading
- Set Lazy JIT as default, update document and build/test scripts
2022-01-20 18:40:13 +08:00
Wenyong Huang
260d36a62d
Refactor externref related APIs of reference types feature (#971)
Currently when calling wasm_runtime_call_wasm() to invoke wasm function
with externref type argument from runtime embedder, developer needs to
use wasm_externref_obj2ref() to convert externref obj into an internal ref
index firstly, which is not convenient to developer.
To align with GC feature in which all the references passed to
wasm_runtime_call_wasm() can be object pointers directly, we change the
interface of wasm_runtime_call_wasm() to allow to pass object pointer
directly for the externref argument, and refactor the related codes, update
the related samples and the document.
2022-01-19 11:25:08 +08:00
liang.he
9eb3ed6b15
Update documents about building wasm app with wasi-sdk (#955)
Checked with grammarly
2022-01-13 16:43:05 +08:00
Therdel
ae18a03f60
Fix link in multi_module.md (#941) 2022-01-08 18:47:56 +08:00
liang.he
ff997c287a
Update document of multi-module (#930) 2022-01-05 14:32:48 +08:00
Wenyong Huang
90cccda68e
Refine some error msg, comment and document (#921) 2021-12-29 12:13:30 +08:00
Stefan Wallentowitz
936206f97b
Update Zephyr document, add esp32c3 and particle_argon support(#920)
Update the Zephyr document to provide more detailed instructions, and add info
about espressif toolchain too.

Add ESP32C3 (RISC-V) and Particle Argon boards support to the zephyr platform
sample. More boards are possible, but the script doesn't scale well and is to be
improved in future.

Add Dockerfile to kickstart a Zephyr development environment as it can be rather
confusing for new users.
2021-12-29 10:05:27 +08:00
Bastian Kersting
a9f1c2b64a
Port WAMR to ESP-IDF (#892)
This PR introduces an implementation of the WAMR platform APIs for ESP-IDF and enables support for Espressif microcontrollers, and adds the documentation around how to build WAMR for ESP-IDF.

This PR is related to the following issues at WAMR: closes #883, #628, #449 and #668 as well as [#4735](https://github.com/espressif/esp-idf/issues/4735) at the esp-idf repo. It implements most functions required by [platform_api_vmcore.h](https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/core/shared/platform/include/platform_api_vmcore.h).

The PR works in interpreter mode on Esp32c3 and Esp32. For the AOT mode, currently errors occur on both platforms with `Guru Meditation Error`. It seems that the AOT code isn't run with shared memory as os_mmap() allocates memory with malloc() API, it is to be fixed in the future.
2021-12-20 10:52:59 +08:00
Xu Jun
4258b24bcc
add lldb patch to attribution (#900) 2021-12-15 18:38:27 +08:00
Xu Jun
a06ede0de1
update source debugging document (#872) 2021-12-06 20:15:19 +08:00
Wenyong Huang
b490a229f6
Enhance XIP and add XIP document (#863)
Auto detect whether file is XIP file before loading module in posix like and
linux-sgx platforms, and if yes, mmap executable memory automatically to
run the XIP file.
Add document about XIP feature.
Enable test spec cases with XIP feature.
2021-12-06 17:25:10 +08:00
Xu Jun
2af5ae5abb
[source debug] refine some code in source debugging (#856)
- move the wait_cond from exec_env to debug_instance, so the debug thread can be waken up by any threads
- process more general query message from debugger
- refine debug instance create/destroy mechanism
- avoid creating debug instance during module instantiating
- avoid blocking execution thread during creating debug instance
- update related documents
2021-12-06 10:25:38 +08:00
Therdel
d03a57fbff
fix link in multi_module.md (#846) 2021-11-25 11:26:06 +08:00