Implement memory access bound check with hardware trap for 64-bit platforms (#293)

Also implement native stack overflow check with hardware trap for 64-bit platforms
Refine classic interpreter and fast interpreter to improve performance
Update document
This commit is contained in:
wenyongh
2020-06-28 15:41:25 +08:00
committed by GitHub
parent 548926ab1a
commit ee315e4049
33 changed files with 1143 additions and 438 deletions

View File

@ -15,6 +15,7 @@ set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
add_definitions(-DWASM_ENABLE_INTERP=1)
add_definitions(-DWASM_ENABLE_WAMR_COMPILER=1)
add_definitions(-DWASM_ENABLE_BULK_MEMORY=1)
add_definitions(-DWASM_DISABLE_HW_BOUND_CHECK=1)
# Set WAMR_BUILD_TARGET, currently values supported:
# "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32"

View File

@ -26,9 +26,13 @@ print_help()
printf(" Use +feature to enable a feature, or -feature to disable it\n");
printf(" For example, --cpu-features=+feature1,-feature2\n");
printf(" Use --cpu-features=+help to list all the features supported\n");
printf(" --opt-level=n Set the optimization level (0 to 3, default: 3, which is fastest)\n");
printf(" --size-level=n Set the code size level (0 to 3, default: 3, which is smallest)\n");
printf(" --opt-level=n Set the optimization level (0 to 3, default is 3)\n");
printf(" --size-level=n Set the code size level (0 to 3, default is 3)\n");
printf(" -sgx Generate code for SGX platform (Intel Software Guard Extention)\n");
printf(" --bounds-checks=1/0 Enable or disable the bounds checks for memory access:\n");
printf(" by default it is disabled in all 64-bit platforms except SGX and\n");
printf(" in these platforms runtime does bounds checks with hardware trap,\n");
printf(" and by default it is enabled in all 32-bit platforms\n");
printf(" --format=<format> Specifies the format of the output file\n");
printf(" The format supported:\n");
printf(" aot (default) AoT file\n");
@ -61,6 +65,8 @@ main(int argc, char *argv[])
option.opt_level = 3;
option.size_level = 3;
option.output_format = AOT_FORMAT_FILE;
/* default value, enable or disable depends on the platform */
option.bounds_checks = 2;
/* Process options. */
for (argc--, argv++; argc > 0 && argv[0][0] == '-'; argc--, argv++) {
@ -107,6 +113,9 @@ main(int argc, char *argv[])
else if (!strcmp(argv[0], "-sgx")) {
sgx_mode = true;
}
else if (!strncmp(argv[0], "--bounds-checks=", 16)) {
option.bounds_checks = (atoi(argv[0] + 16) == 1) ? 1 : 0;
}
else if (!strncmp(argv[0], "--format=", 9)) {
if (argv[0][9] == '\0')
return print_help();
@ -138,8 +147,10 @@ main(int argc, char *argv[])
if (argc == 0)
return print_help();
if (sgx_mode)
if (sgx_mode) {
option.size_level = 1;
option.is_sgx_platform = true;
}
wasm_file_name = argv[0];