![]() * Optimize memory initialization handling in AOT loader (#3983) Save memory if the file buffer is always exist before exit. Signed-off-by: Huang Qi <huangqi3@xiaomi.com> * Break aot_create_comp_data into small functions Signed-off-by: Huang Qi <huangqi3@xiaomi.com> * Handle a new scenario where an item is both exported and imported. (#3984) * Error message improvement (#4000) Improve error message in the scenario where the runtime was built with ref types disabled but the module uses reference types feature. * Ensure __heap_base and __data_end global indices are validated against import count (#3996) * Fix table index calculations in wasm_loader and wasm_mini_loader (#4004) * Add an example of how to embed WAMR in Zephyr user mode (#3998) * [fuzzing] Use software bound-check during fuzzing (#4003) * Update CMakeLists.txt of fuzzing - enable software bound-check - enable wasi - disable libc builtin and multiple modules * Fix off-by-one error in result offset calculation for function calls * Check whether related table has funcref elem in opcode call_indirect (#3999) * check whether table has funcref elem in call_indirect * check whether table has funcref elem in call_indirect when gc is enabled * Improve stack consistency by ensuring sufficient space for dummy offsets (#4011) One more corner case: if the `frame_offset` increases and becomes equal to the `frame_offset_boundary` after the last assignment within the for loop. * Add documentation regarding security issues and the status of Wasm proposals (#3972) Add documentation regarding security issues and the status of Wasm proposals. * Enable shrunk memory by default and add related configurations (#4008) - Enable shrunk memory by default and add related configurations - Improve error messages for memory access alignment checks - Add documentation for WAMR shrunk memory build option - Update NuttX workflow to disable shrunk memory build option * build(deps): Bump actions/upload-artifact from 4.5.0 to 4.6.0 (#4021) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.5.0 to 4.6.0. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4.5.0...v4.6.0) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): Bump github/codeql-action from 3.28.0 to 3.28.1 (#4020) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.0 to 3.28.1. - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](https://github.com/github/codeql-action/compare/v3.28.0...v3.28.1) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Refine read leb int wasm loader of fast interpreter (#4017) * .github: Add shared lib builds (#3975) So far, no workflows would attempt to build the shared version of the iwasm library (namely, vmlib). Note that, as opposed to GC_EH_BUILD_OPTIONS and DEFAULT_BUILD_OPTIONS, the actual default options defined by the build system are assumed, for the sake of simplicity and avoiding repeated code. * fixes for compiling on windows (#4026) * Refine getting const offsets in wasm loader of fast-interp (#4012) - Refine const offsets in loader for fast-interp - handle const cell num overflow - Use const array, remove list * Synchronize the GC spec tests to the commit from December 9. 2024. (#4022) - Synchronize the GC spec tests to the commit from December 9. 2024. - Revise the error messages to be consistent with the spec test cases. - bypass gc spec test on the nuttx platform as a workaround * Fix wasm loader check data segment count (#4039) correctly report error when datacount section has non-zero data segment count while the data section is not present * Update Rust target from 'wasm32-wasi' to 'wasm32-wasip1' in CI (#4050) - update Rust target from 'wasm32-wasi' to 'wasm32-wasip1' in ci * build(deps): Bump github/codeql-action from 3.28.1 to 3.28.5 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.1 to 3.28.5. - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](https://github.com/github/codeql-action/compare/v3.28.1...v3.28.5) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): Bump github/codeql-action from 3.28.5 to 3.28.8 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.5 to 3.28.8. - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](https://github.com/github/codeql-action/compare/v3.28.5...v3.28.8) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Use wasm32-wasip1 instead of wasm32-wasi target for rust code (#4057) Rust compiler previously deprecated, and now removed the wasm32-wasi target and replaced it with wasm32-wasip1. This change updates all the occurrences of wasm32-wasi in the context of Rust compilation. covers the wasi-nn/test. * add a validator for aot module (#3995) - Add AOT module validation to ensure memory constraints are met - Enable AOT validator in build configuration and update related source files * Show wasm proposals status during compilation and execution (#3989) - add default build configuration options and enhance message output for WAMR features - Add Wasm proposal status printing functionality * initial * Add versioning support and update CMake configuration * Add versioning information for libraries and executables across multiple platforms * Refactor versioning documentation and adopt semantic versioning guidelines * Remove deprecated version.h file and update versioning documentation * Add version.h and update versioning documentation for embedded platforms * Add workflow to confirm version.h is in sync and integrate it into Android compilation workflow * Cleanup check_version_h workflow by removing unnecessary outputs and permissions * Update memory allocation functions to use allocator user data (#4043) * [fuzzing] execute every exported function (#3959) - Enhance wasm mutator fuzz tests by adding export function execution and random value generation - Use --fuel to limit loop size - Use predefined values and enhance argument logging in execution * In wasm32, fix potential conversion overflow when enlarging 65536 pages (#4064) fix enlarge 65536 pages conversion overflow in wasm32 * fix(aot): ensure value_cmp does not exceed br_count in branch table compilation (#4065) * build(deps): Bump github/codeql-action from 3.28.8 to 3.28.9 (#4074) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.8 to 3.28.9. - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](https://github.com/github/codeql-action/compare/v3.28.8...v3.28.9) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Unit test:type matching issue and code redundancy (#4079) * Add a conditional check for the macro __STDC_VERSION__ (#4080) * build_llvm.py: Allow to build xtensa target on non-xtensa host Signed-off-by: Huang Qi <huangqi3@xiaomi.com> * [gc] Subtyping fix (#4075) * fix(build_llvm.py): clean up whitespace and formatting in build script Signed-off-by: Huang Qi <huangqi3@xiaomi.com> * feat: add support for EXTERNREF value type and enable AOT validator in fuzz tests (#4083) * fix(unit-test): libc_builtin_test issues (#4073) - uninitialized buffer pointers (crashes) - match integer constant size with printf specifier Signed-off-by: Peter Tatrai <peter.tatrai.ext@siemens.com> * fix(build_llvm_libraries.yml): Correct script path for build_llvm.py Signed-off-by: Huang Qi <huangqi3@xiaomi.com> * fix(aot_emit_aot_file): prevent buffer emission for zero byte_count (#4095) if using a debug building of wamrc to run spec test. there will be: core/iwasm/compilation/aot_emit_aot_file.c:1794:13: runtime error: null pointer passed as argument 2, which is declared to never be null * Cmake improvements (#4076) - Utilizes the standard CMake variable BUILD_SHARED_LIBS to simplify the CMake configuration. - Allows the use of a single library definition for both static and shared library cases, improving maintainability and readability of the CMake configuration. - Install vmlib public header files - Installs the public header files for the vmlib target to the include/iwasm directory. - Install cmake package - Adds the necessary CMake configuration files (iwasmConfig.cmake and iwasmConfigVersion.cmake). - Configures the installation of these files to the appropriate directory (lib/cmake/iwasm). - Ensures compatibility with the same major version. - Improve windows product-mini CMakeLists.txt - Fix missing symbols when linking windows product-mini with shared vmlib - Improve Darwin product-mini CMakeLists.txt --------- Signed-off-by: Peter Tatrai <peter.tatrai.ext@siemens.com> * fix: when load aot init expr,no type_idx set. (#4094) Fix an assertion from *gc_object.c line 91* `bh_assert(rtt_type->type_flag == WASM_TYPE_STRUCT;` * prevent data overflow on 32 bit platform for memory.grow * cr suggestions * cr suggestions * format * cr suggestions * feat: use C linkage in aot_comp_option.h for C++ embeding (#4106) Co-authored-by: xiangjia.xj <xiangjia.xj@alibaba-inc.com> * build(deps): Bump actions/upload-artifact from 4.6.0 to 4.6.1 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.6.0 to 4.6.1. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4.6.0...v4.6.1) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): Bump github/codeql-action from 3.28.9 to 3.28.10 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.9 to 3.28.10. - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](https://github.com/github/codeql-action/compare/v3.28.9...v3.28.10) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Apply suggestions from code review remove confusing comments. * build(deps): Bump ossf/scorecard-action from 2.4.0 to 2.4.1 Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.0 to 2.4.1. - [Release notes](https://github.com/ossf/scorecard-action/releases) - [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md) - [Commits]( |
||
---|---|---|
.. | ||
Media | ||
Script | ||
VSCode-Extension | ||
WASM-Debug-Server/Docker | ||
WASM-Toolchain/Docker | ||
.gitattributes | ||
README.md |
WAMR-IDE (Experimental)
Introduction
The WAMR-IDE is an Integrated Development Environment to develop WebAssembly application with coding, compiling and source debugging support. It contains 3 components: VSCode extension
, wasm-toolchain docker image
and wasm-debug-server docker image
.
-
VSCode extension
is anvscode
extension, with which user can build and manage projects, developwasm application
, includingbuilding
,running
anddebugging
. -
WASM-toolchain
is a docker image which provides building environment for wasm. -
WASM source debug server
is a docker image which provides running and source debugging environment for wasm application.
How to setup WAMR IDE
Now, the most straightforward way to install the WAMR IDE extension is by searching for WAMR-IDE in the VS Code extension marketplace and installing it directly. So, if you simply want to use WAMR debugging features in VS Code, this is the ideal (and effortless) way. And you are ready to use WAMR IDE.
It is only recommended to download versions after 1.3.2 from the marketplace.
Also, we have same version tagged docker images, lldb binaries and VS Code installation file(.vsix file) packed for each GitHub release. You can following the tutorial in this section.
Alternatively, if you want to build lldb, docker images, or .vsix file locally so that you can try the effect of your modification, you could refer to the tutorial in this section.
1. Preparation
1.1. Install VSCode
on host
- make sure the version of vscode you installed is at least 1.59.0
1.2. Install Docker
on host
1. [Windows: Docker Desktop](https://docs.docker.com/desktop/windows/install/)
2. [Ubuntu: Docker Engine](https://docs.docker.com/engine/install/ubuntu)
```xml
OS requirements:
To install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:
- Ubuntu Impish 21.10
- Ubuntu Hirsute 21.04
- Ubuntu Focal 20.04(LTS)
- Ubuntu Bionic 18.04(LTS)
```
2. WAMR VS Code extension: download from the GitHub release or build locally
2.1 Download WAMR VS Code extension from the GitHub release(Recommended approach)
2.1.1 Load docker images from the GitHub release tar file
From now on, for each GitHub release, we have the same version tagged docker image saved as a tar file, which you can find and download in the GitHub release.
You could download the tar archive files for docker images from the release, and then load them using the following commands:
# download the zip or tar.gz from release depending on your platform
# decompress and get the tar file
# on Linux/MacOS, you could use tar
tar xf wasm-toolchain-{version number}.tar.gz
tar xf wasm-debug-server-{version number}.tar.gz
# or you could use unzip
unzip wasm-toolchain-{version number}.zip
unzip wasm-debug-server-{version number}.zip
# load wasm-toolchain
docker load --input wasm-toolchain.tar
# load wasm-debug-server
docker load --input wasm-debug-server.tar
# on Windows, you could use any unzip software you like
# then loading docker images using powershell or git bash
# load wasm-toolchain
docker load --input ./wasm-toolchain.tar
# load wasm-debug-server
docker load --input ./wasm-debug-server.tar
2.1.2 Download the VS Code extension installation file from the GitHub release
From now on, for each GitHub release, we have the same version tagged zip/tar.gz file. For example, in release version 1.1.2, you can easily download and decompress wamr-ide-1.1.2.tar.gz
wamr-ide-1.1.2.zip
, which contains wamr-ide.vsix
VS Code extension installation file. As you can imagine, in the future, when new releases are available, you can freely choose whichever version(for example, 1.2.0, 1.3.0, etc.) you prefer. It should work as long as you download the same version tagged docker image and .vsix file.
2.1.3 Install extension from vsix
select wamr-ide.vsix
which you have decompressed from .tar.gz
or .zip
file.
2.2 Build WAMR VS Code extension locally(Alternative approach)
You could also build the VS Code extension locally, the following instruction provides a thorough tutorial. It's worth noting that in the local build tutorial we use hard-coded tag version 1.0 other than the semantic version of WAMR.
Note: Please ensure that the scripts under resource
directories have execution permission. While on git they have x bits, you might have dropped them eg. by copying them from Windows. Similarly, do not drop execution permission when copying lldb
binaries under resource/debug/bin
.
2.2.1 Build docker images on host
We have 2 docker images which should be built or loaded on your host, wasm-toolchain
and wasm-debug-server
. To build these 2 images, please enter the WASM-Debug-Server/Docker
& WASM-Toolchain/Docker
, then execute the build_docker_image
script respectively.
Windows (powershell):
cd .\WASM-Toolchain\Docker
.\build_docker_image.bat
cd .\WASM-Debug-Server\Docker
.\build_docker_image.bat
Linux:
cd ./WASM-Toolchain/Docker
./build_docker_image.sh
cd ./WASM-Debug-Server/Docker
./build_docker_image.sh
2.2.2 After building, you can find wasm-toolchain
and wasm-debug-server
docker images on your local
2.2.3 If building docker images fail during the process
Sometimes building the Docker images may fail due to bad network conditions. If the wasm-toolchain
and wasm-debug-server
images do not exist after building, please build them manually. Fix the proxy setting if needed and execute the following command to build docker images.
Note: please correctly replace example proxy address with your own before you run manually.
$ cd .\docker_images\wasm-debug-server
$ docker build --no-cache --build-arg http_proxy=http://proxy.example.com:1234
--build-arg https_proxy=http://proxy.example.com:1234 -t wasm-debug-server:1.0 .
$ cd .\docker_images\wasm-toolchain
$ docker build --no-cache --build-arg http_proxy=http://proxy.example.com:1234
--build-arg https_proxy=http://proxy.example.com:1234 -t wasm-toolchain:1.0 .
2.2.4 If you encounter the problem failed to solve with frontend dockerfile.v0: failed to create LLB definition
, please config your docker desktop
2.2.5 Points To Remember
- Make sure that the
wasm-toolchain:1.0
andwasm-debug-server:1.0
docker images are both successfully built before usingWAMR IDE
, otherwiseBuild
,Run
andDebug
will not work.
2.2.6 Generate wamride extension package file
wamride-1.0.0.vsix
can be packaged by npm vsce
.
npm install -g vsce
cd VSCode-Extension
rm -rf node_modules
npm install
vsce package
2.2.7 Enable VS Code debugging feature
By default, when you build .vsix locally, the debugging feature is off. Suppose you want to enable the source debugging feature. In that case, you could download lldb
binaries from our GitHub release (for example, wamr-lldb-1.1.2-x86_64-ubuntu-20.04.tar.gz
), decompress and put every subdirectory and file to the installed directory of your VS Code extension.
For example, let's say you are on an Ubuntu 20.04 machine. You first download and decompress wamr-lldb-1.1.2-x86_64-ubuntu-20.04.tar.gz
, and you will get a wamr-lldb
folder (or inst
folder in our earlier release). Then, you can simply copy the files and directory inside that folder to the relative path resource/debug/linux/
under your VS Code extension installation directory.
Example commands on an Ubuntu 20.04 machine:
# decompress .tar.gz file and get the folder
$ ls wamr-lldb
bin lib package.json syntaxes
# copy everything to the vscode extension installation path(in this case, it's /home/{usrname}/.vscode-server/extensions/wamr.wamride-1.0.0/)
$ cp inst/* /home/{usrname}/.vscode-server/extensions/wamr.wamride-1.0.0/resource/debug/linux/
If you want to use your own patched lldb
, you could follow this instruction to build lldb
. And follow this instruction
to copy the binaries to replace the existing ones.
You can also debug the extension directly follow this instruction without packing the extension.
2.2.7 Install extension from vsix
select wamride-1.0.0.vsix
which you have packed on your host.
How to use wamr-ide
WAMR-IDE
extension contains 2 components as following picture showing. WAMR IDE
for workspace and project management and Current Project
for project's execution
Project Execution
1. New project
When you click New project
button, the extension will pop up a message box at the bottom right of the screen as following:
You can click Set up now
and select the target folder to create project workspace, or you click Maybe later
to close the message box.
Note that your selected workspace folder should be empty or the folder you have set up as workspace.
After setting up workspace, extension will prompt successful message:
Workspace has been set up successfully!
Then click New project
button again, a new page will show as following.
Enter the Project name
and select the Template
, then click Create
button. A new project will be generated and opened in your current VS Code window
or in a new VS Code window
.
Opening in current windows or a new one depends on whether your
vscode's explorer
is empty or not. If empty, open in current window, or open in the new vscode window.
A new initialized project is as following picture shows.
.wamr
is the project configuration folder which contains 3 files, CMakeLists.txt
, project.cmake
, and compilation_config.json
. CMakeLists.txt
is used to build wasm target
and the project.cmake
is included in CMakeLists.txt
. compilation_config.json
includes the user's customized configuration such as folders which should be added in the include path.
2. Open project
Click Open project
button, quick-pick-box
will show as following. All projects under your current workspace will be shown and can be selected.
3. Change workspace
Click Change workspace
button, a dialog will show as following. You can select 1 folder in file system as workspace, and the new workspace path will override previous workspace, and all new created projects will be generated in the new workspace.
4. Customize include paths
and exclude source files
Extension supports adding header file folder to `include path` and excluding source file from build.
-
Add to include path
- Move the cursor to the
folder
and right click, thenmenus
will be shown as following. ClickToggle state of path including
.
- Move the cursor to the
-
Exclude source file from build
- Move the cursor to the
source file
and right click, thenmenus
will be shown as following. ClickToggle state of excluding
.
- Move the cursor to the
After setting up include path
and exclude files
, the corresponding folder and files will be decorated with color and icon as following picture shows
At the same time, all added include path
and exclude files
will be saved in .wamr/compilation_config.json
as json array.
Toggle state of path including
just shows when selectingfolder
and hides with other resources.
Toggle state of excluding
just shows when selecting[.c | .cpp | .cxx] source files
and hides with other resources.
Current Project Management
1. Configuration
Click Configuration
button, a new page will be shown as following. You can config building target with Include paths
, Initial & Max linear memory
, stack size
, exported_symbols
and include paths
, exclude files
.
Short Explanation of the Fields Above:
- Output file name: The compiled wasm file name of your program.
- Initial linear memory size, Max linear memory size, Stack size: The wasi-sdk clang compile options.
- Exported symbols: The symbols your wasm program wants to export. Multiple symbols are separated by commas without spaces.
- Host managed heap size: The running configuration for the host managed heap size of iwasm. In most cases, the default size would be fine, but in some scenarios, let's say you want to allocate more memory using
malloc
, you should increase it here accordingly.
Note that due to the current implementation limitation, after changing the
Output file name
orHost managed heap size
, you need to close and reopen VSCode (to reactivate the extension) so that the running config will be correctly updated.
Then click Modify
button to confirm, if configurations are modified successfully and following message will pop. Click OK
, the page will be auto closed.
And all configuration will be saved in .wamr/compilation_config.json
.
2. Build
When you have completed coding and ready to build target, click build
button and the wasm-toolchain
will auto start a container and execute the building process.
After successful building execution, build
folder will be generated in explorer
, in which ${output_file_name}.wasm
is exist.
Note that to start
docker service
firstly.
3. Run
Click Run
button and wasm-debug-server
docker image will auto start a container and execute the running process.
4. Debug
Click Debug
button will trigger start ip wamr-debug-server
docker image, and boot up lldb debug server
inside of iwasm. Then start a debugging session with configuration to connect. Tap F11
or click step into
to start debugging.
Docker containers will be auto stopped and removed after the execution.