Enhance XIP and add XIP document (#863)

Auto detect whether file is XIP file before loading module in posix like and
linux-sgx platforms, and if yes, mmap executable memory automatically to
run the XIP file.
Add document about XIP feature.
Enable test spec cases with XIP feature.
This commit is contained in:
Wenyong Huang
2021-12-06 17:25:10 +08:00
committed by GitHub
parent 3f808d4596
commit b490a229f6
11 changed files with 184 additions and 24 deletions

View File

@ -51,6 +51,7 @@ def ignore_the_case(
multi_module_flag=False,
multi_thread_flag=False,
simd_flag=False,
xip_flag=False,
):
if case_name in ["comments", "inline-module", "names"]:
return True
@ -100,6 +101,7 @@ def test_case(
multi_module_flag=False,
multi_thread_flag=False,
simd_flag=False,
xip_flag=False,
clean_up_flag=True,
verbose_flag=True,
):
@ -114,6 +116,7 @@ def test_case(
multi_module_flag,
multi_thread_flag,
simd_flag,
xip_flag,
):
return True
@ -139,6 +142,9 @@ def test_case(
if simd_flag:
CMD.append("--simd")
if xip_flag:
CMD.append("--xip")
if not clean_up_flag:
CMD.append("--no_cleanup")
@ -195,6 +201,7 @@ def test_suite(
multi_module_flag=False,
multi_thread_flag=False,
simd_flag=False,
xip_flag=False,
clean_up_flag=True,
verbose_flag=True,
):
@ -217,6 +224,7 @@ def test_suite(
multi_module_flag,
multi_thread_flag,
simd_flag,
xip_flag,
clean_up_flag,
verbose_flag,
)
@ -239,6 +247,7 @@ def test_suite_parallelly(
multi_module_flag=False,
multi_thread_flag=False,
simd_flag=False,
xip_flag=False,
clean_up_flag=False,
verbose_flag=False,
):
@ -266,6 +275,7 @@ def test_suite_parallelly(
multi_module_flag,
multi_thread_flag,
simd_flag,
xip_flag,
clean_up_flag,
verbose_flag,
],
@ -323,6 +333,13 @@ def main():
dest="simd_flag",
help="Running with the SIMD feature",
)
parser.add_argument(
"-X",
action="store_true",
default=False,
dest="xip_flag",
help="Running with the XIP feature",
)
parser.add_argument(
"-t",
action="store_true",
@ -387,6 +404,7 @@ def main():
options.multi_module_flag,
options.multi_thread_flag,
options.simd_flag,
options.xip_flag,
options.clean_up_flag,
options.verbose_flag,
)
@ -403,6 +421,7 @@ def main():
options.multi_module_flag,
options.multi_thread_flag,
options.simd_flag,
options.xip_flag,
options.clean_up_flag,
options.verbose_flag,
)
@ -419,6 +438,7 @@ def main():
options.multi_module_flag,
options.multi_thread_flag,
options.simd_flag,
options.xip_flag,
options.clean_up_flag,
options.verbose_flag,
)

View File

@ -210,6 +210,9 @@ parser.add_argument('--sgx', action='store_true',
parser.add_argument('--simd', default=False, action='store_true',
help="Enable SIMD")
parser.add_argument('--xip', default=False, action='store_true',
help="Enable XIP")
parser.add_argument('--multi-thread', default=False, action='store_true',
help="Enable Multi-thread")
@ -942,6 +945,10 @@ def compile_wasm_to_aot(wasm_tempfile, aot_tempfile, runner, opts, r):
if not opts.simd:
cmd.append("--disable-simd")
if opts.xip:
cmd.append("--enable-indirect-mode")
cmd.append("--disable-llvm-intrinsics")
if opts.multi_thread:
cmd.append("--enable-multi-thread")

View File

@ -17,9 +17,10 @@ function help()
echo "-s {suite_name} test only one suite (spec)"
echo "-m set compile target of iwasm(x86_64\x86_32\armv7_vfp\thumbv7_vfp\riscv64_lp64d\riscv64_lp64)"
echo "-t set compile type of iwasm(classic-interp\fast-interp\jit\aot)"
echo "-M enable the multi module feature"
echo "-M enable multi module feature"
echo "-p enable multi thread feature"
echo "-S enable SIMD"
echo "-S enable SIMD feature"
echo "-X enable XIP feature"
echo "-x test SGX"
echo "-b use the wabt binary release package instead of compiling from the source code"
echo "-P run the spec test parallelly"
@ -35,13 +36,14 @@ ENABLE_MULTI_MODULE=0
ENABLE_MULTI_THREAD=0
COLLECT_CODE_COVERAGE=0
ENABLE_SIMD=0
ENABLE_XIP=0
#unit test case arrary
TEST_CASE_ARR=()
SGX_OPT=""
PLATFORM=$(uname -s | tr A-Z a-z)
PARALLELISM=0
while getopts ":s:cabt:m:MCpSxP" opt
while getopts ":s:cabt:m:MCpSXxP" opt
do
OPT_PARSED="TRUE"
case $opt in
@ -106,6 +108,10 @@ do
echo "enable SIMD feature"
ENABLE_SIMD=1
;;
X)
echo "enable XIP feature"
ENABLE_XIP=1
;;
x)
echo "test SGX"
SGX_OPT="--sgx"
@ -378,7 +384,11 @@ function spec_test()
fi
if [[ ${ENABLE_MULTI_THREAD} == 1 ]]; then
ARGS_FOR_SPEC_TEST+="-p "
ARGS_FOR_SPEC_TEST+="-p "
fi
if [[ ${ENABLE_XIP} == 1 ]]; then
ARGS_FOR_SPEC_TEST+="-X "
fi
# require warmc only in aot mode