Skip to content

Commit 302f32b

Browse files
authored
Merge branch 'main' into InstantiationArgs2-wasinn
2 parents 9d8e31a + fcec30e commit 302f32b

File tree

182 files changed

+4919
-2036
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+4919
-2036
lines changed

.clang-tidy

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,49 @@
11
# refer to https://clang.llvm.org/extra/clang-tidy/checks/list.html
2+
#
3+
# Configure clang-tidy for this project.
4+
5+
# Here is an explanation for why some of the checks are disabled:
6+
#
7+
8+
Checks: >
9+
-*,
10+
bugprone-*,
11+
cert-*,
12+
clang-analyzer-*,
13+
concurrency-*,
14+
misc-*,
15+
modernize-*,
16+
performance-*,
17+
portability-*,
18+
readability-*,
19+
-bugprone-easily-swappable-parameters,
20+
-bugprone-macro-parentheses,
21+
-misc-no-recursion,
22+
-misc-unused-parameters,
23+
-readability-braces-around-statements,
24+
-readability-else-after-return,
25+
-readability-function-cognitive-complexity,
26+
-readability-identifier-length,
27+
-readability-isolate-declaration,
28+
-readability-magic-numbers,
29+
-readability-named-parameter,
30+
-readability-non-const-parameter,
31+
-readability-redundant-preprocessor,
32+
-readability-suspicious-call-argument,
33+
-readability-uppercase-literal-suffix
34+
35+
36+
# Turn all the warnings from the checks above into errors.
37+
WarningsAsErrors: "*"
38+
39+
# headers in the following directories will be checked:
40+
# - core/iwasm/
41+
# - core/shared/
42+
HeaderFilterRegex: '(core/iwasm/|core/shared/).*\\.h$'
43+
44+
# goto .clang-format at root directory to see the format style
45+
FormatStyle: file
246

3-
Checks: '-*, readability-identifier-naming, clang-analyzer-core.*,'
4-
WarningsAsErrors: '-*'
5-
HeaderFilterRegex: ''
6-
FormatStyle: file
7-
InheritParentConfig: false
8-
AnalyzeTemporaryDtors: false
9-
User: wamr
1047
CheckOptions:
11-
- key: readability-identifier-naming.VariableCase
12-
value: lower_case
13-
- key: readability-identifier-naming.ParameterCase
14-
value: lower_case
15-
- key: readability-identifier-naming.MacroDefinitionCase
16-
value: UPPER_CASE
48+
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
49+
- { key: readability-function-cognitive-complexity.Threshold, value: 100 }

.devcontainer/Dockerfile

Lines changed: 24 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,150 +1,42 @@
11
# Copyright (C) 2019 Intel Corporation. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/cpp/.devcontainer/base.Dockerfile
5-
# [Choice] Debian / Ubuntu version (use Debian 12/11/9, Ubuntu 18.04/21.04 on local arm64/Apple Silicon): debian-12, debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
4+
# hadolint global ignore=DL3008,DL3009
5+
66
ARG VARIANT=debian-12
7-
FROM mcr.microsoft.com/vscode/devcontainers/cpp:${VARIANT}
7+
FROM mcr.microsoft.com/devcontainers/cpp:${VARIANT}
88

99
ARG DEBIAN_FRONTEND=noninteractive
10-
ENV TZ=Asian/Shanghai
10+
ENV TZ=Asia/Shanghai
1111

12-
# hadolint ignore=DL3008
1312
RUN apt-get update \
14-
&& apt-get upgrade -y \
15-
&& apt-get install -y apt-transport-https apt-utils build-essential \
16-
ca-certificates ccache cmake curl g++-multilib git gnupg \
17-
libgcc-12-dev lib32gcc-12-dev lsb-release \
18-
ninja-build ocaml ocamlbuild \
19-
software-properties-common tree tzdata \
20-
unzip valgrind vim wget zip --no-install-recommends \
21-
&& apt-get clean -y \
22-
&& rm -rf /var/lib/apt/lists/*
23-
24-
#
25-
# binaryen
26-
ARG BINARYEN_VER=114
27-
WORKDIR /opt
28-
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VER}/binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz \
29-
&& tar xf binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz \
30-
&& ln -sf /opt/binaryen-version_${BINARYEN_VER} /opt/binaryen \
31-
&& rm binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz
32-
33-
#
34-
# CMAKE (https://apt.kitware.com/)
35-
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
36-
# hadolint ignore=DL3008
37-
ARG CMAKE_VER=3.27.0
38-
RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.sh \
39-
-q -O /tmp/cmake-install.sh \
40-
&& chmod u+x /tmp/cmake-install.sh \
41-
&& mkdir /opt/cmake-${CMAKE_VER} \
42-
&& /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-${CMAKE_VER} \
43-
&& rm /tmp/cmake-install.sh \
44-
&& ln -s /opt/cmake-${CMAKE_VER}/bin/* /usr/local/bin
45-
46-
#
47-
# install emsdk
48-
WORKDIR /opt
49-
RUN git clone https://github.com/emscripten-core/emsdk.git
50-
51-
ARG EMSDK_VER=3.1.43
52-
WORKDIR /opt/emsdk
53-
RUN git pull \
54-
&& ./emsdk install ${EMSDK_VER} \
55-
&& ./emsdk activate ${EMSDK_VER} \
56-
&& echo "source /opt/emsdk/emsdk_env.sh" >> /root/.bashrc
57-
58-
#
59-
# install wasi-sdk
60-
ARG WASI_SDK_VER=20
61-
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -P /opt \
62-
&& tar xf /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -C /opt \
63-
&& ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk \
64-
&& rm /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz
65-
66-
#
67-
#install wabt
68-
ARG WABT_VER=1.0.33
69-
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz -P /opt \
70-
&& tar xf /opt/wabt-${WABT_VER}-ubuntu.tar.gz -C /opt \
71-
&& ln -sf /opt/wabt-${WABT_VER} /opt/wabt \
72-
&& rm /opt/wabt-${WABT_VER}-ubuntu.tar.gz
13+
&& apt-get upgrade -y
7314

74-
#
75-
# install bazelisk
76-
ARG BAZELISK_VER=1.17.0
77-
RUN mkdir /opt/bazelisk \
78-
&& wget -c --progress=dot:giga https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64 -P /opt/bazelisk \
79-
&& chmod a+x /opt/bazelisk/bazelisk-linux-amd64 \
80-
&& ln -fs /opt/bazelisk/bazelisk-linux-amd64 /opt/bazelisk/bazel
81-
82-
#
83-
# install clang+llvm
84-
ARG LLVM_VER=16
85-
RUN apt-get purge -y clang-14 llvm-14 && apt-get autoremove -y
86-
WORKDIR /etc/apt/apt.conf.d
87-
RUN touch 99verfiy-peer.conf \
88-
&& echo "Acquire { https::Verify-Peer false }" > 99verfiy-peer.conf
89-
90-
WORKDIR /tmp
91-
#RUN wget --progress=dot:giga https://apt.llvm.org/llvm.sh \
92-
# && chmod a+x ./llvm.sh \
93-
# && ./llvm.sh ${LLVM_VER} all
94-
95-
# Workaround due to https://github.com/llvm/llvm-project/issues/62475
96-
# hadolint ignore=DL3008
97-
RUN set -ex \
98-
&& echo "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-${LLVM_VER} main" > /etc/apt/sources.list.d/apt.llvm.org.list \
99-
&& wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc \
100-
&& apt-get update \
101-
&& apt-get install -y \
102-
clang-${LLVM_VER} lldb-${LLVM_VER} lld-${LLVM_VER} clangd-${LLVM_VER} clang-tidy-${LLVM_VER} clang-format-${LLVM_VER} clang-tools-${LLVM_VER} \
103-
llvm-${LLVM_VER}-dev lld-${LLVM_VER} lldb-${LLVM_VER} llvm-${LLVM_VER}-tools libomp-${LLVM_VER}-dev libc++-${LLVM_VER}-dev libc++abi-${LLVM_VER}-dev \
104-
libclang-common-${LLVM_VER}-dev libclang-${LLVM_VER}-dev libclang-cpp${LLVM_VER}-dev libunwind-${LLVM_VER}-dev \
105-
libclang-rt-${LLVM_VER}-dev libpolly-${LLVM_VER}-dev --no-install-recommends \
106-
&& apt-get clean -y \
107-
&& rm -rf /var/lib/apt/lists/*
108-
109-
#
110-
# [Optional]
111-
112-
#
113-
# Install pip
114-
# hadolint ignore=DL3008
11515
RUN apt-get update \
116-
&& apt-get install -y --reinstall python3-venv python3-pip --no-install-recommends \
117-
&& apt-get clean -y \
118-
&& rm -rf /var/lib/apt/lists/*
16+
&& apt-get install -y apt-transport-https apt-utils build-essential \
17+
ca-certificates ccache clang-format-14 curl file g++-multilib git gnupg \
18+
libgcc-12-dev lib32gcc-12-dev libzstd-dev lsb-release \
19+
ninja-build ocaml ocamlbuild opam \
20+
python3-venv python3-pip \
21+
software-properties-common tree tzdata \
22+
unzip valgrind vim wget zip --no-install-recommends
11923

120-
#
121-
# Install required python packages
122-
# hadolint ignore=DL3013
123-
RUN python3 -m pip install --no-cache-dir --break-system-packages --upgrade pip \
124-
&& pip3 install --no-cache-dir --break-system-packages black nose pycparser pylint
24+
WORKDIR /opt
12525

126-
#
127-
# Install github-cli. It doens't work as a feature of devcontainer.json
128-
ARG GH_CLI_VER=2.32.0
129-
WORKDIR /tmp
130-
RUN wget -q https://github.com/cli/cli/releases/download/v${GH_CLI_VER}/gh_${GH_CLI_VER}_linux_amd64.deb \
131-
&& dpkg -i gh_${GH_CLI_VER}_linux_amd64.deb
26+
ARG WASI_SDK_VER=25
27+
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/wasi-sdk-${WASI_SDK_VER}.0-x86_64-linux.tar.gz -P /tmp \
28+
&& tar xf /tmp/wasi-sdk-${WASI_SDK_VER}.0-x86_64-linux.tar.gz -C /opt \
29+
&& ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0-x86_64-linux /opt/wasi-sdk
13230

133-
#
134-
# Install NodeJS
135-
RUN wget -qO- https://deb.nodesource.com/setup_20.x | bash -
136-
# hadolint ignore=DL3008
137-
RUN apt-get install -y nodejs --no-install-recommends
31+
ARG WABT_VER=1.0.37
32+
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu-20.04.tar.gz -P /tmp \
33+
&& tar xf /tmp/wabt-${WABT_VER}-ubuntu-20.04.tar.gz -C /opt \
34+
&& ln -sf /opt/wabt-${WABT_VER} /opt/wabt
13835

13936
# set path
140-
ENV PATH="/opt/bazelisk:/usr/lib/llvm-${LLVM_VER}/bin:${PATH}"
141-
ENV CC=/usr/lib/llvm-${LLVM_VER}/bin/clang CXX=/usr/lib/llvm-${LLVM_VER}/bin/clang++
142-
RUN printf "%s\n" "PS1='\n[ \u@wamr-dev-docker \W ]\n$ '" >> /root/.bashrc \
143-
&& apt-get autoremove -y \
37+
38+
# clean up
39+
RUN apt-get autoremove -y \
14440
&& apt-get clean -y \
14541
&& rm -rf /var/lib/apt/lists/* \
14642
&& rm -rf /tmp/*
147-
148-
# set workdir when container run
149-
VOLUME /workspaces
150-
WORKDIR /workspaces

.devcontainer/devcontainer.json

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,29 @@
1-
// Copyright (C) 2019 Intel Corporation. All rights reserved.
2-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3-
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
4-
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/cpp
51
{
62
"name": "WAMR-Dev",
73
"build": {
84
"dockerfile": "Dockerfile",
9-
// Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-12, debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
10-
// Use Debian 12, Debian 11, Debian 9, Ubuntu 18.04 or Ubuntu 21.04 on local arm64/Apple Silicon
115
"args": {
12-
"BINARYEN_VER": "114",
13-
"BAZELISK_VER": "1.17.0",
14-
"CMAKE_VER": "3.27.0",
15-
"EMSDK_VER": "3.1.43",
16-
"GH_CLI_VER": "2.32.0",
17-
"LLVM_VER": "16",
186
"VARIANT": "debian-12",
19-
"WASI_SDK_VER": "20",
20-
"WABT_VER": "1.0.33"
7+
"WASI_SDK_VER": "25",
8+
"WABT_VER": "1.0.37"
219
}
2210
},
2311
"runArgs": [
2412
"--cap-add=SYS_PTRACE",
2513
"--security-opt",
2614
"seccomp=unconfined"
2715
],
28-
// Configure tool-specific properties.
2916
"customizations": {
30-
// Configure properties specific to VS Code.
3117
"vscode": {
32-
// Set *default* container specific settings.json values on container create.
3318
"settings": {},
34-
// Add the IDs of extensions you want installed when the container is created.
3519
"extensions": [
3620
"dtsvet.vscode-wasm",
37-
"llvm-vs-code-extensions.vscode-clangd",
3821
"ms-python.python",
3922
"ms-python.vscode-pylance",
4023
"ms-vscode.cmake-tools"
4124
]
4225
}
4326
},
44-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
45-
// "forwardPorts": [],
46-
// Use 'postCreateCommand' to run commands after the container is created.
47-
"postCreateCommand": "curl https://sh.rustup.rs -sSf | bash -s -- -y",
48-
// Comment out this line to run as root instead.
27+
"postCreateCommand": "bash .devcontainer/finalize.sh",
4928
"remoteUser": "vscode"
5029
}

.devcontainer/finalize.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
echo "Running finalize script..."
2+
3+
#
4+
# Python Package Installation
5+
#
6+
echo "--- Installing Python Dependencies\n"
7+
8+
# Upgrade pip first
9+
python3 -m pip install --no-cache-dir --break-system-packages --upgrade pip
10+
# Install required packages
11+
pip3 install --no-cache-dir --break-system-packages -r .devcontainer/requirements.txt
12+
13+
echo "--- Installing Ocaml stuff\n"
14+
opam init --yes --shell-setup
15+
eval $(opam env --switch=default)
16+
opam install --yes dune menhir
17+
18+
echo "Finalize script completed. ✅"

.devcontainer/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
black
2+
nose
3+
pycparser
4+
pylint
5+
requests

.github/actions/install-wasi-sdk-wabt/action.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ runs:
5050
echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on ubuntu"
5151
working-directory: /opt
5252

53-
- name: Set up wasi-sdk and wabt on macOS-13 (intel)
54-
if: ${{ inputs.os == 'macos-13' }}
53+
- name: Set up wasi-sdk and wabt on macOS on Intel
54+
if: ${{ inputs.os == 'macos-15-intel' }}
5555
shell: bash
5656
run: |
57-
echo "Downloading wasi-sdk for macOS-13..."
57+
echo "Downloading wasi-sdk for macOS on Intel..."
5858
sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-macos.tar.gz
5959
6060
echo "Extracting wasi-sdk..."
6161
sudo tar -xf wasi-sdk.tar.gz
6262
sudo ln -sf wasi-sdk-25.0-x86_64-macos wasi-sdk
6363
64-
echo "Downloading wabt for macOS-13..."
64+
echo "Downloading wabt for macOS on Intel..."
6565
sudo wget -O wabt.tar.gz --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.36/wabt-1.0.36-macos-12.tar.gz
6666
6767
echo "Extracting wabt..."
@@ -71,21 +71,21 @@ runs:
7171
/opt/wasi-sdk/bin/clang --version
7272
/opt/wabt/bin/wasm-interp --version
7373
74-
echo "::notice::wasi-sdk-25 and wabt-1.0.36 installed on macos-13"
74+
echo "::notice::wasi-sdk-25 and wabt-1.0.36 installed on ${{ inputs.os }}"
7575
working-directory: /opt
7676

77-
- name: Set up wasi-sdk and wabt on macOS-14 (arm64)
78-
if: ${{ inputs.os == 'macos-14' }}
77+
- name: Set up wasi-sdk and wabt on macOS on ARM
78+
if: ${{ inputs.os == 'macos-15' }}
7979
shell: bash
8080
run: |
81-
echo "Downloading wasi-sdk for macOS-14..."
81+
echo "Downloading wasi-sdk for macOS on ARM..."
8282
sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-arm64-macos.tar.gz
8383
8484
echo "Extracting wasi-sdk..."
8585
sudo tar -xf wasi-sdk.tar.gz
8686
sudo ln -sf wasi-sdk-25.0-arm64-macos wasi-sdk
8787
88-
echo "Downloading wabt for macOS-14..."
88+
echo "Downloading wabt for macOS on ARM..."
8989
sudo wget -O wabt.tar.gz --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.37/wabt-1.0.37-macos-14.tar.gz
9090
9191
echo "Extracting wabt..."
@@ -95,7 +95,7 @@ runs:
9595
/opt/wasi-sdk/bin/clang --version
9696
/opt/wabt/bin/wasm-interp --version
9797
98-
echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on macos-14"
98+
echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on ${{ inputs.os }}"
9999
working-directory: /opt
100100

101101
- name: Set up wasi-sdk and wabt on Windows

0 commit comments

Comments
 (0)