Implement memory64 for classic interpreter (#3266)
Adding a new cmake flag (cache variable) `WAMR_BUILD_MEMORY64` to enable the memory64 feature, it can only be enabled on the 64-bit platform/target and can only use software boundary check. And when it is enabled, it can support both i32 and i64 linear memory types. The main modifications are: - wasm loader & mini-loader: loading and bytecode validating process - wasm runtime: memory instantiating process - classic-interpreter: wasm code executing process - Support memory64 memory in related runtime APIs - Modify main function type check when it's memory64 wasm file - Modify `wasm_runtime_invoke_native` and `wasm_runtime_invoke_native_raw` to handle registered native function pointer argument when memory64 is enabled - memory64 classic-interpreter spec test in `test_wamr.sh` and in CI Currently, it supports memory64 memory wasm file that uses core spec (including bulk memory proposal) opcodes and threads opcodes. ps. https://github.com/bytecodealliance/wasm-micro-runtime/issues/3091 https://github.com/bytecodealliance/wasm-micro-runtime/pull/3240 https://github.com/bytecodealliance/wasm-micro-runtime/pull/3260
This commit is contained in:
@ -65,6 +65,7 @@ env:
|
||||
WASI_TEST_OPTIONS: "-s wasi_certification -w"
|
||||
WAMR_COMPILER_TEST_OPTIONS: "-s wamr_compiler -S -b -P"
|
||||
GC_TEST_OPTIONS: "-s spec -G -b -P"
|
||||
MEMORY64_TEST_OPTIONS: "-s spec -W -b -P"
|
||||
|
||||
jobs:
|
||||
build_llvm_libraries_on_ubuntu_2204:
|
||||
@ -144,6 +145,7 @@ jobs:
|
||||
"-DWAMR_BUILD_SIMD=1",
|
||||
"-DWAMR_BUILD_TAIL_CALL=1",
|
||||
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
|
||||
"-DWAMR_BUILD_MEMORY64=1",
|
||||
]
|
||||
os: [ubuntu-22.04]
|
||||
platform: [android, linux]
|
||||
@ -202,6 +204,21 @@ jobs:
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
# Memory64 only on CLASSIC INTERP mode, and only on 64-bit platform
|
||||
- make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
platform: android
|
||||
- make_options_run_mode: $AOT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
# Fast-JIT and Multi-Tier-JIT mode don't support android
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
platform: android
|
||||
@ -503,6 +520,7 @@ jobs:
|
||||
$THREADS_TEST_OPTIONS,
|
||||
$WASI_TEST_OPTIONS,
|
||||
$GC_TEST_OPTIONS,
|
||||
$MEMORY64_TEST_OPTIONS,
|
||||
]
|
||||
wasi_sdk_release:
|
||||
[
|
||||
@ -541,19 +559,30 @@ jobs:
|
||||
test_option: $GC_TEST_OPTIONS
|
||||
- running_mode: "multi-tier-jit"
|
||||
test_option: $GC_TEST_OPTIONS
|
||||
# aot, fast-interp, fast-jit, llvm-jit, multi-tier-jit don't support Memory64
|
||||
- running_mode: "aot"
|
||||
test_option: $MEMORY64_TEST_OPTIONS
|
||||
- running_mode: "fast-interp"
|
||||
test_option: $MEMORY64_TEST_OPTIONS
|
||||
- running_mode: "fast-jit"
|
||||
test_option: $MEMORY64_TEST_OPTIONS
|
||||
- running_mode: "jit"
|
||||
test_option: $MEMORY64_TEST_OPTIONS
|
||||
- running_mode: "multi-tier-jit"
|
||||
test_option: $MEMORY64_TEST_OPTIONS
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set-up OCaml
|
||||
uses: ocaml/setup-ocaml@v2
|
||||
if: matrix.test_option == '$GC_TEST_OPTIONS'
|
||||
if: matrix.test_option == '$GC_TEST_OPTIONS' || matrix.test_option == '$MEMORY64_TEST_OPTIONS'
|
||||
with:
|
||||
ocaml-compiler: 4.13
|
||||
|
||||
- name: Set-up Ocamlbuild
|
||||
if: matrix.test_option == '$GC_TEST_OPTIONS'
|
||||
run: opam install ocamlbuild dune
|
||||
if: matrix.test_option == '$GC_TEST_OPTIONS' || matrix.test_option == '$MEMORY64_TEST_OPTIONS'
|
||||
run: opam install ocamlbuild dune menhir
|
||||
|
||||
- name: download and install wasi-sdk
|
||||
if: matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
@ -617,13 +646,13 @@ jobs:
|
||||
|
||||
- name: run tests
|
||||
timeout-minutes: 30
|
||||
if: matrix.test_option != '$GC_TEST_OPTIONS'
|
||||
if: matrix.test_option != '$GC_TEST_OPTIONS' && matrix.test_option != '$MEMORY64_TEST_OPTIONS'
|
||||
run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
working-directory: ./tests/wamr-test-suites
|
||||
|
||||
- name: run gc tests
|
||||
- name: run gc or memory64 tests
|
||||
timeout-minutes: 20
|
||||
if: matrix.test_option == '$GC_TEST_OPTIONS'
|
||||
if: matrix.test_option == '$GC_TEST_OPTIONS' || matrix.test_option == '$MEMORY64_TEST_OPTIONS'
|
||||
run: |
|
||||
eval $(opam env)
|
||||
./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
|
||||
Reference in New Issue
Block a user