Enable ref types and bulk memory by default for wamrc (#838)

Enable ref types feature and bulk memory feature by default for wamrc
and provide "--disable-ref-types", "--disable-bulk-memory"  to disable
them.
And remove the ref_type_flag option in wasm_loader.c which is used to
control whether to enable ref types or not when ENABLE_REF_TYPES
macro is enabled in wamrc. As the wasm binary format with ref types
is compatible with the binary format before, we can remove the option.
Also update the spec test scripts.
This commit is contained in:
liang.he
2021-11-18 17:42:49 +08:00
committed by GitHub
parent 5d48a18614
commit 1dccf39d16
10 changed files with 312 additions and 576 deletions

View File

@ -49,7 +49,7 @@ def ignore_the_case(
aot_flag=False,
sgx_flag=False,
multi_module_flag=False,
reference_type_flag=True,
multi_thread_flag=False,
simd_flag=False,
):
if case_name in ["comments", "inline-module", "names"]:
@ -98,7 +98,7 @@ def test_case(
aot_flag=False,
sgx_flag=False,
multi_module_flag=False,
reference_type_flag=True,
multi_thread_flag=False,
simd_flag=False,
clean_up_flag=True,
verbose_flag=True,
@ -112,7 +112,7 @@ def test_case(
aot_flag,
sgx_flag,
multi_module_flag,
reference_type_flag,
multi_thread_flag,
simd_flag,
):
return True
@ -130,8 +130,8 @@ def test_case(
CMD.append("--aot-target")
CMD.append(target)
if reference_type_flag:
CMD.append("--ref_types")
if multi_thread_flag:
CMD.append("--multi-thread")
if sgx_flag:
CMD.append("--sgx")
@ -193,7 +193,7 @@ def test_suite(
aot_flag=False,
sgx_flag=False,
multi_module_flag=False,
reference_type_flag=True,
multi_thread_flag=False,
simd_flag=False,
clean_up_flag=True,
verbose_flag=True,
@ -215,7 +215,7 @@ def test_suite(
aot_flag,
sgx_flag,
multi_module_flag,
reference_type_flag,
multi_thread_flag,
simd_flag,
clean_up_flag,
verbose_flag,
@ -237,7 +237,7 @@ def test_suite_parallelly(
aot_flag=False,
sgx_flag=False,
multi_module_flag=False,
reference_type_flag=True,
multi_thread_flag=False,
simd_flag=False,
clean_up_flag=False,
verbose_flag=False,
@ -264,7 +264,7 @@ def test_suite_parallelly(
aot_flag,
sgx_flag,
multi_module_flag,
reference_type_flag,
multi_thread_flag,
simd_flag,
clean_up_flag,
verbose_flag,
@ -310,11 +310,11 @@ def main():
help="Specify Target ",
)
parser.add_argument(
"-r",
"-p",
action="store_true",
default=False,
dest="reference_type_flag",
help="Running with the Reference-type feature",
dest="multi_thread_flag",
help="Running with the Multi-Thread feature",
)
parser.add_argument(
"-S",
@ -337,13 +337,6 @@ def main():
dest="sgx_flag",
help="Running with SGX environment",
)
parser.add_argument(
"--parl",
action="store_true",
default=False,
dest="parl_flag",
help="To run whole test suite parallelly",
)
parser.add_argument(
"--no_clean_up",
action="store_false",
@ -351,6 +344,13 @@ def main():
dest="clean_up_flag",
help="Does not remove tmpfiles. But it will be enabled while running parallelly",
)
parser.add_argument(
"--parl",
action="store_true",
default=False,
dest="parl_flag",
help="To run whole test suite parallelly",
)
parser.add_argument(
"--quiet",
action="store_false",
@ -385,7 +385,7 @@ def main():
options.aot_flag,
options.sgx_flag,
options.multi_module_flag,
options.reference_type_flag,
options.multi_thread_flag,
options.simd_flag,
options.clean_up_flag,
options.verbose_flag,
@ -401,7 +401,7 @@ def main():
options.aot_flag,
options.sgx_flag,
options.multi_module_flag,
options.reference_type_flag,
options.multi_thread_flag,
options.simd_flag,
options.clean_up_flag,
options.verbose_flag,
@ -417,7 +417,7 @@ def main():
options.aot_flag,
options.sgx_flag,
options.multi_module_flag,
options.reference_type_flag,
options.multi_thread_flag,
options.simd_flag,
options.clean_up_flag,
options.verbose_flag,

View File

@ -210,8 +210,8 @@ parser.add_argument('--sgx', action='store_true',
parser.add_argument('--simd', default=False, action='store_true',
help="Enable SIMD")
parser.add_argument('--ref_types', default=False, action='store_true',
help="Enable Reference types")
parser.add_argument('--multi-thread', default=False, action='store_true',
help="Enable Multi-thread")
parser.add_argument('--verbose', default=False, action='store_true',
help='show more logs')
@ -939,12 +939,11 @@ def compile_wasm_to_aot(wasm_tempfile, aot_tempfile, runner, opts, r):
if opts.sgx:
cmd.append("-sgx")
if opts.simd:
cmd.append("--enable-simd")
if not opts.simd:
cmd.append("--disable-simd")
if opts.ref_types:
cmd.append("--enable-ref-types")
cmd.append("--enable-bulk-memory")
if opts.multi_thread:
cmd.append("--enable-multi-thread")
# disable llvm link time optimization as it might convert
# code of tail call into code of dead loop, and stack overflow

View File

@ -38,9 +38,6 @@ ENABLE_SIMD=0
#unit test case arrary
TEST_CASE_ARR=()
SGX_OPT=""
# enable reference-types and bulk-memory by default
# as they are finished and merged into spec
ENABLE_REF_TYPES=1
PLATFORM=$(uname -s | tr A-Z a-z)
PARALLELISM=0
@ -104,9 +101,6 @@ do
p)
echo "enable multi thread feature"
ENABLE_MULTI_THREAD=1
# Disable reference-types when multi-thread is enabled
echo "disable reference-types for multi thread"
ENABLE_REF_TYPES=0
;;
S)
echo "enable SIMD feature"
@ -162,7 +156,6 @@ readonly CLASSIC_INTERP_COMPILE_FLAGS="\
-DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0 \
-DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 \
-DWAMR_BUILD_SPEC_TEST=1 \
-DWAMR_BUILD_MULTI_MODULE=${ENABLE_MULTI_MODULE} \
-DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE}"
readonly FAST_INTERP_COMPILE_FLAGS="\
@ -170,7 +163,6 @@ readonly FAST_INTERP_COMPILE_FLAGS="\
-DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1 \
-DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 \
-DWAMR_BUILD_SPEC_TEST=1 \
-DWAMR_BUILD_MULTI_MODULE=${ENABLE_MULTI_MODULE} \
-DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE}"
# jit: report linking error if set COLLECT_CODE_COVERAGE,
@ -179,15 +171,13 @@ readonly JIT_COMPILE_FLAGS="\
-DWAMR_BUILD_TARGET=${TARGET} \
-DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_INTERP=0 \
-DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=1 \
-DWAMR_BUILD_SPEC_TEST=1 \
-DWAMR_BUILD_MULTI_MODULE=${ENABLE_MULTI_MODULE}"
-DWAMR_BUILD_SPEC_TEST=1"
readonly AOT_COMPILE_FLAGS="\
-DWAMR_BUILD_TARGET=${TARGET} \
-DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_INTERP=0 \
-DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=1 \
-DWAMR_BUILD_SPEC_TEST=1 \
-DWAMR_BUILD_MULTI_MODULE=${ENABLE_MULTI_MODULE} \
-DCOLLECT_CODE_COVERAGE=${COLLECT_CODE_COVERAGE}"
readonly COMPILE_FLAGS=(
@ -387,9 +377,8 @@ function spec_test()
fi
fi
# reference type in all mode
if [[ ${ENABLE_REF_TYPES} == 1 ]]; then
ARGS_FOR_SPEC_TEST+="-r "
if [[ ${ENABLE_MULTI_THREAD} == 1 ]]; then
ARGS_FOR_SPEC_TEST+="-p "
fi
# require warmc only in aot mode
@ -536,20 +525,26 @@ function collect_coverage()
function trigger()
{
local EXTRA_COMPILE_FLAGS=""
# default enabled features
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_BULK_MEMORY=1"
if [[ ${ENABLE_MULTI_MODULE} == 1 ]];then
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_MULTI_MODULE=1"
else
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_MULTI_MODULE=0"
fi
if [[ ${ENABLE_MULTI_THREAD} == 1 ]];then
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_LIB_PTHREAD=1"
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_REF_TYPES=0"
else
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_REF_TYPES=1"
fi
if [[ ${ENABLE_SIMD} == 1 ]]; then
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SIMD=1"
fi
if [[ ${ENABLE_REF_TYPES} == 1 ]]; then
# spec test cases for reference type depends on
# multi-module and bulk memory
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_REF_TYPES=1"
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_MULTI_MODULE=1"
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_BULK_MEMORY=1"
else
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SIMD=0"
fi
for t in "${TYPE[@]}"; do