Skip to content

Commit 5734774

Browse files
committed
Bump wamr to 1.3.1
- optimize compilation options - adapt to new API Signed-off-by: [email protected] <[email protected]>
1 parent b7e6907 commit 5734774

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

bazel/external/wamr.BUILD

+14-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,22 @@ filegroup(
1212
cmake(
1313
name = "wamr_lib",
1414
generate_args = [
15+
# disable WASI
1516
"-DWAMR_BUILD_LIBC_WASI=0",
16-
"-DWAMR_BUILD_MULTI_MODULE=0",
17+
"-DWAMR_BUILD_LIBC_BUILTIN=0",
18+
# MVP
19+
"-DWAMR_BUILD_BULK_MEMORY=1",
20+
"-DWAMR_BUILD_REF_TYPES=1",
21+
"-DWAMR_BUILD_SIMD=1",
1722
"-DWAMR_BUILD_TAIL_CALL=1",
18-
"-DWAMR_DISABLE_HW_BOUND_CHECK=0",
19-
"-DWAMR_DISABLE_STACK_HW_BOUND_CHECK=1",
23+
# name section
24+
"-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
25+
"-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
26+
# trap information
27+
"-DWAMR_BUILD_DUMP_CALL_STACK=1",
28+
# others
29+
"-DWAMR_BUILD_MULTI_MODULE=0",
30+
"-DWAMR_BUILD_WASM_CACHE=0",
2031
"-GNinja",
2132
] + select({
2233
"@proxy_wasm_cpp_host//bazel:engine_wamr_jit": [

bazel/repositories.bzl

+4-4
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ def proxy_wasm_cpp_host_repositories():
159159
http_archive,
160160
name = "com_github_bytecodealliance_wasm_micro_runtime",
161161
build_file = "@proxy_wasm_cpp_host//bazel/external:wamr.BUILD",
162-
# WAMR-1.2.1
163-
sha256 = "7548d4bbea8dbb9b005e83bd571f93a12fb3f0b5e87a8b0130f004dd92df4b0b",
164-
strip_prefix = "wasm-micro-runtime-WAMR-1.2.1",
165-
url = "https://github.com/bytecodealliance/wasm-micro-runtime/archive/refs/tags/WAMR-1.2.1.zip",
162+
# WAMR-1.3.1
163+
sha256 = "4e34db792332f385fd479e1265d5eaa56705d7cf7ff3fd7734f536466aa29355",
164+
strip_prefix = "wasm-micro-runtime-WAMR-1.3.1",
165+
url = "https://github.com/bytecodealliance/wasm-micro-runtime/archive/refs/tags/WAMR-1.3.1.zip",
166166
)
167167

168168
native.bind(

src/wamr/types.h

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
namespace proxy_wasm::wamr {
1919

2020
using WasmEnginePtr = common::CSmartPtr<wasm_engine_t, wasm_engine_delete>;
21+
using WasmConfigPtr = common::CSmartPtr<wasm_config_t, wasm_config_delete>;
2122
using WasmFuncPtr = common::CSmartPtr<wasm_func_t, wasm_func_delete>;
2223
using WasmStorePtr = common::CSmartPtr<wasm_store_t, wasm_store_delete>;
2324
using WasmModulePtr = common::CSmartPtr<wasm_module_t, wasm_module_delete>;

src/wamr/wamr.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ struct HostFuncData {
4747
using HostFuncDataPtr = std::unique_ptr<HostFuncData>;
4848

4949
wasm_engine_t *engine() {
50-
static const auto engine = WasmEnginePtr(wasm_engine_new());
50+
static auto engine_config = WasmConfigPtr(wasm_config_new());
51+
// it is able to use wasm_config_set_xxx() to adjust wamr runtime features
52+
// like: wasm_config_set_linux_perf_opt(engine_config.get(), true);
53+
static const auto engine = WasmEnginePtr(wasm_engine_new_with_config(engine_config.get()));
5154
return engine.get();
5255
}
5356

@@ -130,6 +133,7 @@ bool Wamr::load(std::string_view bytecode, std::string_view /*precompiled*/,
130133
.num_elems = bytecode.size(),
131134
.size_of_elem = sizeof(byte_t),
132135
.lock = nullptr};
136+
133137
module_ = wasm_module_new(store_.get(), &binary);
134138
if (module_ == nullptr) {
135139
return false;

0 commit comments

Comments
 (0)