Compare commits

..

No commits in common. "main" and "WAMR-2.4.1" have entirely different histories.

40 changed files with 217 additions and 557 deletions

View File

@ -97,9 +97,9 @@ jobs:
matrix: matrix:
include: include:
- build_options: $DEFAULT_BUILD_OPTIONS - build_options: $DEFAULT_BUILD_OPTIONS
suffix: "" suffix: ''
- build_options: $GC_EH_BUILD_OPTIONS - build_options: $GC_EH_BUILD_OPTIONS
suffix: "-gc-eh" suffix: '-gc-eh'
permissions: permissions:
contents: write # for uploading release artifacts contents: write # for uploading release artifacts
@ -126,30 +126,6 @@ jobs:
cmake --build build --config Release --parallel 4 cmake --build build --config Release --parallel 4
working-directory: ${{ inputs.cwd }} working-directory: ${{ inputs.cwd }}
- name: smoke test on non-Windows
if: ${{ !startsWith(inputs.runner, 'windows') }}
shell: bash
run: |
if [[ ! -f build/iwasm ]]; then
echo "iwasm binary is not found in the expected location."
exit 1
fi
build/iwasm --version
working-directory: ${{ inputs.cwd }}
- name: smoke test on Windows
if: ${{ startsWith(inputs.runner, 'windows') }}
shell: bash
run: |
if [[ ! -f build/Release/iwasm ]]; then
echo "iwasm binary is not found in the expected location."
exit 1
fi
build/Release/iwasm --version
working-directory: ${{ inputs.cwd }}
- name: Compress the binary on Windows - name: Compress the binary on Windows
if: inputs.runner == 'windows-latest' if: inputs.runner == 'windows-latest'
run: | run: |

View File

@ -62,30 +62,6 @@ jobs:
cmake --build build --config Release --parallel 4 cmake --build build --config Release --parallel 4
working-directory: wamr-compiler working-directory: wamr-compiler
- name: smoke test on non-windows
if: ${{ !startsWith(inputs.runner, 'windows') }}
shell: bash
run: |
if [[ ! -f build/wamrc ]]; then
echo "wamrc binary is not found in the expected location."
exit 1
fi
build/wamrc --version
working-directory: wamr-compiler
- name: smoke test on Windows
if: ${{ startsWith(inputs.runner, 'windows') }}
shell: bash
run: |
if [[ ! -f build/Release/wamrc ]]; then
echo "wamrc binary is not found in the expected location."
exit 1
fi
build/Release/wamrc --version
working-directory: wamr-compiler
- name: Compress the binary on Windows - name: Compress the binary on Windows
if: inputs.runner == 'windows-latest' && inputs.release if: inputs.runner == 'windows-latest' && inputs.release
run: | run: |

View File

@ -53,7 +53,7 @@ jobs:
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v3.29.4 uses: github/codeql-action/init@v3.29.3
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
@ -70,7 +70,7 @@ jobs:
- run: | - run: |
./.github/scripts/codeql_buildscript.sh ./.github/scripts/codeql_buildscript.sh
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.29.4 uses: github/codeql-action/analyze@v3.29.3
with: with:
category: "/language:${{matrix.language}}" category: "/language:${{matrix.language}}"
upload: false upload: false
@ -99,7 +99,7 @@ jobs:
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
- name: Upload CodeQL results to code scanning - name: Upload CodeQL results to code scanning
uses: github/codeql-action/upload-sarif@v3.29.4 uses: github/codeql-action/upload-sarif@v3.29.3
with: with:
sarif_file: ${{ steps.step1.outputs.sarif-output }} sarif_file: ${{ steps.step1.outputs.sarif-output }}
category: "/language:${{matrix.language}}" category: "/language:${{matrix.language}}"

View File

@ -371,47 +371,6 @@ jobs:
ctest ctest
working-directory: tests/unit working-directory: tests/unit
build_regression_tests:
needs:
[build_llvm_libraries_on_ubuntu_2204]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
include:
- os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: Get LLVM libraries
id: retrieve_llvm_libs
uses: actions/cache@v4
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ${{ matrix.llvm_cache_key }}
- name: Quit if cache miss
if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Build wamrc and iwasm
run: |
./build_wamr.sh
working-directory: tests/regression/ba-issues
- name: Run regression tests
run: |
python run.py
working-directory: tests/regression/ba-issues
build_samples_wasm_c_api: build_samples_wasm_c_api:
needs: needs:
[ [

View File

@ -11,26 +11,6 @@ on:
type: boolean type: boolean
required: false required: false
default: false default: false
release_wamr_sdk:
description: "If the WAMR SDK in the release"
type: boolean
required: false
default: false
release_wamr_lldb:
description: "If the WAMR LLDB in the release"
type: boolean
required: false
default: false
release_wamr_ide_vscode_ext:
description: "If the WAMR VSCode extension in the release"
type: boolean
required: false
default: false
release_wamr_wasi_ext:
description: "If the WAMR WASI extensions in the release"
type: boolean
required: false
default: true
# Cancel any in-flight jobs for the same PR/branch so there's only one active # Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time # at a time
@ -113,7 +93,7 @@ jobs:
release_wamrc_on_ubuntu_2204: release_wamrc_on_ubuntu_2204:
permissions: permissions:
contents: write # upload release artifact contents: write # upload release artifact
needs: [create_tag, create_release, build_llvm_libraries_on_ubuntu_2204] needs: [create_tag, create_release, build_llvm_libraries_on_ubuntu_2204 ]
uses: ./.github/workflows/build_wamrc.yml uses: ./.github/workflows/build_wamrc.yml
with: with:
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }} llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
@ -190,7 +170,6 @@ jobs:
permissions: permissions:
contents: write # upload release artifact contents: write # upload release artifact
needs: [create_tag, create_release] needs: [create_tag, create_release]
if: ${{ inputs.release_wamr_sdk }}
uses: ./.github/workflows/build_wamr_sdk.yml uses: ./.github/workflows/build_wamr_sdk.yml
with: with:
config_file: wamr_config_ubuntu_release.cmake config_file: wamr_config_ubuntu_release.cmake
@ -204,7 +183,6 @@ jobs:
permissions: permissions:
contents: write # upload release artifact contents: write # upload release artifact
needs: [create_tag, create_release] needs: [create_tag, create_release]
if: ${{ inputs.release_wamr_sdk }}
uses: ./.github/workflows/build_wamr_sdk.yml uses: ./.github/workflows/build_wamr_sdk.yml
with: with:
config_file: wamr_config_macos_release.cmake config_file: wamr_config_macos_release.cmake
@ -214,29 +192,30 @@ jobs:
wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-macos.tar.gz wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-macos.tar.gz
wamr_app_framework_url: https://github.com/bytecodealliance/wamr-app-framework.git wamr_app_framework_url: https://github.com/bytecodealliance/wamr-app-framework.git
# vscode extension cross-platform # Let's disable it for now and reopen it when the actual requirement arises.
release_wamr_ide_vscode_ext: # Please ensure all dependencies have been updated before reopening.
permissions:
contents: write # upload release artifact
needs: [create_tag, create_release]
if: ${{ inputs.release_wamr_ide_vscode_ext}}
uses: ./.github/workflows/build_wamr_vscode_ext.yml
secrets: inherit
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver }}
# #
# vscode extension docker images package # # vscode extension cross-platform
release_wamr_ide_docker_images_package: # release_wamr_ide_vscode_ext:
permissions: # permissions:
contents: write # upload release artifact # contents: write # upload release artifact
needs: [create_tag, create_release] # needs: [create_tag, create_release]
if: ${{ inputs.release_wamr_ide_vscode_ext}} # uses: ./.github/workflows/build_wamr_vscode_ext.yml
uses: ./.github/workflows/build_docker_images.yml # secrets: inherit
with: # with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver }} # ver_num: ${{ needs.create_tag.outputs.new_ver }}
# #
# # vscode extension docker images package
# release_wamr_ide_docker_images_package:
# permissions:
# contents: write # upload release artifact
# needs: [create_tag, create_release]
# uses: ./.github/workflows/build_docker_images.yml
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# ver_num: ${{ needs.create_tag.outputs.new_ver }}
# #
# WAMR_LLDB # WAMR_LLDB
@ -244,7 +223,6 @@ jobs:
permissions: permissions:
contents: write # upload release artifact contents: write # upload release artifact
needs: [create_tag, create_release] needs: [create_tag, create_release]
if: ${{ inputs.release_wamr_lldb }}
uses: ./.github/workflows/build_wamr_lldb.yml uses: ./.github/workflows/build_wamr_lldb.yml
with: with:
runner: ubuntu-22.04 runner: ubuntu-22.04
@ -255,7 +233,6 @@ jobs:
permissions: permissions:
contents: write # upload release artifact contents: write # upload release artifact
needs: [create_tag, create_release] needs: [create_tag, create_release]
if: ${{ inputs.release_wamr_lldb }}
uses: ./.github/workflows/build_wamr_lldb.yml uses: ./.github/workflows/build_wamr_lldb.yml
with: with:
runner: macos-13 runner: macos-13
@ -267,7 +244,6 @@ jobs:
permissions: permissions:
contents: write # upload release artifact contents: write # upload release artifact
needs: [create_tag, create_release] needs: [create_tag, create_release]
if: ${{ inputs.release_wamr_wasi_ext }}
uses: ./.github/workflows/build_wamr_wasi_extensions.yml uses: ./.github/workflows/build_wamr_wasi_extensions.yml
with: with:
upload_url: ${{ needs.create_release.outputs.upload_url }} upload_url: ${{ needs.create_release.outputs.upload_url }}

View File

@ -60,6 +60,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard. # Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@701df0e49d84a24bd8f0d01f80c0dbf69ab07674 uses: github/codeql-action/upload-sarif@7710ed11e398ea99c7f7004c2b2e0f580458db42
with: with:
sarif_file: results.sarif sarif_file: results.sarif

View File

@ -99,12 +99,6 @@ if (WAMR_BUILD_JIT EQUAL 1)
# Enable Lazy JIT by default # Enable Lazy JIT by default
set (WAMR_BUILD_LAZY_JIT 1) set (WAMR_BUILD_LAZY_JIT 1)
endif () endif ()
# In Debug mode, always use release builds of pre-built dependency libraries
if (WAMR_BUILD_PLATFORM STREQUAL "windows" AND MSVC)
add_compile_options($<$<CONFIG:Debug>:/MD>)
endif()
if (NOT DEFINED LLVM_DIR) if (NOT DEFINED LLVM_DIR)
set (LLVM_SRC_ROOT "${WAMR_ROOT_DIR}/core/deps/llvm") set (LLVM_SRC_ROOT "${WAMR_ROOT_DIR}/core/deps/llvm")
set (LLVM_BUILD_ROOT "${LLVM_SRC_ROOT}/build") set (LLVM_BUILD_ROOT "${LLVM_SRC_ROOT}/build")
@ -147,59 +141,29 @@ include (${WAMR_ROOT_DIR}/build-scripts/package.cmake)
if (NOT DEFINED WAMR_BUILD_SANITIZER) if (NOT DEFINED WAMR_BUILD_SANITIZER)
set(WAMR_BUILD_SANITIZER $ENV{WAMR_BUILD_SANITIZER}) set(WAMR_BUILD_SANITIZER $ENV{WAMR_BUILD_SANITIZER})
endif()
if (NOT WAMR_BUILD_SANITIZER STREQUAL "")
set(SUPPORTED_SANITIZERS "ubsan;asan;tsan;posan")
string(REPLACE "," ";" SANITIZER_LIST "${WAMR_BUILD_SANITIZER}")
# Check uncompabile sanitizers
if("tsan" IN_LIST SANITIZER_LIST AND "asan" IN_LIST SANITIZER_LIST)
message(FATAL_ERROR "ThreadSanitizer (tsan) and AddressSanitizer (asan) cannot be used together!")
endif()
# Check every sanitizer in the list
set(INVALID_SANITIZERS "")
list(REMOVE_DUPLICATES SANITIZER_LIST)
set(SANITIZER_FLAGS)
set(NO_SANITIZER_FLAGS)
foreach(sanitizer ${SANITIZER_LIST})
string(STRIP "${sanitizer}" sanitizer)
if(NOT sanitizer IN_LIST SUPPORTED_SANITIZERS)
list(APPEND INVALID_SANITIZERS "${sanitizer}")
elseif(sanitizer STREQUAL "ubsan")
list(APPEND SANITIZER_FLAGS "undefined")
list(APPEND NO_SANITIZER_FLAGS "alignment")
elseif(sanitizer STREQUAL "asan")
if (NOT WAMR_BUILD_JIT EQUAL 1)
set(ENV{ASAN_OPTIONS} "verbosity=2 debug=true")
list(APPEND SANITIZER_FLAGS "address")
else()
message(WARNING "AddressSanitizer is not supported in LLVM JIT mode, skip it")
endif()
elseif(sanitizer STREQUAL "tsan")
list(APPEND SANITIZER_FLAGS "thread")
elseif(sanitizer STREQUAL "posan")
list(APPEND SANITIZER_FLAGS "pointer-overflow")
endif()
endforeach()
if(INVALID_SANITIZERS)
message(FATAL_ERROR "Unsupported sanitizers: ${INVALID_SANITIZERS}")
endif()
# common flags for all sanitizers
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fno-sanitize-recover=all")
if(SANITIZER_FLAGS)
string(REPLACE ";" "," SANITIZER_FLAGS_STR "${SANITIZER_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${SANITIZER_FLAGS_STR}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${SANITIZER_FLAGS_STR}")
endif()
if(NO_SANITIZER_FLAGS)
string(REPLACE ";" "," NO_SANITIZER_FLAGS_STR "${NO_SANITIZER_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize=${NO_SANITIZER_FLAGS_STR}")
endif()
endif () endif ()
if (NOT DEFINED WAMR_BUILD_SANITIZER)
set(WAMR_BUILD_SANITIZER "")
elseif (WAMR_BUILD_SANITIZER STREQUAL "ubsan")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all -fno-sanitize=alignment" )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
elseif (WAMR_BUILD_SANITIZER STREQUAL "asan")
if (NOT WAMR_BUILD_JIT EQUAL 1)
set (ASAN_OPTIONS "verbosity=2 debug=true ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=address -fno-sanitize-recover=all" )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
endif()
elseif (WAMR_BUILD_SANITIZER STREQUAL "tsan")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=thread -fno-sanitize-recover=all" )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
elseif (WAMR_BUILD_SANITIZER STREQUAL "posan")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=pointer-overflow -fno-sanitize-recover=all" )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=pointer-overflow")
elseif (NOT (WAMR_BUILD_SANITIZER STREQUAL "") )
message(SEND_ERROR "Unsupported sanitizer: ${WAMR_BUILD_SANITIZER}")
endif()
if (WAMR_BUILD_LINUX_PERF EQUAL 1) if (WAMR_BUILD_LINUX_PERF EQUAL 1)
if (NOT WAMR_BUILD_JIT AND NOT WAMR_BUILD_AOT) if (NOT WAMR_BUILD_JIT AND NOT WAMR_BUILD_AOT)
message(WARNING "only support perf in aot and llvm-jit") message(WARNING "only support perf in aot and llvm-jit")

View File

@ -1786,8 +1786,7 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
read_uint32(buf, buf_end, j); read_uint32(buf, buf_end, j);
#if WASM_ENABLE_AOT_VALIDATOR != 0 #if WASM_ENABLE_AOT_VALIDATOR != 0
/* an equivalence type should be before the type it refers to */ if (j >= module->type_count) {
if (j > i) {
set_error_buf(error_buf, error_buf_size, "invalid type index"); set_error_buf(error_buf, error_buf_size, "invalid type index");
goto fail; goto fail;
} }
@ -1806,12 +1805,7 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
read_uint32(buf, buf_end, parent_type_idx); read_uint32(buf, buf_end, parent_type_idx);
read_uint16(buf, buf_end, rec_count); read_uint16(buf, buf_end, rec_count);
read_uint16(buf, buf_end, rec_idx); read_uint16(buf, buf_end, rec_idx);
#if WASM_ENABLE_AOT_VALIDATOR != 0
if (rec_idx > i) {
set_error_buf(error_buf, error_buf_size, "invalid rec_idx");
goto fail;
}
#endif
if (type_flag == WASM_TYPE_FUNC) { if (type_flag == WASM_TYPE_FUNC) {
AOTFuncType *func_type; AOTFuncType *func_type;

View File

@ -1,3 +0,0 @@
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -79,6 +79,3 @@ return:
add sp, sp, #0x30 /* restore sp */ add sp, sp, #0x30 /* restore sp */
ret ret
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -77,6 +77,3 @@ return:
add sp, sp, #0x30 /* restore sp */ add sp, sp, #0x30 /* restore sp */
ret ret
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -67,6 +67,3 @@ call_func:
j_s [blink] /* ret */ j_s [blink] /* ret */
nop_s nop_s
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -73,6 +73,3 @@ return:
add sp, sp, #4 add sp, sp, #4
ldmfd sp!, {r4, r5, r6, r7, lr} ldmfd sp!, {r4, r5, r6, r7, lr}
bx lr bx lr
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -84,6 +84,3 @@ return:
ldmfd sp!, {r4, r5, r6, r7, lr} ldmfd sp!, {r4, r5, r6, r7, lr}
bx lr bx lr
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -62,6 +62,3 @@ push_args_end:
leave leave
ret ret
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -62,6 +62,3 @@ push_args_end:
leave leave
ret ret
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -35,6 +35,3 @@ skip_push_args:
leave leave
ret ret
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -72,6 +72,3 @@ done:
j $31 j $31
.end invokeNative .end invokeNative
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -89,6 +89,3 @@ return:
pop {r4, r5, r6, r7} pop {r4, r5, r6, r7}
mov lr, r3 mov lr, r3
bx lr bx lr
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -98,6 +98,3 @@ return:
mov lr, r3 mov lr, r3
bx lr bx lr
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -72,6 +72,3 @@ call_func:
return: return:
retw.n retw.n
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -199,8 +199,6 @@ wasm_runtime_create_shared_heap(SharedHeapInitArgs *init_args)
heap->heap_handle = NULL; heap->heap_handle = NULL;
heap->base_addr = init_args->pre_allocated_addr; heap->base_addr = init_args->pre_allocated_addr;
LOG_VERBOSE("Create preallocated shared heap %p with size %u",
heap->base_addr, size);
} }
else { else {
if (!(heap->heap_handle = if (!(heap->heap_handle =
@ -227,8 +225,6 @@ wasm_runtime_create_shared_heap(SharedHeapInitArgs *init_args)
LOG_WARNING("init share heap failed"); LOG_WARNING("init share heap failed");
goto fail4; goto fail4;
} }
LOG_VERBOSE("Create pool shared heap %p with size %u", heap->base_addr,
size);
} }
os_mutex_lock(&shared_heap_list_lock); os_mutex_lock(&shared_heap_list_lock);
@ -513,8 +509,6 @@ wasm_runtime_attach_shared_heap_internal(WASMModuleInstanceCommon *module_inst,
os_mutex_lock(&shared_heap_list_lock); os_mutex_lock(&shared_heap_list_lock);
shared_heap->attached_count++; shared_heap->attached_count++;
os_mutex_unlock(&shared_heap_list_lock); os_mutex_unlock(&shared_heap_list_lock);
LOG_VERBOSE("Shared heap %p is attached to module instance %p", shared_heap,
module_inst);
return true; return true;
} }
@ -576,7 +570,6 @@ wasm_runtime_detach_shared_heap_internal(WASMModuleInstanceCommon *module_inst)
e->shared_heap_base_addr_adj = NULL; e->shared_heap_base_addr_adj = NULL;
} }
#endif /* end of WASM_ENABLE_AOT != 0 */ #endif /* end of WASM_ENABLE_AOT != 0 */
LOG_VERBOSE("Shared heap is detached from module instance %p", module_inst);
} }
void void

View File

@ -400,7 +400,8 @@ check_array_type(const WASMModule *module, uint32 type_index, char *error_buf,
error_buf_size)) { error_buf_size)) {
return false; return false;
} }
if (module->types[type_index]->type_flag != WASM_TYPE_ARRAY) { if (module->types[type_index] == NULL
|| module->types[type_index]->type_flag != WASM_TYPE_ARRAY) {
set_error_buf(error_buf, error_buf_size, "unknown array type"); set_error_buf(error_buf, error_buf_size, "unknown array type");
return false; return false;
} }
@ -423,7 +424,8 @@ check_function_type(const WASMModule *module, uint32 type_index,
} }
#if WASM_ENABLE_GC != 0 #if WASM_ENABLE_GC != 0
if (module->types[type_index]->type_flag != WASM_TYPE_FUNC) { if (module->types[type_index] == NULL
|| module->types[type_index]->type_flag != WASM_TYPE_FUNC) {
set_error_buf(error_buf, error_buf_size, "unknown function type"); set_error_buf(error_buf, error_buf_size, "unknown function type");
return false; return false;
} }
@ -1255,7 +1257,8 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end,
error_buf_size)) { error_buf_size)) {
goto fail; goto fail;
} }
if (module->types[type_idx]->type_flag if (module->types[type_idx] == NULL
|| module->types[type_idx]->type_flag
!= WASM_TYPE_STRUCT) { != WASM_TYPE_STRUCT) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown struct type"); "unknown struct type");
@ -2496,13 +2499,6 @@ load_type_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
#endif /* end of WASM_ENABLE_GC == 0 */ #endif /* end of WASM_ENABLE_GC == 0 */
} }
for (i = 0; i < module->type_count; i++) {
if (module->types[i] == NULL) {
set_error_buf_v(error_buf, error_buf_size, "unknown type %d", i);
return false;
}
}
if (p != p_end) { if (p != p_end) {
set_error_buf(error_buf, error_buf_size, "section size mismatch"); set_error_buf(error_buf, error_buf_size, "section size mismatch");
return false; return false;
@ -12689,7 +12685,9 @@ re_scan:
error_buf, error_buf_size)) { error_buf, error_buf_size)) {
goto fail; goto fail;
} }
if (module->types[type_idx1]->type_flag != WASM_TYPE_FUNC) { if (module->types[type_idx1] == NULL
|| module->types[type_idx1]->type_flag
!= WASM_TYPE_FUNC) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown function type"); "unknown function type");
goto fail; goto fail;
@ -12706,7 +12704,9 @@ re_scan:
error_buf, error_buf_size)) { error_buf, error_buf_size)) {
goto fail; goto fail;
} }
if (module->types[type_idx]->type_flag != WASM_TYPE_FUNC) { if (module->types[type_idx] == NULL
|| module->types[type_idx]->type_flag
!= WASM_TYPE_FUNC) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown function type"); "unknown function type");
goto fail; goto fail;
@ -14542,7 +14542,8 @@ re_scan:
error_buf_size)) { error_buf_size)) {
goto fail; goto fail;
} }
if (module->types[type_idx]->type_flag if (module->types[type_idx] == NULL
|| module->types[type_idx]->type_flag
!= WASM_TYPE_STRUCT) { != WASM_TYPE_STRUCT) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown struct type"); "unknown struct type");
@ -14629,7 +14630,8 @@ re_scan:
error_buf_size)) { error_buf_size)) {
goto fail; goto fail;
} }
if (module->types[type_idx]->type_flag if (module->types[type_idx] == NULL
|| module->types[type_idx]->type_flag
!= WASM_TYPE_STRUCT) { != WASM_TYPE_STRUCT) {
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"unknown struct type"); "unknown struct type");

View File

@ -219,9 +219,6 @@ getaddrinfo(const char *node, const char *service, const struct addrinfo *hints,
void void
freeaddrinfo(struct addrinfo *res); freeaddrinfo(struct addrinfo *res);
const char *
gai_strerror(int code);
#endif #endif
/** /**

View File

@ -590,28 +590,6 @@ freeaddrinfo(struct addrinfo *res)
free(res); free(res);
} }
const char *
gai_strerror(int code)
{
switch (code) {
#define ERR(a) \
case a: \
return #a
ERR(EAI_AGAIN);
ERR(EAI_BADFLAGS);
ERR(EAI_FAIL);
ERR(EAI_FAMILY);
ERR(EAI_MEMORY);
ERR(EAI_NONAME);
ERR(EAI_OVERFLOW);
ERR(EAI_SERVICE);
ERR(EAI_SOCKTYPE);
ERR(EAI_SYSTEM);
#undef ERR
}
return "Unknown error";
}
static struct timeval static struct timeval
time_us_to_timeval(uint64_t time_us) time_us_to_timeval(uint64_t time_us)
{ {

View File

@ -4,7 +4,6 @@
*/ */
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <pthread.h> #include <pthread.h>
@ -29,15 +28,6 @@ test_nslookup(int af)
hints.ai_family = af; hints.ai_family = af;
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
int ret = getaddrinfo(url, 0, &hints, &res); int ret = getaddrinfo(url, 0, &hints, &res);
if (ret != 0) {
if (ret == EAI_SYSTEM) {
fprintf(stderr, "getaddrinfo failed: %s (%s)\n", gai_strerror(ret),
strerror(errno));
}
else {
fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(ret));
}
}
assert(ret == 0); assert(ret == 0);
struct addrinfo *address = res; struct addrinfo *address = res;
while (address) { while (address) {

View File

@ -507,35 +507,10 @@ fail:
return res; return res;
} }
static wasi_nn_error
copyin_and_nul_terminate(wasm_module_inst_t inst, char *name, uint32_t name_len,
char **resultp)
{
char *nul_terminated_name;
if (!wasm_runtime_validate_native_addr(inst, name, name_len)) {
return invalid_argument;
}
nul_terminated_name = wasm_runtime_malloc(name_len + 1);
if (nul_terminated_name == NULL) {
return runtime_error;
}
bh_memcpy_s(nul_terminated_name, name_len + 1, name, name_len);
nul_terminated_name[name_len] = '\0'; /* ensure NUL termination */
if (strlen(nul_terminated_name) != name_len) {
/* reject names containing '\0' for now */
wasm_runtime_free(nul_terminated_name);
return invalid_argument;
}
*resultp = nul_terminated_name;
return success;
}
wasi_nn_error wasi_nn_error
wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len, wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len,
graph *g) graph *g)
{ {
WASINNContext *wasi_nn_ctx = NULL;
char *nul_terminated_name = NULL;
wasi_nn_error res; wasi_nn_error res;
wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env); wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env);
@ -543,21 +518,25 @@ wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len,
return runtime_error; return runtime_error;
} }
if (!wasm_runtime_validate_native_addr(instance, name, name_len)) {
NN_ERR_PRINTF("name is invalid");
return invalid_argument;
}
if (!wasm_runtime_validate_native_addr(instance, g, if (!wasm_runtime_validate_native_addr(instance, g,
(uint64)sizeof(graph))) { (uint64)sizeof(graph))) {
NN_ERR_PRINTF("graph is invalid"); NN_ERR_PRINTF("graph is invalid");
return invalid_argument; return invalid_argument;
} }
res = copyin_and_nul_terminate(instance, name, name_len, if (name_len == 0 || name[name_len] != '\0') {
&nul_terminated_name); NN_ERR_PRINTF("Invalid filename");
if (res != success) { return invalid_argument;
goto fail;
} }
NN_DBG_PRINTF("[WASI NN] LOAD_BY_NAME %s...", nul_terminated_name); NN_DBG_PRINTF("[WASI NN] LOAD_BY_NAME %s...", name);
wasi_nn_ctx = lock_ctx(instance); WASINNContext *wasi_nn_ctx = lock_ctx(instance);
if (wasi_nn_ctx == NULL) { if (wasi_nn_ctx == NULL) {
res = busy; res = busy;
goto fail; goto fail;
@ -568,20 +547,14 @@ wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len,
goto fail; goto fail;
call_wasi_nn_func(wasi_nn_ctx->backend, load_by_name, res, call_wasi_nn_func(wasi_nn_ctx->backend, load_by_name, res,
wasi_nn_ctx->backend_ctx, nul_terminated_name, name_len, wasi_nn_ctx->backend_ctx, name, name_len, g);
g);
if (res != success) if (res != success)
goto fail; goto fail;
wasi_nn_ctx->is_model_loaded = true; wasi_nn_ctx->is_model_loaded = true;
res = success; res = success;
fail: fail:
if (nul_terminated_name != NULL) {
wasm_runtime_free(nul_terminated_name);
}
if (wasi_nn_ctx != NULL) {
unlock_ctx(wasi_nn_ctx); unlock_ctx(wasi_nn_ctx);
}
return res; return res;
} }
@ -590,9 +563,6 @@ wasi_nn_load_by_name_with_config(wasm_exec_env_t exec_env, char *name,
int32_t name_len, char *config, int32_t name_len, char *config,
int32_t config_len, graph *g) int32_t config_len, graph *g)
{ {
WASINNContext *wasi_nn_ctx = NULL;
char *nul_terminated_name = NULL;
char *nul_terminated_config = NULL;
wasi_nn_error res; wasi_nn_error res;
wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env); wasm_module_inst_t instance = wasm_runtime_get_module_inst(exec_env);
@ -600,27 +570,30 @@ wasi_nn_load_by_name_with_config(wasm_exec_env_t exec_env, char *name,
return runtime_error; return runtime_error;
} }
if (!wasm_runtime_validate_native_addr(instance, name, name_len)) {
NN_ERR_PRINTF("name is invalid");
return invalid_argument;
}
if (!wasm_runtime_validate_native_addr(instance, g, if (!wasm_runtime_validate_native_addr(instance, g,
(uint64)sizeof(graph))) { (uint64)sizeof(graph))) {
NN_ERR_PRINTF("graph is invalid"); NN_ERR_PRINTF("graph is invalid");
return invalid_argument; return invalid_argument;
} }
res = copyin_and_nul_terminate(instance, name, name_len, if (name_len == 0 || name[name_len] != '\0') {
&nul_terminated_name); NN_ERR_PRINTF("Invalid filename");
if (res != success) { return invalid_argument;
goto fail;
}
res = copyin_and_nul_terminate(instance, config, config_len,
&nul_terminated_config);
if (res != success) {
goto fail;
} }
NN_DBG_PRINTF("[WASI NN] LOAD_BY_NAME_WITH_CONFIG %s %s...", if (!config || config_len == 0 || config[config_len] != '\0') {
nul_terminated_name, nul_terminated_config); NN_ERR_PRINTF("Invalid config");
return invalid_argument;
}
wasi_nn_ctx = lock_ctx(instance); NN_DBG_PRINTF("[WASI NN] LOAD_BY_NAME_WITH_CONFIG %s %s...", name, config);
WASINNContext *wasi_nn_ctx = lock_ctx(instance);
if (wasi_nn_ctx == NULL) { if (wasi_nn_ctx == NULL) {
res = busy; res = busy;
goto fail; goto fail;
@ -632,23 +605,15 @@ wasi_nn_load_by_name_with_config(wasm_exec_env_t exec_env, char *name,
; ;
call_wasi_nn_func(wasi_nn_ctx->backend, load_by_name_with_config, res, call_wasi_nn_func(wasi_nn_ctx->backend, load_by_name_with_config, res,
wasi_nn_ctx->backend_ctx, nul_terminated_name, name_len, wasi_nn_ctx->backend_ctx, name, name_len, config,
nul_terminated_config, config_len, g); config_len, g);
if (res != success) if (res != success)
goto fail; goto fail;
wasi_nn_ctx->is_model_loaded = true; wasi_nn_ctx->is_model_loaded = true;
res = success; res = success;
fail: fail:
if (nul_terminated_name != NULL) {
wasm_runtime_free(nul_terminated_name);
}
if (nul_terminated_config != NULL) {
wasm_runtime_free(nul_terminated_config);
}
if (wasi_nn_ctx != NULL) {
unlock_ctx(wasi_nn_ctx); unlock_ctx(wasi_nn_ctx);
}
return res; return res;
} }

View File

@ -9,7 +9,6 @@
#include "wasi_nn_backend.h" #include "wasi_nn_backend.h"
#include "wasm_export.h" #include "wasm_export.h"
#include <tensorflow/lite/c/c_api.h>
#include <tensorflow/lite/interpreter.h> #include <tensorflow/lite/interpreter.h>
#include <tensorflow/lite/kernels/register.h> #include <tensorflow/lite/kernels/register.h>
#include <tensorflow/lite/model.h> #include <tensorflow/lite/model.h>
@ -280,20 +279,9 @@ set_input(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
tensor *input_tensor) tensor *input_tensor)
{ {
TFLiteContext *tfl_ctx = (TFLiteContext *)tflite_ctx; TFLiteContext *tfl_ctx = (TFLiteContext *)tflite_ctx;
TfLiteType tfl_type;
switch (input_tensor->type) { if (input_tensor->type != fp32) {
case fp32: NN_ERR_PRINTF("unsupported input tensor type %u", input_tensor->type);
tfl_type = TfLiteType::kTfLiteFloat32;
break;
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
case u8:
tfl_type = TfLiteType::kTfLiteUInt8;
break;
#endif
default:
NN_ERR_PRINTF("unsupported input tensor type %u",
input_tensor->type);
return runtime_error; return runtime_error;
} }
@ -301,32 +289,19 @@ set_input(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
if (success != (res = is_valid_graph_execution_context(tfl_ctx, ctx))) if (success != (res = is_valid_graph_execution_context(tfl_ctx, ctx)))
return res; return res;
auto interpreter = tfl_ctx->interpreters[ctx].interpreter.get(); uint32_t num_tensors =
tfl_ctx->interpreters[ctx].interpreter->inputs().size();
uint32_t num_tensors = interpreter->inputs().size();
NN_DBG_PRINTF("Number of tensors (%d)", num_tensors); NN_DBG_PRINTF("Number of tensors (%d)", num_tensors);
if (index + 1 > num_tensors) { if (index + 1 > num_tensors) {
return runtime_error; return runtime_error;
} }
auto tensor = interpreter->input_tensor(index); auto tensor = tfl_ctx->interpreters[ctx].interpreter->input_tensor(index);
if (tensor == NULL) { if (tensor == NULL) {
NN_ERR_PRINTF("Missing memory"); NN_ERR_PRINTF("Missing memory");
return too_large; return too_large;
} }
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
if (TfLiteTensorType(tensor) != tfl_type) {
NN_ERR_PRINTF("Type mismatch");
return runtime_error;
}
if (TfLiteTensorCopyFromBuffer(tensor, input_tensor->data.buf,
input_tensor->data.size)
!= kTfLiteOk) {
return runtime_error;
}
#else
uint32_t model_tensor_size = 1; uint32_t model_tensor_size = 1;
for (int i = 0; i < tensor->dims->size; ++i) for (int i = 0; i < tensor->dims->size; ++i)
model_tensor_size *= (uint32_t)tensor->dims->data[i]; model_tensor_size *= (uint32_t)tensor->dims->data[i];
@ -371,7 +346,6 @@ set_input(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
it[i] = (uint8_t)(input_tensor_f[i] / scale + zero_point); it[i] = (uint8_t)(input_tensor_f[i] / scale + zero_point);
} }
} }
#endif
return success; return success;
} }
@ -414,19 +388,14 @@ get_output(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
return too_large; return too_large;
} }
if (tensor->quantization.type == kTfLiteNoQuantization) {
NN_DBG_PRINTF("No quantization information");
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0 #if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
size_t sz = TfLiteTensorByteSize(tensor); if (output_tensor->size < tensor->bytes) {
if (output_tensor->size < sz) {
NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index); NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index);
return too_large; return too_large;
} }
if (TfLiteTensorCopyToBuffer(tensor, output_tensor->buf, sz) != kTfLiteOk) {
return runtime_error;
}
*output_tensor_size = sz;
#else #else
if (tensor->quantization.type == kTfLiteNoQuantization) {
NN_DBG_PRINTF("No quantization information");
/* /*
* for now, maintain the bug-to-bug compatibility with the old abi, * for now, maintain the bug-to-bug compatibility with the old abi,
* where the size here is the number of fp32, not bytes. * where the size here is the number of fp32, not bytes.
@ -435,13 +404,18 @@ get_output(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index); NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index);
return too_large; return too_large;
} }
#endif
bh_memcpy_s(output_tensor->buf, output_tensor->size, tensor->data.data, bh_memcpy_s(output_tensor->buf, output_tensor->size, tensor->data.data,
tensor->bytes); tensor->bytes);
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
*output_tensor_size = tensor->bytes;
#else
/* /*
* for now, maintain the bug-to-bug compatibility with the old abi, * for now, maintain the bug-to-bug compatibility with the old abi,
* where the size here is the number of fp32, not bytes. * where the size here is the number of fp32, not bytes.
*/ */
*output_tensor_size = tensor->bytes / sizeof(float); *output_tensor_size = tensor->bytes / sizeof(float);
#endif
} }
else { // TODO: Assuming uint8 quantized networks. else { // TODO: Assuming uint8 quantized networks.
TfLiteAffineQuantization *quant_info = TfLiteAffineQuantization *quant_info =
@ -455,6 +429,12 @@ get_output(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
for (int i = 0; i < (int)tensor->dims->size; ++i) for (int i = 0; i < (int)tensor->dims->size; ++i)
model_tensor_size *= (uint32_t)tensor->dims->data[i]; model_tensor_size *= (uint32_t)tensor->dims->data[i];
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
if (output_tensor->size / sizeof(float) < model_tensor_size) {
NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index);
return too_large;
}
#else
/* /*
* for now, maintain the bug-to-bug compatibility with the old abi, * for now, maintain the bug-to-bug compatibility with the old abi,
* where the size here is the number of fp32, not bytes. * where the size here is the number of fp32, not bytes.
@ -463,6 +443,7 @@ get_output(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index); NN_ERR_PRINTF("Insufficient memory to copy tensor %d", index);
return too_large; return too_large;
} }
#endif
uint8_t *ot = tfl_ctx->interpreters[ctx] uint8_t *ot = tfl_ctx->interpreters[ctx]
.interpreter->typed_output_tensor<uint8_t>(index); .interpreter->typed_output_tensor<uint8_t>(index);
@ -477,13 +458,16 @@ get_output(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
output_tensor_f[i] = (ot[i] - zero_point) * scale; output_tensor_f[i] = (ot[i] - zero_point) * scale;
} }
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
*output_tensor_size = model_tensor_size * sizeof(float);
#else
/* /*
* for now, maintain the bug-to-bug compatibility with the old abi, * for now, maintain the bug-to-bug compatibility with the old abi,
* where the size here is the number of fp32, not bytes. * where the size here is the number of fp32, not bytes.
*/ */
*output_tensor_size = model_tensor_size; *output_tensor_size = model_tensor_size;
}
#endif #endif
}
return success; return success;
} }

View File

@ -110,13 +110,6 @@ os_thread_create_with_prio(korp_tid *tid, thread_start_routine_t start,
targ->start = start; targ->start = start;
targ->arg = arg; targ->arg = arg;
#ifdef CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM
esp_pthread_cfg_t default_config = esp_pthread_get_default_config();
default_config.stack_alloc_caps = MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM;
ESP_ERROR_CHECK(esp_pthread_set_cfg(&default_config));
#endif
if (pthread_create(tid, &tattr, os_thread_wrapper, targ) != 0) { if (pthread_create(tid, &tattr, os_thread_wrapper, targ) != 0) {
pthread_attr_destroy(&tattr); pthread_attr_destroy(&tattr);
os_free(targ); os_free(targ);

View File

@ -382,11 +382,9 @@ a non-compatible`AOT_CURRENT_VERSION`.
We try our best to maintain our runtime ABI for AoT-compiled modules We try our best to maintain our runtime ABI for AoT-compiled modules
compatible among WAMR versions with compatible `AOT_CURRENT_VERSION` compatible among WAMR versions with compatible `AOT_CURRENT_VERSION`
so that combinations of older wamrc and newer runtime usually work. so that combinations of older wamrc and newer runtime usually work.
However, there might be minor incompatibilities time to time.
However, there might be minor incompatibilities from time to time. For For productions, we recommend to use compatible versions of
example, we usually avoid bumping the version when making a change which wamrc and the runtime.
affects only a small fraction of users. For productions, we recommend
using exactly same versions of wamrc and the runtime.
| WAMR version | AOT_CURRENT_VERSION | Compatible AOT version | | | WAMR version | AOT_CURRENT_VERSION | Compatible AOT version | |
| ------------ | ------------------- | ---------------------- | ---------------------- | | ------------ | ------------------- | ---------------------- | ---------------------- |

View File

@ -141,7 +141,7 @@ libc_wasi_parse(char *arg, libc_wasi_parse_context_t *ctx)
} }
ctx->addr_pool[ctx->addr_pool_size++] = token; ctx->addr_pool[ctx->addr_pool_size++] = token;
token = strtok(NULL, ","); token = strtok(NULL, ";");
} }
} }
else if (!strncmp(arg, "--allow-resolve=", 16)) { else if (!strncmp(arg, "--allow-resolve=", 16)) {

View File

@ -57,10 +57,6 @@ print_help(void)
#else #else
printf(" --heap-size=n Set maximum heap size in bytes, default is 16 KB when libc wasi is diabled\n"); printf(" --heap-size=n Set maximum heap size in bytes, default is 16 KB when libc wasi is diabled\n");
#endif #endif
#if WASM_ENABLE_SHARED_HEAP != 0
printf(" --shared-heap-size=n Create shared heap of n bytes and attach to the wasm app.\n");
printf(" The size n will be adjusted to a minumum number aligned to page size\n");
#endif
#if WASM_ENABLE_FAST_JIT != 0 #if WASM_ENABLE_FAST_JIT != 0
printf(" --jit-codecache-size=n Set fast jit maximum code cache size in bytes,\n"); printf(" --jit-codecache-size=n Set fast jit maximum code cache size in bytes,\n");
printf(" default is %u KB\n", FAST_JIT_DEFAULT_CODE_CACHE_SIZE / 1024); printf(" default is %u KB\n", FAST_JIT_DEFAULT_CODE_CACHE_SIZE / 1024);
@ -582,11 +578,6 @@ main(int argc, char *argv[])
#else #else
uint32 heap_size = 16 * 1024; uint32 heap_size = 16 * 1024;
#endif #endif
#if WASM_ENABLE_SHARED_HEAP != 0
SharedHeapInitArgs heap_init_args;
uint32 shared_heap_size = 0;
void *shared_heap = NULL;
#endif
#if WASM_ENABLE_FAST_JIT != 0 #if WASM_ENABLE_FAST_JIT != 0
uint32 jit_code_cache_size = FAST_JIT_DEFAULT_CODE_CACHE_SIZE; uint32 jit_code_cache_size = FAST_JIT_DEFAULT_CODE_CACHE_SIZE;
#endif #endif
@ -694,13 +685,6 @@ main(int argc, char *argv[])
return print_help(); return print_help();
heap_size = atoi(argv[0] + 12); heap_size = atoi(argv[0] + 12);
} }
#if WASM_ENABLE_SHARED_HEAP != 0
else if (!strncmp(argv[0], "--shared-heap-size=", 19)) {
if (argv[0][19] == '\0')
return print_help();
shared_heap_size = atoi(argv[0] + 19);
}
#endif
#if WASM_ENABLE_FAST_JIT != 0 #if WASM_ENABLE_FAST_JIT != 0
else if (!strncmp(argv[0], "--jit-codecache-size=", 21)) { else if (!strncmp(argv[0], "--jit-codecache-size=", 21)) {
if (argv[0][21] == '\0') if (argv[0][21] == '\0')
@ -1023,24 +1007,6 @@ main(int argc, char *argv[])
} }
#endif #endif
#if WASM_ENABLE_SHARED_HEAP != 0
if (shared_heap_size > 0) {
memset(&heap_init_args, 0, sizeof(heap_init_args));
heap_init_args.size = shared_heap_size;
shared_heap = wasm_runtime_create_shared_heap(&heap_init_args);
if (!shared_heap) {
printf("Create preallocated shared heap failed\n");
goto fail6;
}
/* attach module instance 2 to the shared heap */
if (!wasm_runtime_attach_shared_heap(wasm_module_inst, shared_heap)) {
printf("Attach shared heap failed.\n");
goto fail6;
}
}
#endif
ret = 0; ret = 0;
const char *exception = NULL; const char *exception = NULL;
if (is_repl_mode) { if (is_repl_mode) {
@ -1084,9 +1050,6 @@ main(int argc, char *argv[])
} }
#endif #endif
#if WASM_ENABLE_SHARED_HEAP != 0
fail6:
#endif
#if WASM_ENABLE_THREAD_MGR != 0 #if WASM_ENABLE_THREAD_MGR != 0
fail5: fail5:
#endif #endif

View File

@ -27,16 +27,15 @@ ARG ZEPHYR_SDK_VERSION=0.16.9
# In west_lite.yml, the Zephyr version is set to v3.7.0 # In west_lite.yml, the Zephyr version is set to v3.7.0
#ARG ZEPHYR_VERSION=3.7.0 #ARG ZEPHYR_VERSION=3.7.0
# Install the Zephyr Software Development Kit (SDK) minimal version # Install the Zephyr Software Development Kit (SDK)
WORKDIR /root/zephyrproject/zephyr-sdk WORKDIR /root/zephyrproject/zephyr-sdk
# hadolint ignore=DL4006 # hadolint ignore=DL4006
RUN wget --progress=dot:giga https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64_minimal.tar.xz \ RUN wget --progress=dot:giga https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz \
&& wget --progress=dot:giga -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/sha256.sum | shasum --check --ignore-missing \ && wget --progress=dot:giga -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/sha256.sum | shasum --check --ignore-missing \
&& tar --strip-components=1 -xf zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64_minimal.tar.xz && rm zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64_minimal.tar.xz && tar --strip-components=1 -xf zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz && rm zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64.tar.xz
# hadolint ignore=DL4006 # hadolint ignore=DL4006
# Install arc tools, host tools and Register Zephyr SDK CMake package # Install host tools and Register Zephyr SDK CMake package
# If you want to use other toolchains, please change the -t option RUN ./setup.sh -h -c
RUN ./setup.sh -t arc-zephyr-elf -h -c
# Install west # Install west
# hadolint ignore=DL3013,DL3059 # hadolint ignore=DL3013,DL3059

View File

@ -11,7 +11,6 @@ import subprocess
import glob import glob
import re import re
import argparse import argparse
import sys
from typing import Dict, Optional, List from typing import Dict, Optional, List
@ -276,11 +275,6 @@ def process_and_run_test_cases(
else: else:
print(f" Issues not found in folder: {format_issue_ids_should_test}") print(f" Issues not found in folder: {format_issue_ids_should_test}")
if failed > 0:
# Exit with error code if there are failed test for CI
print("Some tests failed, see log file for details.")
sys.exit(1)
def main(): def main():
parser = argparse.ArgumentParser(description="Run BA issue tests.") parser = argparse.ArgumentParser(description="Run BA issue tests.")

View File

@ -39,9 +39,7 @@ function help()
echo "-F set the firmware path used by qemu" echo "-F set the firmware path used by qemu"
echo "-C enable code coverage collect" echo "-C enable code coverage collect"
echo "-j set the platform to test" echo "-j set the platform to test"
echo "-T set the sanitizer(s) used during testing. It can be either a comma-separated list echo "-T set sanitizer to use in tests(ubsan|tsan|asan|posan)"
(e.g., ubsan, asan) or a single option
(e.g., ubsan, tsan, asan, posan)."
echo "-A use the specified wamrc command instead of building it" echo "-A use the specified wamrc command instead of building it"
echo "-N enable extended const expression feature" echo "-N enable extended const expression feature"
echo "-r [requirement name] [N [N ...]] specify a requirement name followed by one or more" echo "-r [requirement name] [N [N ...]] specify a requirement name followed by one or more"
@ -1068,9 +1066,26 @@ function trigger()
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_TAIL_CALL=1" EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_TAIL_CALL=1"
fi fi
if [[ -n "$WAMR_BUILD_SANITIZER" ]]; then echo "SANITIZER IS" $WAMR_BUILD_SANITIZER
echo "Setting run with sanitizer(s): $WAMR_BUILD_SANITIZER"
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=$WAMR_BUILD_SANITIZER" if [[ "$WAMR_BUILD_SANITIZER" == "ubsan" ]]; then
echo "Setting run with ubsan"
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=ubsan"
fi
if [[ "$WAMR_BUILD_SANITIZER" == "asan" ]]; then
echo "Setting run with asan"
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=asan"
fi
if [[ "$WAMR_BUILD_SANITIZER" == "tsan" ]]; then
echo "Setting run with tsan"
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=tsan"
fi
if [[ "$WAMR_BUILD_SANITIZER" == "posan" ]]; then
echo "Setting run with posan"
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=posan"
fi fi
# Make sure we're using the builtin WASI libc implementation # Make sure we're using the builtin WASI libc implementation

View File

@ -159,11 +159,6 @@ if (WAMR_BUILD_DEBUG_AOT EQUAL 1)
endif() endif()
# Enable LLVM # Enable LLVM
# In Debug mode, always use release builds of pre-built dependency libraries
if (WAMR_BUILD_PLATFORM STREQUAL "windows" AND MSVC)
add_compile_options($<$<CONFIG:Debug>:/MD>)
endif()
if (NOT WAMR_BUILD_WITH_CUSTOM_LLVM) if (NOT WAMR_BUILD_WITH_CUSTOM_LLVM)
set (LLVM_SRC_ROOT "${PROJECT_SOURCE_DIR}/../core/deps/llvm") set (LLVM_SRC_ROOT "${PROJECT_SOURCE_DIR}/../core/deps/llvm")
if (NOT EXISTS "${LLVM_SRC_ROOT}/build") if (NOT EXISTS "${LLVM_SRC_ROOT}/build")

View File

@ -3,17 +3,5 @@
# Copyright (C) 2020 Intel Corporation. All rights reserved. # Copyright (C) 2020 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
TEMP_DIR=$(mktemp -d) /usr/bin/env python3 -m pip install --user -r ../build-scripts/requirements.txt
cleanup() {
local exit_code=$?
rm -rf "$TEMP_DIR"
exit $exit_code
}
trap cleanup EXIT INT TERM
/usr/bin/env python3 -m venv --clear "$TEMP_DIR"
source "$TEMP_DIR/bin/activate"
/usr/bin/env python3 -m pip install -r ../build-scripts/requirements.txt
/usr/bin/env python3 ../build-scripts/build_llvm.py "$@" /usr/bin/env python3 ../build-scripts/build_llvm.py "$@"

View File

@ -3,5 +3,5 @@
# Copyright (C) 2020 Intel Corporation. All rights reserved. # Copyright (C) 2020 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" /usr/bin/env python3 -m pip install --user -r ../build-scripts/requirements.txt
$SCRIPT_DIR/build_llvm.sh --platform arc "$@" /usr/bin/env python3 ../build-scripts/build_llvm.py --platform arc "$@"

View File

@ -3,5 +3,5 @@
# Copyright (C) 2020 Intel Corporation. All rights reserved. # Copyright (C) 2020 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" /usr/bin/env python3 -m pip install --user -r ../build-scripts/requirements.txt
$SCRIPT_DIR/build_llvm.sh --platform xtensa "$@" /usr/bin/env python3 ../build-scripts/build_llvm.py --platform xtensa "$@"