mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2026-01-21 16:49:12 +00:00
Merge branch 'bytecodealliance:main' into fix/zephyr_product_mini
This commit is contained in:
commit
3b56bf1428
2
.github/workflows/build_wamr_vscode_ext.yml
vendored
2
.github/workflows/build_wamr_vscode_ext.yml
vendored
|
|
@ -27,7 +27,7 @@ jobs:
|
|||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Use Node.js 18.x
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 18.x
|
||||
|
||||
|
|
|
|||
6
.github/workflows/codeql.yml
vendored
6
.github/workflows/codeql.yml
vendored
|
|
@ -53,7 +53,7 @@ jobs:
|
|||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3.29.11
|
||||
uses: github/codeql-action/init@v3.30.1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ jobs:
|
|||
- run: |
|
||||
./.github/scripts/codeql_buildscript.sh
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3.29.11
|
||||
uses: github/codeql-action/analyze@v3.30.1
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
upload: false
|
||||
|
|
@ -99,7 +99,7 @@ jobs:
|
|||
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
|
||||
|
||||
- name: Upload CodeQL results to code scanning
|
||||
uses: github/codeql-action/upload-sarif@v3.29.11
|
||||
uses: github/codeql-action/upload-sarif@v3.30.1
|
||||
with:
|
||||
sarif_file: ${{ steps.step1.outputs.sarif-output }}
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ jobs:
|
|||
- name: Build wamrc
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake .. -DCMAKE_C_FLAGS="-Werror"
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ jobs:
|
|||
if: matrix.platform == 'linux'
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
|
||||
cmake .. -DCMAKE_C_FLAGS="-Werror" ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: product-mini/platforms/${{ matrix.platform }}
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ jobs:
|
|||
if: matrix.platform == 'android'
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} \
|
||||
cmake .. -DCMAKE_C_FLAGS="-Werror" ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} \
|
||||
-DWAMR_BUILD_TARGET=X86_64
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: product-mini/platforms/${{ matrix.platform }}
|
||||
|
|
|
|||
4
.github/workflows/compilation_on_macos.yml
vendored
4
.github/workflows/compilation_on_macos.yml
vendored
|
|
@ -107,7 +107,7 @@ jobs:
|
|||
- name: Build wamrc
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake .. -DCMAKE_C_FLAGS="-Werror"
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ jobs:
|
|||
- name: Build iwasm
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
|
||||
cmake .. -DCMAKE_C_FLAGS="-Werror" ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: product-mini/platforms/${{ matrix.platform }}
|
||||
|
||||
|
|
|
|||
2
.github/workflows/supply_chain.yml
vendored
2
.github/workflows/supply_chain.yml
vendored
|
|
@ -60,6 +60,6 @@ jobs:
|
|||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@5b49155c7f37b5ec074ffd26b428e6b64b1bf412
|
||||
uses: github/codeql-action/upload-sarif@144880b6f0c9977178ab4000985a49023783178f
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
|
|
|||
|
|
@ -126,11 +126,9 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
|
|||
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")
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ WebAssembly Micro Runtime (WAMR) is a lightweight standalone WebAssembly (Wasm)
|
|||
- [128-bit SIMD](https://github.com/WebAssembly/simd), ref to [samples/workload](samples/workload)
|
||||
- [Reference Types](https://github.com/WebAssembly/reference-types), ref to [document](doc/ref_types.md) and [sample](samples/ref-types)
|
||||
- [Bulk memory operations](https://github.com/WebAssembly/bulk-memory-operations), [Shared memory](https://github.com/WebAssembly/threads/blob/main/proposals/threads/Overview.md#shared-linear-memory), [Memory64](https://github.com/WebAssembly/memory64)
|
||||
- [Tail-call](https://github.com/WebAssembly/tail-call), [Garbage Collection](https://github.com/WebAssembly/gc), [Exception Handling](https://github.com/WebAssembly/exception-handling)
|
||||
- [Tail-call](https://github.com/WebAssembly/tail-call), [Garbage Collection](https://github.com/WebAssembly/gc), [Exception Handling](https://github.com/WebAssembly/exception-handling), [Branch Hinting](https://github.com/WebAssembly/branch-hinting)
|
||||
- [Extended Constant Expressions](https://github.com/WebAssembly/extended-const)
|
||||
|
||||
### Supported architectures and platforms
|
||||
|
|
@ -117,4 +117,3 @@ Any contributions you make will be under the same license.
|
|||
- [WAMR Blogs](https://bytecodealliance.github.io/wamr.dev/blog/)
|
||||
- [Community news and events](https://bytecodealliance.github.io/wamr.dev/events/)
|
||||
- [WAMR TSC meetings](https://github.com/bytecodealliance/wasm-micro-runtime/wiki/TSC-meeting-notes)
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,8 @@ elseif (WAMR_BUILD_TARGET MATCHES "THUMB.*")
|
|||
set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,-mthumb")
|
||||
endif ()
|
||||
|
||||
include (${CMAKE_CURRENT_LIST_DIR}/warnings.cmake)
|
||||
|
||||
if (NOT WAMR_BUILD_INTERP EQUAL 1)
|
||||
if (NOT WAMR_BUILD_AOT EQUAL 1)
|
||||
message (FATAL_ERROR "-- WAMR Interpreter and AOT must be enabled at least one")
|
||||
|
|
@ -737,6 +739,7 @@ message (
|
|||
" \"Non-trapping float-to-int Conversions\"\n"
|
||||
" \"Sign-extension Operators\"\n"
|
||||
" \"WebAssembly C and C++ API\"\n"
|
||||
" \"Branch Hinting\"\n"
|
||||
" Configurable. 0 is OFF. 1 is ON:\n"
|
||||
" \"Bulk Memory Operation\" via WAMR_BUILD_BULK_MEMORY: ${WAMR_BUILD_BULK_MEMORY}\n"
|
||||
" \"Extended Constant Expressions\" via WAMR_BUILD_EXTENDED_CONST_EXPR: ${WAMR_BUILD_EXTENDED_CONST_EXPR}\n"
|
||||
|
|
@ -751,7 +754,6 @@ message (
|
|||
" \"Threads\" via WAMR_BUILD_SHARED_MEMORY: ${WAMR_BUILD_SHARED_MEMORY}\n"
|
||||
" \"Typed Function References\" via WAMR_BUILD_GC: ${WAMR_BUILD_GC}\n"
|
||||
" Unsupported (>= Phase4):\n"
|
||||
" \"Branch Hinting\"\n"
|
||||
" \"Custom Annotation Syntax in the Text Format\"\n"
|
||||
" \"Exception Handling\"\n"
|
||||
" \"JS String Builtins\"\n"
|
||||
|
|
|
|||
|
|
@ -162,8 +162,7 @@ endif ()
|
|||
|
||||
####################### Common sources #######################
|
||||
if (NOT MSVC)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -ffunction-sections -fdata-sections \
|
||||
-Wall -Wno-unused-parameter -Wno-pedantic")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -ffunction-sections -fdata-sections")
|
||||
endif ()
|
||||
|
||||
# include the build config template file
|
||||
|
|
|
|||
46
build-scripts/warnings.cmake
Normal file
46
build-scripts/warnings.cmake
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
# global additional warnings.
|
||||
if (MSVC)
|
||||
# warning level 4
|
||||
add_compile_options(/W4)
|
||||
else ()
|
||||
# refer to https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
||||
add_compile_options(
|
||||
-Wall -Wextra -Wformat -Wformat-security
|
||||
$<$<COMPILE_LANGUAGE:C>:-Wshadow>
|
||||
)
|
||||
# -pedantic causes warnings like "ISO C forbids initialization between function pointer and ‘void *’" which
|
||||
# is widely used in the codebase.
|
||||
#
|
||||
# -fpermissive causes warnings like "-fpermissive is valid for C++/ObjC++ but not for C"
|
||||
#
|
||||
# Reference:
|
||||
# - gcc-4.8 https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gcc/Warning-Options.html
|
||||
# - gcc-11.5 https://gcc.gnu.org/onlinedocs/gcc-11.5.0/gcc/Warning-Options.html
|
||||
add_compile_options (
|
||||
$<$<COMPILE_LANGUAGE:C>:-Wimplicit-function-declaration>
|
||||
)
|
||||
|
||||
# https://gcc.gnu.org/gcc-5/changes.html introduces incompatible-pointer-types
|
||||
# https://releases.llvm.org/7.0.0/tools/clang/docs/DiagnosticsReference.html#wincompatible-pointer-types
|
||||
# is the earliest version that supports this option I can found.
|
||||
# Assume AppClang versioning is compatible with Clang.
|
||||
if ((CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "5.1")
|
||||
OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0.0")
|
||||
OR (CMAKE_C_COMPILER_ID STREQUAL "AppClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0.0"))
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wincompatible-pointer-types>)
|
||||
endif()
|
||||
|
||||
# options benefit embedded system.
|
||||
add_compile_options (
|
||||
-Wdouble-promotion
|
||||
)
|
||||
|
||||
# waivers
|
||||
add_compile_options (
|
||||
-Wno-unused
|
||||
-Wno-unused-parameter
|
||||
)
|
||||
endif ()
|
||||
|
|
@ -579,6 +579,10 @@ unless used elsewhere */
|
|||
#define WASM_ENABLE_REF_TYPES 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_BRANCH_HINTS
|
||||
#define WASM_ENABLE_BRANCH_HINTS 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_GC
|
||||
#define WASM_ENABLE_GC 0
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ float64
|
|||
aot_intrinsic_fmin_f64(float64 a, float64 b)
|
||||
{
|
||||
if (isnan(a) || isnan(b))
|
||||
return NAN;
|
||||
return (float64)NAN;
|
||||
else if (a == 0 && a == b)
|
||||
return signbit(a) ? a : b;
|
||||
else
|
||||
|
|
@ -174,7 +174,7 @@ float64
|
|||
aot_intrinsic_fmax_f64(float64 a, float64 b)
|
||||
{
|
||||
if (isnan(a) || isnan(b))
|
||||
return NAN;
|
||||
return (float64)NAN;
|
||||
else if (a == 0 && a == b)
|
||||
return signbit(a) ? b : a;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -4607,16 +4607,16 @@ aot_dump_perf_profiling(const AOTModuleInstance *module_inst)
|
|||
os_printf(
|
||||
" func %s, execution time: %.3f ms, execution count: %" PRIu32
|
||||
" times, children execution time: %.3f ms\n",
|
||||
func_name, perf_prof->total_exec_time / 1000.0f,
|
||||
func_name, perf_prof->total_exec_time / 1000.0,
|
||||
perf_prof->total_exec_cnt,
|
||||
perf_prof->children_exec_time / 1000.0f);
|
||||
perf_prof->children_exec_time / 1000.0);
|
||||
else
|
||||
os_printf(" func %" PRIu32
|
||||
", execution time: %.3f ms, execution count: %" PRIu32
|
||||
" times, children execution time: %.3f ms\n",
|
||||
i, perf_prof->total_exec_time / 1000.0f,
|
||||
i, perf_prof->total_exec_time / 1000.0,
|
||||
perf_prof->total_exec_cnt,
|
||||
perf_prof->children_exec_time / 1000.0f);
|
||||
perf_prof->children_exec_time / 1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4632,7 +4632,7 @@ aot_summarize_wasm_execute_time(const AOTModuleInstance *inst)
|
|||
AOTFuncPerfProfInfo *perf_prof =
|
||||
(AOTFuncPerfProfInfo *)inst->func_perf_profilings + i;
|
||||
ret += (perf_prof->total_exec_time - perf_prof->children_exec_time)
|
||||
/ 1000.0f;
|
||||
/ 1000.0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -4651,7 +4651,7 @@ aot_get_wasm_func_exec_time(const AOTModuleInstance *inst,
|
|||
AOTFuncPerfProfInfo *perf_prof =
|
||||
(AOTFuncPerfProfInfo *)inst->func_perf_profilings + i;
|
||||
return (perf_prof->total_exec_time - perf_prof->children_exec_time)
|
||||
/ 1000.0f;
|
||||
/ 1000.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -347,7 +347,8 @@ static dtor_t g_context_dtors[WASM_MAX_INSTANCE_CONTEXTS];
|
|||
|
||||
static void
|
||||
dtor_noop(WASMModuleInstanceCommon *inst, void *ctx)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void *
|
||||
wasm_native_create_context_key(void (*dtor)(WASMModuleInstanceCommon *inst,
|
||||
|
|
@ -485,7 +486,8 @@ wasm_native_init()
|
|||
|| WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \
|
||||
|| WASM_ENABLE_APP_FRAMEWORK != 0 || WASM_ENABLE_LIBC_WASI != 0 \
|
||||
|| WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0 \
|
||||
|| WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0
|
||||
|| WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0 \
|
||||
|| WASM_ENABLE_SHARED_HEAP != 0
|
||||
NativeSymbol *native_symbols;
|
||||
uint32 n_native_symbols;
|
||||
#endif
|
||||
|
|
@ -602,7 +604,8 @@ wasm_native_init()
|
|||
|| WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \
|
||||
|| WASM_ENABLE_APP_FRAMEWORK != 0 || WASM_ENABLE_LIBC_WASI != 0 \
|
||||
|| WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0 \
|
||||
|| WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0
|
||||
|| WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0 \
|
||||
|| WASM_ENABLE_SHARED_HEAP != 0
|
||||
goto fail;
|
||||
#else
|
||||
return false;
|
||||
|
|
@ -616,7 +619,8 @@ wasm_native_init()
|
|||
|| WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \
|
||||
|| WASM_ENABLE_APP_FRAMEWORK != 0 || WASM_ENABLE_LIBC_WASI != 0 \
|
||||
|| WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0 \
|
||||
|| WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0
|
||||
|| WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0 \
|
||||
|| WASM_ENABLE_SHARED_HEAP != 0
|
||||
fail:
|
||||
wasm_native_destroy();
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -416,6 +416,9 @@ aot_create_funcs(const WASMModule *module, uint32 pointer_size)
|
|||
aot_func->local_types_wp = func->local_types;
|
||||
aot_func->code = func->code;
|
||||
aot_func->code_size = func->code_size;
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
aot_func->code_body_begin = func->code_body_begin;
|
||||
#endif
|
||||
|
||||
/* Resolve local offsets */
|
||||
for (j = 0; j < func_type->param_count; j++) {
|
||||
|
|
@ -872,6 +875,10 @@ aot_create_comp_data(WASMModule *module, const char *target_arch,
|
|||
comp_data->name_section_buf_end = module->name_section_buf_end;
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
comp_data->function_hints = module->function_hints;
|
||||
#endif
|
||||
|
||||
aot_init_aux_data(comp_data, module);
|
||||
|
||||
comp_data->wasm_module = module;
|
||||
|
|
|
|||
|
|
@ -217,6 +217,9 @@ typedef struct AOTFunc {
|
|||
/* offset of each local, including function parameters
|
||||
and local variables */
|
||||
uint16 *local_offsets;
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
uint8 *code_body_begin;
|
||||
#endif
|
||||
} AOTFunc;
|
||||
|
||||
typedef struct AOTCompData {
|
||||
|
|
@ -296,6 +299,10 @@ typedef struct AOTCompData {
|
|||
#if WASM_ENABLE_DEBUG_AOT != 0
|
||||
dwarf_extractor_handle_t extractor;
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
struct WASMCompilationHint **function_hints;
|
||||
#endif
|
||||
} AOTCompData;
|
||||
|
||||
typedef struct AOTNativeSymbol {
|
||||
|
|
|
|||
|
|
@ -1158,9 +1158,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
|
|||
|
||||
case WASM_OP_BR_IF:
|
||||
{
|
||||
read_leb_uint32(frame_ip, frame_ip_end, br_depth);
|
||||
if (!aot_compile_op_br_if(comp_ctx, func_ctx, br_depth,
|
||||
&frame_ip))
|
||||
if (!aot_compile_op_br_if(comp_ctx, func_ctx, &frame_ip))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -668,7 +668,7 @@ set_local_gc_ref(AOTCompFrame *frame, int n, LLVMValueRef value, uint8 ref_type)
|
|||
|
||||
#define I32_CONST(v) LLVMConstInt(I32_TYPE, v, true)
|
||||
#define I64_CONST(v) LLVMConstInt(I64_TYPE, v, true)
|
||||
#define F32_CONST(v) LLVMConstReal(F32_TYPE, v)
|
||||
#define F32_CONST(v) LLVMConstReal(F32_TYPE, (double)(v))
|
||||
#define F64_CONST(v) LLVMConstReal(F64_TYPE, v)
|
||||
#define I8_CONST(v) LLVMConstInt(INT8_TYPE, v, true)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#endif
|
||||
#include "../aot/aot_runtime.h"
|
||||
#include "../interpreter/wasm_loader.h"
|
||||
#include "../common/wasm_loader_common.h"
|
||||
|
||||
#if WASM_ENABLE_DEBUG_AOT != 0
|
||||
#include "debug/dwarf_extractor.h"
|
||||
|
|
@ -87,6 +88,15 @@ format_block_name(char *name, uint32 name_size, uint32 block_index,
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define BUILD_COND_BR_V(value_if, block_then, block_else, instr) \
|
||||
do { \
|
||||
if (!(instr = LLVMBuildCondBr(comp_ctx->builder, value_if, block_then, \
|
||||
block_else))) { \
|
||||
aot_set_last_error("llvm build cond br failed."); \
|
||||
goto fail; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define SET_BUILDER_POS(llvm_block) \
|
||||
LLVMPositionBuilderAtEnd(comp_ctx->builder, llvm_block)
|
||||
|
||||
|
|
@ -255,6 +265,36 @@ restore_frame_sp_for_op_end(AOTBlock *block, AOTCompFrame *aot_frame)
|
|||
aot_frame->sp = block->frame_sp_begin;
|
||||
}
|
||||
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
static void
|
||||
aot_emit_branch_hint(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||
uint32 offset, LLVMValueRef br_if_instr)
|
||||
{
|
||||
struct WASMCompilationHint *hint = func_ctx->function_hints;
|
||||
while (hint != NULL) {
|
||||
if (hint->type == WASM_COMPILATION_BRANCH_HINT
|
||||
&& ((struct WASMCompilationHintBranchHint *)hint)->offset
|
||||
== offset) {
|
||||
break;
|
||||
}
|
||||
hint = hint->next;
|
||||
}
|
||||
if (hint != NULL) {
|
||||
// same weight llvm MDBuilder::createLikelyBranchWeights assigns
|
||||
const uint32_t likely_weight = (1U << 20) - 1;
|
||||
const uint32_t unlikely_weight = 1;
|
||||
aot_set_cond_br_weights(
|
||||
comp_ctx, br_if_instr,
|
||||
((struct WASMCompilationHintBranchHint *)hint)->is_likely
|
||||
? likely_weight
|
||||
: unlikely_weight,
|
||||
((struct WASMCompilationHintBranchHint *)hint)->is_likely
|
||||
? unlikely_weight
|
||||
: likely_weight);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool
|
||||
handle_next_reachable_block(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||
uint8 **p_frame_ip)
|
||||
|
|
@ -673,13 +713,31 @@ aot_compile_op_block(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
|||
MOVE_BLOCK_AFTER(block->llvm_else_block,
|
||||
block->llvm_entry_block);
|
||||
/* Create condition br IR */
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
LLVMValueRef br_if_val = NULL;
|
||||
BUILD_COND_BR_V(value, block->llvm_entry_block,
|
||||
block->llvm_else_block, br_if_val);
|
||||
const uint32 off =
|
||||
*p_frame_ip - func_ctx->aot_func->code_body_begin;
|
||||
aot_emit_branch_hint(comp_ctx, func_ctx, off, br_if_val);
|
||||
#else
|
||||
BUILD_COND_BR(value, block->llvm_entry_block,
|
||||
block->llvm_else_block);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
/* Create condition br IR */
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
LLVMValueRef br_if_val = NULL;
|
||||
BUILD_COND_BR_V(value, block->llvm_entry_block,
|
||||
block->llvm_end_block, br_if_val);
|
||||
const uint32 off =
|
||||
*p_frame_ip - func_ctx->aot_func->code_body_begin;
|
||||
aot_emit_branch_hint(comp_ctx, func_ctx, off, br_if_val);
|
||||
#else
|
||||
BUILD_COND_BR(value, block->llvm_entry_block,
|
||||
block->llvm_end_block);
|
||||
#endif
|
||||
block->is_reachable = true;
|
||||
}
|
||||
if (!push_aot_block_to_stack_and_pass_params(comp_ctx, func_ctx,
|
||||
|
|
@ -1026,8 +1084,7 @@ fail:
|
|||
|
||||
static bool
|
||||
aot_compile_conditional_br(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||
uint32 br_depth, LLVMValueRef value_cmp,
|
||||
uint8 **p_frame_ip)
|
||||
LLVMValueRef value_cmp, uint8 **p_frame_ip)
|
||||
{
|
||||
AOTBlock *block_dst;
|
||||
LLVMValueRef value, *values = NULL;
|
||||
|
|
@ -1036,6 +1093,17 @@ aot_compile_conditional_br(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
|||
uint32 i, param_index, result_index;
|
||||
uint64 size;
|
||||
|
||||
// ip is advanced by one byte for the opcode
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
uint32 instr_offset =
|
||||
(*p_frame_ip - 0x1) - (func_ctx->aot_func->code_body_begin);
|
||||
#else
|
||||
uint32 instr_offset = 0;
|
||||
#endif
|
||||
uint64 br_depth;
|
||||
if (!read_leb(p_frame_ip, *p_frame_ip + 5, 32, false, &br_depth, NULL, 0))
|
||||
return false;
|
||||
|
||||
if (!(block_dst = get_target_block(func_ctx, br_depth))) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1108,8 +1176,15 @@ aot_compile_conditional_br(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
|||
values = NULL;
|
||||
}
|
||||
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
LLVMValueRef br_if_val = NULL;
|
||||
BUILD_COND_BR_V(value_cmp, block_dst->llvm_entry_block,
|
||||
llvm_else_block, br_if_val);
|
||||
aot_emit_branch_hint(comp_ctx, func_ctx, instr_offset, br_if_val);
|
||||
#else
|
||||
BUILD_COND_BR(value_cmp, block_dst->llvm_entry_block,
|
||||
llvm_else_block);
|
||||
#endif
|
||||
|
||||
/* Move builder to else block */
|
||||
SET_BUILDER_POS(llvm_else_block);
|
||||
|
|
@ -1152,9 +1227,15 @@ aot_compile_conditional_br(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
|||
}
|
||||
|
||||
/* Condition jump to end block */
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
LLVMValueRef br_if_val = NULL;
|
||||
BUILD_COND_BR_V(value_cmp, block_dst->llvm_end_block,
|
||||
llvm_else_block, br_if_val);
|
||||
aot_emit_branch_hint(comp_ctx, func_ctx, instr_offset, br_if_val);
|
||||
#else
|
||||
BUILD_COND_BR(value_cmp, block_dst->llvm_end_block,
|
||||
llvm_else_block);
|
||||
|
||||
#endif
|
||||
/* Move builder to else block */
|
||||
SET_BUILDER_POS(llvm_else_block);
|
||||
}
|
||||
|
|
@ -1178,13 +1259,13 @@ fail:
|
|||
|
||||
bool
|
||||
aot_compile_op_br_if(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||
uint32 br_depth, uint8 **p_frame_ip)
|
||||
uint8 **p_frame_ip)
|
||||
{
|
||||
LLVMValueRef value_cmp;
|
||||
|
||||
POP_COND(value_cmp);
|
||||
|
||||
return aot_compile_conditional_br(comp_ctx, func_ctx, br_depth, value_cmp,
|
||||
return aot_compile_conditional_br(comp_ctx, func_ctx, value_cmp,
|
||||
p_frame_ip);
|
||||
fail:
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ aot_compile_op_br(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
|||
|
||||
bool
|
||||
aot_compile_op_br_if(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||
uint32 br_depth, uint8 **p_frame_ip);
|
||||
uint8 **p_frame_ip);
|
||||
|
||||
bool
|
||||
aot_compile_op_br_table(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||
|
|
|
|||
|
|
@ -1963,6 +1963,13 @@ aot_create_func_context(const AOTCompData *comp_data, AOTCompContext *comp_ctx,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
func_ctx->function_hints =
|
||||
comp_ctx->comp_data->function_hints
|
||||
? comp_ctx->comp_data->function_hints[func_index]
|
||||
: NULL;
|
||||
#endif
|
||||
|
||||
return func_ctx;
|
||||
|
||||
fail:
|
||||
|
|
|
|||
|
|
@ -270,6 +270,9 @@ typedef struct AOTFuncContext {
|
|||
#if WASM_ENABLE_DEBUG_AOT != 0
|
||||
LLVMMetadataRef debug_func;
|
||||
#endif
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
struct WASMCompilationHint *function_hints;
|
||||
#endif
|
||||
|
||||
unsigned int stack_consumption_for_func_call;
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ simd_build_splat_const_float_vector(const AOTCompContext *comp_ctx,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!(element = LLVMConstReal(element_type, element_value))) {
|
||||
if (!(element = LLVMConstReal(element_type, (double)element_value))) {
|
||||
HANDLE_FAILURE("LLVMConstReal");
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1564,7 +1564,7 @@ static float64
|
|||
f64_min(float64 a, float64 b)
|
||||
{
|
||||
if (isnan(a) || isnan(b))
|
||||
return NAN;
|
||||
return (float64)NAN;
|
||||
else if (a == 0 && a == b)
|
||||
return signbit(a) ? a : b;
|
||||
else
|
||||
|
|
@ -1575,7 +1575,7 @@ static float64
|
|||
f64_max(float64 a, float64 b)
|
||||
{
|
||||
if (isnan(a) || isnan(b))
|
||||
return NAN;
|
||||
return (float64)NAN;
|
||||
else if (a == 0 && a == b)
|
||||
return signbit(a) ? b : a;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ jit_dump_reg(JitCompContext *cc, JitReg reg)
|
|||
|
||||
case JIT_REG_KIND_F32:
|
||||
if (jit_reg_is_const(reg))
|
||||
os_printf("%f", jit_cc_get_const_F32(cc, reg));
|
||||
os_printf("%f", (double)jit_cc_get_const_F32(cc, reg));
|
||||
else
|
||||
os_printf("f%d", no);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -751,6 +751,10 @@ struct WASMFunction {
|
|||
void *call_to_fast_jit_from_llvm_jit;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
uint8 *code_body_begin;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if WASM_ENABLE_TAGS != 0
|
||||
|
|
@ -761,6 +765,23 @@ struct WASMTag {
|
|||
};
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
enum WASMCompilationHintType {
|
||||
DUMMY = 0,
|
||||
WASM_COMPILATION_BRANCH_HINT = 0,
|
||||
};
|
||||
struct WASMCompilationHint {
|
||||
struct WASMCompilationHint *next;
|
||||
enum WASMCompilationHintType type;
|
||||
};
|
||||
struct WASMCompilationHintBranchHint {
|
||||
struct WASMCompilationHint *next;
|
||||
enum WASMCompilationHintType type;
|
||||
uint32 offset;
|
||||
bool is_likely;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct WASMGlobal {
|
||||
WASMGlobalType type;
|
||||
#if WASM_ENABLE_GC != 0
|
||||
|
|
@ -1049,6 +1070,10 @@ struct WASMModule {
|
|||
const uint8 *name_section_buf_end;
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
struct WASMCompilationHint **function_hints;
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0
|
||||
WASMCustomSection *custom_section_list;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ static inline float64
|
|||
f64_min(float64 a, float64 b)
|
||||
{
|
||||
if (isnan(a) || isnan(b))
|
||||
return NAN;
|
||||
return (float64)NAN;
|
||||
else if (a == 0 && a == b)
|
||||
return signbit(a) ? a : b;
|
||||
else
|
||||
|
|
@ -234,7 +234,7 @@ static inline float64
|
|||
f64_max(float64 a, float64 b)
|
||||
{
|
||||
if (isnan(a) || isnan(b))
|
||||
return NAN;
|
||||
return (float64)NAN;
|
||||
else if (a == 0 && a == b)
|
||||
return signbit(a) ? b : a;
|
||||
else
|
||||
|
|
@ -1685,7 +1685,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
goto got_exception;
|
||||
}
|
||||
|
||||
HANDLE_OP(WASM_OP_NOP) { HANDLE_OP_END(); }
|
||||
HANDLE_OP(WASM_OP_NOP)
|
||||
{
|
||||
HANDLE_OP_END();
|
||||
}
|
||||
|
||||
#if WASM_ENABLE_EXCE_HANDLING != 0
|
||||
HANDLE_OP(WASM_OP_RETHROW)
|
||||
|
|
@ -5622,7 +5625,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
HANDLE_OP(WASM_OP_I32_REINTERPRET_F32)
|
||||
HANDLE_OP(WASM_OP_I64_REINTERPRET_F64)
|
||||
HANDLE_OP(WASM_OP_F32_REINTERPRET_I32)
|
||||
HANDLE_OP(WASM_OP_F64_REINTERPRET_I64) { HANDLE_OP_END(); }
|
||||
HANDLE_OP(WASM_OP_F64_REINTERPRET_I64)
|
||||
{
|
||||
HANDLE_OP_END();
|
||||
}
|
||||
|
||||
HANDLE_OP(WASM_OP_I32_EXTEND8_S)
|
||||
{
|
||||
|
|
@ -5697,7 +5703,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
true);
|
||||
break;
|
||||
case WASM_OP_I64_TRUNC_SAT_U_F64:
|
||||
DEF_OP_TRUNC_SAT_F64(-1.0f, 18446744073709551616.0,
|
||||
DEF_OP_TRUNC_SAT_F64(-1.0, 18446744073709551616.0,
|
||||
false, false);
|
||||
break;
|
||||
#if WASM_ENABLE_BULK_MEMORY != 0
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ static inline float64
|
|||
f64_min(float64 a, float64 b)
|
||||
{
|
||||
if (isnan(a) || isnan(b))
|
||||
return NAN;
|
||||
return (float64)NAN;
|
||||
else if (a == 0 && a == b)
|
||||
return signbit(a) ? a : b;
|
||||
else
|
||||
|
|
@ -175,7 +175,7 @@ static inline float64
|
|||
f64_max(float64 a, float64 b)
|
||||
{
|
||||
if (isnan(a) || isnan(b))
|
||||
return NAN;
|
||||
return (float64)NAN;
|
||||
else if (a == 0 && a == b)
|
||||
return signbit(a) ? b : a;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -3908,6 +3908,9 @@ load_function_section(const uint8 *buf, const uint8 *buf_end,
|
|||
|
||||
/* Resolve local set count */
|
||||
p_code_end = p_code + code_size;
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
uint8 *p_body_start = (uint8 *)p_code;
|
||||
#endif
|
||||
local_count = 0;
|
||||
read_leb_uint32(p_code, buf_code_end, local_set_count);
|
||||
p_code_save = p_code;
|
||||
|
|
@ -3988,6 +3991,9 @@ load_function_section(const uint8 *buf, const uint8 *buf_end,
|
|||
if (local_count > 0)
|
||||
func->local_types = (uint8 *)func + sizeof(WASMFunction);
|
||||
func->code_size = code_size;
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
func->code_body_begin = p_body_start;
|
||||
#endif
|
||||
/*
|
||||
* we shall make a copy of code body [p_code, p_code + code_size]
|
||||
* when we are worrying about inappropriate releasing behaviour.
|
||||
|
|
@ -5560,6 +5566,88 @@ fail:
|
|||
}
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
static bool
|
||||
handle_branch_hint_section(const uint8 *buf, const uint8 *buf_end,
|
||||
WASMModule *module, char *error_buf,
|
||||
uint32 error_buf_size)
|
||||
{
|
||||
if (module->function_hints == NULL) {
|
||||
module->function_hints = loader_malloc(
|
||||
sizeof(struct WASMCompilationHint) * module->function_count,
|
||||
error_buf, error_buf_size);
|
||||
}
|
||||
uint32 numFunctionHints = 0;
|
||||
read_leb_uint32(buf, buf_end, numFunctionHints);
|
||||
for (uint32 i = 0; i < numFunctionHints; ++i) {
|
||||
uint32 func_idx;
|
||||
read_leb_uint32(buf, buf_end, func_idx);
|
||||
if (!check_function_index(module, func_idx, error_buf,
|
||||
error_buf_size)) {
|
||||
goto fail;
|
||||
}
|
||||
if (func_idx < module->import_function_count) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"branch hint for imported function is not allowed");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
struct WASMCompilationHint *current_hint =
|
||||
(struct WASMCompilationHint *)&module
|
||||
->function_hints[func_idx - module->import_function_count];
|
||||
while (current_hint->next != NULL) {
|
||||
current_hint = current_hint->next;
|
||||
}
|
||||
|
||||
uint32 num_hints;
|
||||
read_leb_uint32(buf, buf_end, num_hints);
|
||||
struct WASMCompilationHintBranchHint *new_hints = loader_malloc(
|
||||
sizeof(struct WASMCompilationHintBranchHint) * num_hints, error_buf,
|
||||
error_buf_size);
|
||||
for (uint32 j = 0; j < num_hints; ++j) {
|
||||
struct WASMCompilationHintBranchHint *new_hint = &new_hints[j];
|
||||
new_hint->next = NULL;
|
||||
new_hint->type = WASM_COMPILATION_BRANCH_HINT;
|
||||
read_leb_uint32(buf, buf_end, new_hint->offset);
|
||||
|
||||
uint32 size;
|
||||
read_leb_uint32(buf, buf_end, size);
|
||||
if (size != 1) {
|
||||
set_error_buf_v(error_buf, error_buf_size,
|
||||
"invalid branch hint size, expected 1, got %d.",
|
||||
size);
|
||||
wasm_runtime_free(new_hint);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
uint8 data = *buf++;
|
||||
if (data == 0x00)
|
||||
new_hint->is_likely = false;
|
||||
else if (data == 0x01)
|
||||
new_hint->is_likely = true;
|
||||
else {
|
||||
set_error_buf_v(error_buf, error_buf_size,
|
||||
"invalid branch hint, expected 0 or 1, got %d",
|
||||
data);
|
||||
wasm_runtime_free(new_hint);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
current_hint->next = (struct WASMCompilationHint *)new_hint;
|
||||
current_hint = (struct WASMCompilationHint *)new_hint;
|
||||
}
|
||||
}
|
||||
if (buf != buf_end) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"invalid branch hint section, not filled until end");
|
||||
goto fail;
|
||||
}
|
||||
return true;
|
||||
fail:
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool
|
||||
load_user_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
|
||||
bool is_load_from_file_buf, char *error_buf,
|
||||
|
|
@ -5609,6 +5697,24 @@ load_user_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
if (name_len == 25
|
||||
&& memcmp((const char *)p, "metadata.code.branch_hint", 25) == 0) {
|
||||
p += name_len;
|
||||
if (!handle_branch_hint_section(p, p_end, module, error_buf,
|
||||
error_buf_size)) {
|
||||
return false;
|
||||
}
|
||||
LOG_VERBOSE("Load branch hint section success.");
|
||||
}
|
||||
#else
|
||||
if (name_len == 25
|
||||
&& memcmp((const char *)p, "metadata.code.branch_hint", 25) == 0) {
|
||||
LOG_VERBOSE("Found branch hint section, but branch hints are disabled "
|
||||
"in this build, skipping.");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0
|
||||
{
|
||||
WASMCustomSection *section =
|
||||
|
|
@ -7388,7 +7494,17 @@ wasm_loader_unload(WASMModule *module)
|
|||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_BRANCH_HINTS != 0
|
||||
for (i = 0; i < module->function_count; i++) {
|
||||
// be carefull when adding more hints. This only works as long as
|
||||
// the hint structs have been allocated all at once as an array.
|
||||
// With only branch-hints at the moment, this is the case.
|
||||
if (module->function_hints != NULL && module->function_hints[i] != NULL)
|
||||
wasm_runtime_free(module->function_hints[i]);
|
||||
}
|
||||
if (module->function_hints != NULL)
|
||||
wasm_runtime_free(module->function_hints);
|
||||
#endif
|
||||
wasm_runtime_free(module);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3744,16 +3744,16 @@ wasm_dump_perf_profiling(const WASMModuleInstance *module_inst)
|
|||
os_printf(
|
||||
" func %s, execution time: %.3f ms, execution count: %" PRIu32
|
||||
" times, children execution time: %.3f ms\n",
|
||||
func_name, func_inst->total_exec_time / 1000.0f,
|
||||
func_name, func_inst->total_exec_time / 1000.0,
|
||||
func_inst->total_exec_cnt,
|
||||
func_inst->children_exec_time / 1000.0f);
|
||||
func_inst->children_exec_time / 1000.0);
|
||||
else
|
||||
os_printf(" func %" PRIu32
|
||||
", execution time: %.3f ms, execution count: %" PRIu32
|
||||
" times, children execution time: %.3f ms\n",
|
||||
i, func_inst->total_exec_time / 1000.0f,
|
||||
i, func_inst->total_exec_time / 1000.0,
|
||||
func_inst->total_exec_cnt,
|
||||
func_inst->children_exec_time / 1000.0f);
|
||||
func_inst->children_exec_time / 1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3765,7 +3765,7 @@ wasm_summarize_wasm_execute_time(const WASMModuleInstance *inst)
|
|||
unsigned i;
|
||||
for (i = 0; i < inst->e->function_count; i++) {
|
||||
WASMFunctionInstance *func = inst->e->functions + i;
|
||||
ret += (func->total_exec_time - func->children_exec_time) / 1000.0f;
|
||||
ret += (func->total_exec_time - func->children_exec_time) / 1000.0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -3780,7 +3780,7 @@ wasm_get_wasm_func_exec_time(const WASMModuleInstance *inst,
|
|||
char *name_in_wasm = get_func_name_from_index(inst, i);
|
||||
if (name_in_wasm && strcmp(name_in_wasm, func_name) == 0) {
|
||||
WASMFunctionInstance *func = inst->e->functions + i;
|
||||
return (func->total_exec_time - func->children_exec_time) / 1000.0f;
|
||||
return (func->total_exec_time - func->children_exec_time) / 1000.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -795,6 +795,22 @@ wasi_nn_get_output(wasm_exec_env_t exec_env, graph_execution_context ctx,
|
|||
if (success != (res = is_model_initialized(wasi_nn_ctx)))
|
||||
goto fail;
|
||||
|
||||
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
|
||||
if (!wasm_runtime_validate_native_addr(instance, output_tensor,
|
||||
output_tensor_len)) {
|
||||
NN_ERR_PRINTF("output_tensor is invalid");
|
||||
res = invalid_argument;
|
||||
goto fail;
|
||||
}
|
||||
#else
|
||||
if (!wasm_runtime_validate_native_addr(instance, output_tensor,
|
||||
*output_tensor_size)) {
|
||||
NN_ERR_PRINTF("output_tensor is invalid");
|
||||
res = invalid_argument;
|
||||
goto fail;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!wasm_runtime_validate_native_addr(instance, output_tensor_size,
|
||||
(uint64)sizeof(uint32_t))) {
|
||||
NN_ERR_PRINTF("output_tensor_size is invalid");
|
||||
|
|
|
|||
|
|
@ -66,8 +66,12 @@ float fmaxf(float x, float y);
|
|||
float rintf(float x);
|
||||
float fabsf(float x);
|
||||
float truncf(float x);
|
||||
int signbit(double x);
|
||||
int isnan(double x);
|
||||
int isnan_double(double x);
|
||||
int isnan_float(float x);
|
||||
int signbit_double(double x);
|
||||
int signbit_float(float x);
|
||||
#define isnan(x) (sizeof(x) == sizeof(double) ? isnan_double((double)x) : isnan_float(x))
|
||||
#define signbit(x) (sizeof(x) == sizeof(double) ? signbit_double((double)x) : signbit_float(x))
|
||||
/* clang-format on */
|
||||
|
||||
/* The below types are used in platform_api_extension.h,
|
||||
|
|
|
|||
|
|
@ -1005,6 +1005,21 @@ freebsd_isnan(double d)
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
freebsd_isnanf(float f)
|
||||
{
|
||||
if (is_little_endian()) {
|
||||
IEEEf2bits_L u;
|
||||
u.f = f;
|
||||
return (u.bits.exp == 0xff && u.bits.man != 0);
|
||||
}
|
||||
else {
|
||||
IEEEf2bits_B u;
|
||||
u.f = f;
|
||||
return (u.bits.exp == 0xff && u.bits.man != 0);
|
||||
}
|
||||
}
|
||||
|
||||
static float
|
||||
freebsd_fabsf(float x)
|
||||
{
|
||||
|
|
@ -1601,7 +1616,13 @@ fabs(double x)
|
|||
}
|
||||
|
||||
int
|
||||
isnan(double x)
|
||||
isnan_float(float x)
|
||||
{
|
||||
return freebsd_isnanf(x);
|
||||
}
|
||||
|
||||
int
|
||||
isnan_double(double x)
|
||||
{
|
||||
return freebsd_isnan(x);
|
||||
}
|
||||
|
|
@ -1613,7 +1634,15 @@ trunc(double x)
|
|||
}
|
||||
|
||||
int
|
||||
signbit(double x)
|
||||
signbit_float(float x)
|
||||
{
|
||||
unsigned int i;
|
||||
GET_FLOAT_WORD(i, x);
|
||||
return (int)(i >> 31);
|
||||
}
|
||||
|
||||
int
|
||||
signbit_double(double x)
|
||||
{
|
||||
return ((__HI(x) & 0x80000000) >> 31);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
|
||||
set (PLATFORM_COMMON_MATH_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
file (GLOB_RECURSE source_all ${PLATFORM_COMMON_MATH_DIR}/*.c)
|
||||
file (GLOB_RECURSE math_source_all ${PLATFORM_COMMON_MATH_DIR}/*.c)
|
||||
|
||||
set (PLATFORM_COMMON_MATH_SOURCE ${source_all} )
|
||||
set (PLATFORM_COMMON_MATH_SOURCE ${math_source_all} )
|
||||
|
|
|
|||
|
|
@ -86,8 +86,12 @@ float fmaxf(float x, float y);
|
|||
float rintf(float x);
|
||||
float fabsf(float x);
|
||||
float truncf(float x);
|
||||
int signbit(double x);
|
||||
int isnan(double x);
|
||||
int isnan_double(double x);
|
||||
int isnan_float(float x);
|
||||
int signbit_double(double x);
|
||||
int signbit_float(float x);
|
||||
#define isnan(x) (sizeof(x) == sizeof(double) ? isnan_double((double)x) : isnan_float(x))
|
||||
#define signbit(x) (sizeof(x) == sizeof(double) ? signbit_double((double)x) : signbit_float(x))
|
||||
/* clang-format on */
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -190,12 +190,16 @@ float fmaxf(float x, float y);
|
|||
float rintf(float x);
|
||||
float fabsf(float x);
|
||||
float truncf(float x);
|
||||
int isnan(double x);
|
||||
int isnan_double(double x);
|
||||
int isnan_float(float x);
|
||||
#define isnan(x) (sizeof(x) == sizeof(double) ? isnan_double((double)x) : isnan_float(x))
|
||||
double pow(double x, double y);
|
||||
double scalbn(double x, int n);
|
||||
|
||||
#ifndef BH_HAS_SIGNBIT
|
||||
int signbit(double x);
|
||||
int signbit_double(double x);
|
||||
int signbit_float(float x);
|
||||
#define signbit(x) (sizeof(x) == sizeof(double) ? signbit_double((double)x) : signbit_float(x))
|
||||
#endif
|
||||
|
||||
unsigned long long int strtoull(const char *nptr, char **endptr, int base);
|
||||
|
|
|
|||
|
|
@ -12,16 +12,17 @@ Users can turn those features on or off by using compilation options. If a relev
|
|||
|
||||
## On-by-default Wasm Proposals
|
||||
|
||||
| Proposal | >= Phase 4 | Compilation Option |
|
||||
| ------------------------------------- | ---------- | ------------------------ |
|
||||
| Bulk Memory Operations | Yes | `WAMR_BUILD_BULK_MEMORY` |
|
||||
| Fixed-width SIMD[^1] | Yes | `WAMR_BUILD_SIMD` |
|
||||
| Import/Export of Mutable Globals[^2] | Yes | N/A |
|
||||
| Multi-value | Yes | N/A |
|
||||
| Non-trapping float-to-int Conversions | Yes | N/A |
|
||||
| Reference Types | Yes | `WAMR_BUILD_REF_TYPES` |
|
||||
| Sign-extension Operators | Yes | N/A |
|
||||
| WebAssembly C and C++ API | No | N/A |
|
||||
| Proposal | >= Phase 4 | Compilation Option |
|
||||
| ------------------------------------- | ---------- |----------------------------|
|
||||
| Bulk Memory Operations | Yes | `WAMR_BUILD_BULK_MEMORY` |
|
||||
| Fixed-width SIMD[^1] | Yes | `WAMR_BUILD_SIMD` |
|
||||
| Import/Export of Mutable Globals[^2] | Yes | N/A |
|
||||
| Multi-value | Yes | N/A |
|
||||
| Non-trapping float-to-int Conversions | Yes | N/A |
|
||||
| Reference Types | Yes | `WAMR_BUILD_REF_TYPES` |
|
||||
| Sign-extension Operators | Yes | N/A |
|
||||
| WebAssembly C and C++ API | No | N/A |
|
||||
| Branch Hinting | Yes | `WASM_ENABLE_BRANCH_HINTS` |
|
||||
|
||||
[^1]: llvm-jit and aot only.
|
||||
|
||||
|
|
@ -54,7 +55,6 @@ Users can turn those features on or off by using compilation options. If a relev
|
|||
|
||||
| Proposal | >= Phase 4 |
|
||||
| ------------------------------------------- | ---------- |
|
||||
| Branch Hinting | Yes |
|
||||
| Custom Annotation Syntax in the Text Format | Yes |
|
||||
| Exception Handling[^6] | Yes |
|
||||
| JS String Builtins | Yes |
|
||||
|
|
|
|||
|
|
@ -111,9 +111,6 @@ set_version_info (vmlib)
|
|||
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE")
|
||||
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion")
|
||||
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -136,11 +136,6 @@ set_version_info (vmlib)
|
|||
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow")
|
||||
# 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 (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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -113,9 +113,6 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
|
|||
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE")
|
||||
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion")
|
||||
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -139,11 +139,6 @@ check_pie_supported()
|
|||
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow")
|
||||
# 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 (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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -114,9 +114,6 @@ if (NOT MINGW)
|
|||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
|
||||
endif ()
|
||||
|
||||
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion")
|
||||
|
||||
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" OR MSVC))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ if (NOT MSVC)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ set(WAMR_BUILD_DUMP_CALL_STACK 1) # Otherwise stack trace is not printed (addr2l
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
|
||||
# build out vmlib
|
||||
set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ if (NOT MSVC)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ if (NOT MSVC)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ if (NOT MSVC)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ set(WAMR_BUILD_MULTI_MODULE 1)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ set(WAMR_BUILD_LIB_PTHREAD_SEMAPHORE 1)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
|
||||
# build out vmlib
|
||||
set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ set (WAMR_BUILD_FAST_INTERP 1)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
|
||||
# build out libiwasm
|
||||
set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ if (NOT MSVC)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ if (NOT MSVC)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ if (NOT MSVC)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ if (NOT MSVC)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -177,7 +177,6 @@ set(WAMR_BUILD_REF_TYPES 1)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
|
||||
# build vmlib static lib
|
||||
set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ set(WAMR_BUILD_SHARED_MEMORY 1)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
|
||||
# build out vmlib
|
||||
set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ if (NOT MSVC)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ set(WAMR_BUILD_REF_TYPES 1)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
|
||||
# build out vmlib
|
||||
set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ set(WAMR_BUILD_SIMD 0)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
|
||||
# build out vmlib
|
||||
set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@ if (NOT MSVC)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -61,11 +61,6 @@ if (NOT DEFINED WAMR_BIG_ENDIAN)
|
|||
set (WAMR_BIG_ENDIAN 0)
|
||||
endif ()
|
||||
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow -Wno-unused-parameter")
|
||||
# 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 (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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -103,11 +103,6 @@ if (NOT WAMR_BUILD_PLATFORM STREQUAL "darwin")
|
|||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE")
|
||||
endif ()
|
||||
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow")
|
||||
# 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 (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"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ set (WAMR_BUILD_LIBC_WASI 1)
|
|||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif ()
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
|
||||
|
||||
################ wasm application ###############
|
||||
add_subdirectory(wasm-app)
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
|||
if (NOT WAMR_BUILD_PLATFORM STREQUAL "darwin")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE")
|
||||
endif ()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused")
|
||||
|
||||
# build out vmlib
|
||||
include(${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ set(WAMR_BUILD_FAST_INTERP 0)
|
|||
|
||||
# compiling and linking flags
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -mindirect-branch-register")
|
||||
|
||||
# build out vmlib
|
||||
# hard code path here
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ add_definitions(-DWASM_ENABLE_SHARED_MEMORY=1)
|
|||
add_definitions(-DWASM_ENABLE_THREAD_MGR=1)
|
||||
add_definitions(-DWASM_ENABLE_TAIL_CALL=1)
|
||||
add_definitions(-DWASM_ENABLE_REF_TYPES=1)
|
||||
add_definitions(-DWASM_ENABLE_BRANCH_HINTS=1)
|
||||
add_definitions(-DWASM_ENABLE_CUSTOM_NAME_SECTION=1)
|
||||
add_definitions(-DWASM_ENABLE_AOT_STACK_FRAME=1)
|
||||
add_definitions(-DWASM_ENABLE_DUMP_CALL_STACK=1)
|
||||
|
|
@ -204,13 +205,13 @@ if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*
|
|||
endif()
|
||||
|
||||
if (NOT MSVC)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security \
|
||||
-ffunction-sections -fdata-sections \
|
||||
-Wno-unused-parameter -Wno-pedantic")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
|
||||
# Remove the extra spaces for better make log
|
||||
string (REGEX REPLACE " *" " " CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
endif()
|
||||
|
||||
include (${PROJECT_SOURCE_DIR}/../build-scripts/warnings.cmake)
|
||||
|
||||
set (SHARED_DIR ../core/shared)
|
||||
set (IWASM_DIR ../core/iwasm)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user