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

@ -9,11 +9,6 @@
#include "wasm_export.h"
#include "aot_export.h"
#if WASM_ENABLE_REF_TYPES != 0
extern void
wasm_set_ref_types_flag(bool enable);
#endif
/* clang-format off */
static int
print_help()
@ -48,7 +43,7 @@ print_help()
printf(" object Native object file\n");
printf(" llvmir-unopt Unoptimized LLVM IR\n");
printf(" llvmir-opt Optimized LLVM IR\n");
printf(" --enable-bulk-memory Enable the post-MVP bulk memory feature\n");
printf(" --disable-bulk-memory Disable the MVP bulk memory feature\n");
printf(" --enable-multi-thread Enable multi-thread feature, the dependent features bulk-memory and\n");
printf(" thread-mgr will be enabled automatically\n");
printf(" --enable-tail-call Enable the post-MVP tail call feature\n");
@ -56,7 +51,7 @@ print_help()
printf(" currently 128-bit SIMD is only supported for x86-64 target,\n");
printf(" and by default it is enabled in x86-64 target and disabled\n");
printf(" in other targets\n");
printf(" --enable-ref-types Enable the post-MVP reference types feature\n");
printf(" --disable-ref-types Disable the MVP reference types feature\n");
printf(" --disable-aux-stack-check Disable auxiliary stack overflow/underflow check\n");
printf(" --enable-dump-call-stack Enable stack trace feature\n");
printf(" --enable-perf-profiling Enable function performance profiling\n");
@ -94,6 +89,8 @@ main(int argc, char *argv[])
option.bounds_checks = 2;
option.enable_simd = true;
option.enable_aux_stack_check = true;
option.enable_bulk_memory = true;
option.enable_ref_types = true;
/* Process options */
for (argc--, argv++; argc > 0 && argv[0][0] == '-'; argc--, argv++) {
@ -164,12 +161,13 @@ main(int argc, char *argv[])
if (log_verbose_level < 0 || log_verbose_level > 5)
return print_help();
}
else if (!strcmp(argv[0], "--enable-bulk-memory")) {
option.enable_bulk_memory = true;
else if (!strcmp(argv[0], "--disable-bulk-memory")) {
option.enable_bulk_memory = false;
}
else if (!strcmp(argv[0], "--enable-multi-thread")) {
option.enable_bulk_memory = true;
option.enable_thread_mgr = true;
option.enable_ref_types = false;
}
else if (!strcmp(argv[0], "--enable-tail-call")) {
option.enable_tail_call = true;
@ -181,8 +179,8 @@ main(int argc, char *argv[])
else if (!strcmp(argv[0], "--disable-simd")) {
option.enable_simd = false;
}
else if (!strcmp(argv[0], "--enable-ref-types")) {
option.enable_ref_types = true;
else if (!strcmp(argv[0], "--disable-ref-types")) {
option.enable_ref_types = false;
}
else if (!strcmp(argv[0], "--disable-aux-stack-check")) {
option.enable_aux_stack_check = false;
@ -214,10 +212,6 @@ main(int argc, char *argv[])
option.is_sgx_platform = true;
}
#if WASM_ENABLE_REF_TYPES != 0
wasm_set_ref_types_flag(option.enable_ref_types);
#endif
wasm_file_name = argv[0];
memset(&init_args, 0, sizeof(RuntimeInitArgs));