Add support for multi-memory proposal in classic interpreter (#3742)

Implement multi-memory for classic-interpreter. Support core spec (and bulk memory) opcodes now,
and will support atomic opcodes, and add multi-memory export APIs in the future. 

PS: Multi-memory spec test patched a lot for linking test to adapt for multi-module implementation.
This commit is contained in:
Wenyong Huang
2024-08-21 12:22:23 +08:00
committed by GitHub
parent f4383a9e62
commit 1329e1d3e1
22 changed files with 1658 additions and 262 deletions

View File

@ -14,7 +14,7 @@ import time
"""
The script itself has to be put under the same directory with the "spec".
To run a single non-GC and non-memory64 case with interpreter mode:
To run a single non-GC case with interpreter mode:
cd workspace
python3 runtest.py --wast2wasm wabt/bin/wat2wasm --interpreter iwasm \
spec/test/core/xxx.wast
@ -22,7 +22,7 @@ To run a single non-GC case with aot mode:
cd workspace
python3 runtest.py --aot --wast2wasm wabt/bin/wat2wasm --interpreter iwasm \
--aot-compiler wamrc spec/test/core/xxx.wast
To run a single GC case or single memory64 case:
To run a single GC case case:
cd workspace
python3 runtest.py --wast2wasm spec/interpreter/wasm --interpreter iwasm \
--aot-compiler wamrc --gc spec/test/core/xxx.wast
@ -79,6 +79,7 @@ def ignore_the_case(
simd_flag=False,
gc_flag=False,
memory64_flag=False,
multi_memory_flag=False,
xip_flag=False,
eh_flag=False,
qemu_flag=False,
@ -165,6 +166,7 @@ def test_case(
verbose_flag=True,
gc_flag=False,
memory64_flag=False,
multi_memory_flag=False,
qemu_flag=False,
qemu_firmware="",
log="",
@ -223,6 +225,9 @@ def test_case(
if memory64_flag:
CMD.append("--memory64")
if multi_memory_flag:
CMD.append("--multi-memory")
if log != "":
CMD.append("--log-dir")
CMD.append(log)
@ -291,6 +296,7 @@ def test_suite(
verbose_flag=True,
gc_flag=False,
memory64_flag=False,
multi_memory_flag=False,
parl_flag=False,
qemu_flag=False,
qemu_firmware="",
@ -316,6 +322,10 @@ def test_suite(
eh_case_list_include = [test for test in eh_case_list if test.stem in ["throw", "tag", "try_catch", "rethrow", "try_delegate"]]
case_list.extend(eh_case_list_include)
if multi_memory_flag:
multi_memory_list = sorted(suite_path.glob("multi-memory/*.wast"))
case_list.extend(multi_memory_list)
# ignore based on command line options
filtered_case_list = []
for case_path in case_list:
@ -330,6 +340,7 @@ def test_suite(
simd_flag,
gc_flag,
memory64_flag,
multi_memory_flag,
xip_flag,
eh_flag,
qemu_flag,
@ -366,6 +377,7 @@ def test_suite(
verbose_flag,
gc_flag,
memory64_flag,
multi_memory_flag,
qemu_flag,
qemu_firmware,
log,
@ -408,6 +420,7 @@ def test_suite(
verbose_flag,
gc_flag,
memory64_flag,
multi_memory_flag,
qemu_flag,
qemu_firmware,
log,
@ -546,6 +559,13 @@ def main():
dest="memory64_flag",
help="Running with memory64 feature",
)
parser.add_argument(
"--multi-memory",
action="store_true",
default=False,
dest="multi_memory_flag",
help="Running with multi-memory feature",
)
parser.add_argument(
"cases",
metavar="path_to__case",
@ -591,6 +611,7 @@ def main():
options.verbose_flag,
options.gc_flag,
options.memory64_flag,
options.multi_memory_flag,
options.parl_flag,
options.qemu_flag,
options.qemu_firmware,
@ -619,6 +640,7 @@ def main():
options.verbose_flag,
options.gc_flag,
options.memory64_flag,
options.multi_memory_flag,
options.qemu_flag,
options.qemu_firmware,
options.log,