Skip to content

Commit

Permalink
Merge branch main into dev/thread_suspension
Browse files Browse the repository at this point in the history
  • Loading branch information
wenyongh committed Oct 8, 2024
2 parents d00db2a + deacb7a commit 9dabca6
Show file tree
Hide file tree
Showing 101 changed files with 3,657 additions and 1,113 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v3.26.11
with:
languages: ${{ matrix.language }}

Expand All @@ -66,7 +66,7 @@ jobs:
- run: |
./.github/scripts/codeql_buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v3.26.11
with:
category: "/language:${{matrix.language}}"
upload: false
Expand Down Expand Up @@ -95,14 +95,14 @@ jobs:
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif

- name: Upload CodeQL results to code scanning
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@v3.26.11
with:
sarif_file: ${{ steps.step1.outputs.sarif-output }}
category: "/language:${{matrix.language}}"

- name: Upload CodeQL results as an artifact
if: success() || failure()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v4.4.0
with:
name: codeql-results
path: ${{ steps.step1.outputs.sarif-output }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/compilation_on_nuttx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ jobs:
run: make -j$(nproc) EXTRAFLAGS=-Werror

- name: Checkout Bloaty
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: google/bloaty
submodules: recursive
path: bloaty
ref: 34f4a66559ad4938c1e629e9b5f54630b2b4d7b0

- name: Build Bloaty
run: |
Expand Down
25 changes: 6 additions & 19 deletions .github/workflows/spec_test_on_nuttx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ jobs:
target: "riscv32",
fpu_type: "none"
},
{
config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
target: "riscv32_ilp32f",
fpu_type: "fp"
},
#{
# config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
# target: "riscv32_ilp32f",
# fpu_type: "fp"
#},
# {
# config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
# target: "riscv32_ilp32d",
Expand Down Expand Up @@ -327,19 +327,6 @@ jobs:
working-directory: apps/interpreters/wamr/wamr

- name: Test
if: matrix.target_config.target != 'xtensa'
run: |
cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -P -F ${{ steps.build_firmware_path.outputs.firmware }} ${{ matrix.wamr_feature_option.mode}}
# for xtensa, for some reasons, when running the tests
# with test_wamr.sh -P, nuttx occasionally hangs after
# "total segments stored 6" on the CI.
# i (yamamoto) couldn't reproduce it locally (macOS) even
# with the identical flash image.
# for now, run the tests without -P.
- name: Test
if: matrix.target_config.target == 'xtensa'
run: |
cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -F ${{ steps.build_firmware_path.outputs.firmware }} ${{ matrix.wamr_feature_option.mode}}
Expand All @@ -354,7 +341,7 @@ jobs:
- name: upload the log
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v4.4.0
with:
name: spec-test-log-${{ github.run_id }}-${{ strategy.job-index }}-${{ matrix.target_config.target }}
path: log
65 changes: 65 additions & 0 deletions .github/workflows/supply_chain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This workflow uses actions that are not certified by GitHub. They are provided
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.

# Check current WASM Micro Runtime results here: https://securityscorecards.dev/viewer/?uri=github.com/bytecodealliance/wasm-micro-runtime

name: Scorecard supply-chain security
on:
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
branch_protection_rule:
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
# midnight UTC
schedule:
- cron: "0 0 * * *"
# allow to be triggered manually
workflow_dispatch:

# Declare default permissions as read only.
permissions:
contents: read

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
if: github.repository == 'bytecodealliance/wasm-micro-runtime'
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Needed to publish results and get a badge (see publish_results below).
id-token: write

steps:
- name: "Checkout code"
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
with:
results_file: results.sarif
results_format: sarif

# - Publish results to OpenSSF REST API for easy access by consumers
# - Allows the repository to include the Scorecard badge.
# - See https://github.com/ossf/scorecard-action#publishing-results.
publish_results: true

# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@3eadd8b791cabf7cd572f194da82158c24125bd8 # v3.1.0
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@56d197570aa047eae7fe04401603196e2f68521d # v2.2.4
with:
sarif_file: results.sarif
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
.clangd
.DS_Store
*.o
.aider*

core/deps/**
core/shared/mem-alloc/tlsf
Expand Down
32 changes: 27 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,15 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})

include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)

set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow -Wno-unused-parameter -fvisibility=hidden")
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion")

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused")
if (NOT WIN32)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security \
-ffunction-sections -fdata-sections \
-Wno-unused-parameter -Wno-pedantic \
-fvisibility=hidden")
# Remove the extra spaces for better make log
string (REGEX REPLACE " *" " " CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused")
endif()

if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
Expand All @@ -145,6 +150,10 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
set (THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

if (MSVC)
add_definitions(-DCOMPILING_WASM_RUNTIME_API=1)
endif ()

# STATIC LIBRARY
if (WAMR_BUILD_STATIC)
add_library(iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE})
Expand All @@ -155,6 +164,14 @@ if (WAMR_BUILD_STATIC)
target_link_libraries(iwasm_static INTERFACE boringssl_crypto)
endif ()

if (MINGW)
target_link_libraries (iwasm_static PRIVATE ws2_32)
endif ()

if (WIN32)
target_link_libraries(iwasm_static PRIVATE ntdll)
endif()

install (TARGETS iwasm_static ARCHIVE DESTINATION lib)
endif ()

Expand All @@ -169,9 +186,14 @@ if (WAMR_BUILD_SHARED)
endif ()

if (MINGW)
target_link_libraries (iwasm_shared INTERFACE -lWs2_32 -lwsock32)
target_link_libraries(iwasm_shared INTERFACE -lWs2_32 -lwsock32)
target_link_libraries(iwasm_shared PRIVATE ws2_32)
endif ()

if (WIN32)
target_link_libraries(iwasm_shared PRIVATE ntdll)
endif()

install (TARGETS iwasm_shared LIBRARY DESTINATION lib)
endif ()

Expand Down
29 changes: 29 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# In this project, we use CODEOWNERS to identify people who are likely to know
# who should review a pull request.
#
# People listed in this file are committing to respond in a timely fashion to
# PRs in the selected areas. However, that response doesn't have to be a full
# code review; it could also take any of these forms:
#
# - "I intend to review this but I can't yet. Please leave me a message if I
# haven't responded by (a specific date in the near future)."
#
# - "I think (a specific other contributor) should review this." (Note that the
# best reviewer for a PR may not necessarily be listed in this file.)
#
# People must only be added to this file if they've agreed to provide one of
# the above responses in a reasonable amount of time for every PR to which
# they're assigned.
#
# We only ask for this commitment from people who are employed full-time to
# work on this project. We gratefully welcome reviews from other contributors,
# but we don't believe it's fair to ask volunteers to respond quickly.

# If none of the later patterns match, assign to anyone. This team is the
# parent of all the other teams and automatically includes everyone on those
# teams.
* @loganek @lum1n0us @no1wudi @wenyongh @xujuntwt95329 @yamt

# Some parts of the project require more specialized knowledge. In those areas
# we designate smaller groups who are more likely to be aware of who's working
# in specific areas.
12 changes: 11 additions & 1 deletion build-scripts/config_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ endif ()
if (WAMR_BUILD_DEBUG_AOT EQUAL 1)
message (" Debug AOT enabled")
endif ()
if (WAMR_BUILD_DYNAMIC_AOT_DEBUG EQUAL 1)
add_definitions (-DWASM_ENABLE_DYNAMIC_AOT_DEBUG=1)
message (" Dynamic AOT debug enabled")
endif ()
if (WAMR_BUILD_LOAD_CUSTOM_SECTION EQUAL 1)
add_definitions (-DWASM_ENABLE_LOAD_CUSTOM_SECTION=1)
message (" Load custom section enabled")
Expand Down Expand Up @@ -442,7 +446,9 @@ if (WAMR_BUILD_WASI_NN EQUAL 1)
message (" WASI-NN enabled")
add_definitions (-DWASM_ENABLE_WASI_NN=1)
# Variant backends
if (NOT WAMR_BUILD_WASI_NN_TFLITE EQUAL 1 AND NOT WAMR_BUILD_WASI_NN_OPENVINO EQUAL 1)
if (NOT WAMR_BUILD_WASI_NN_TFLITE EQUAL 1 AND
NOT WAMR_BUILD_WASI_NN_OPENVINO EQUAL 1 AND
NOT WAMR_BUILD_WASI_NN_LLAMACPP EQUAL 1)
message (FATAL_ERROR " Need to select a backend for WASI-NN")
endif ()

Expand All @@ -454,6 +460,10 @@ if (WAMR_BUILD_WASI_NN EQUAL 1)
message (" WASI-NN: backend openvino enabled")
add_definitions (-DWASM_ENABLE_WASI_NN_OPENVINO)
endif ()
if (WAMR_BUILD_WASI_NN_LLAMACPP EQUAL 1)
message (" WASI-NN: backend llamacpp enabled")
add_definitions (-DWASM_ENABLE_WASI_NN_LLAMACPP)
endif ()
# Variant devices
if (WAMR_BUILD_WASI_NN_ENABLE_GPU EQUAL 1)
message (" WASI-NN: GPU enabled")
Expand Down
4 changes: 4 additions & 0 deletions core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
#define WASM_ENABLE_AOT 0
#endif

#ifndef WASM_ENABLE_DYNAMIC_AOT_DEBUG
#define WASM_ENABLE_DYNAMIC_AOT_DEBUG 0
#endif

#ifndef WASM_ENABLE_WORD_ALIGN_READ
#define WASM_ENABLE_WORD_ALIGN_READ 0
#endif
Expand Down
Loading

0 comments on commit 9dabca6

Please sign in to comment.