Implement Exception Handling for classic interpreter (#3096)

This PR adds the initial support for WASM exception handling:
* Inside the classic interpreter only:
  * Initial handling of Tags
  * Initial handling of Exceptions based on W3C Exception Proposal
  * Import and Export of Exceptions and Tags
* Add `cmake -DWAMR_BUILD_EXCE_HANDLING=1/0` option to enable/disable
  the feature, and by default it is disabled
* Update the wamr-test-suites scripts to test the feature
* Additional CI/CD changes to validate the exception spec proposal cases

Refer to:
https://github.com/bytecodealliance/wasm-micro-runtime/issues/1884
587513f3c6
8bebfe9ad7
59bccdfed8

Signed-off-by: Ricardo Aguilar <ricardoaguilar@siemens.com>
Co-authored-by: Chris Woods <chris.woods@siemens.com>
Co-authored-by: Rene Ermler <rene.ermler@siemens.com>
Co-authored-by: Trenner Thomas <trenner.thomas@siemens.com>
This commit is contained in:
Wenyong Huang
2024-01-31 08:27:17 +08:00
committed by GitHub
parent 7e65f9a244
commit af318bac81
16 changed files with 1620 additions and 39 deletions

View File

@ -3259,6 +3259,17 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache,
u8 = read_uint8(p); /* 0x00 */
break;
#if WASM_ENABLE_EXCE_HANDLING != 0
case WASM_OP_TRY:
case WASM_OP_CATCH:
case WASM_OP_THROW:
case WASM_OP_RETHROW:
case WASM_OP_DELEGATE:
case WASM_OP_CATCH_ALL:
/* TODO */
return false;
#endif
case WASM_OP_DROP:
case WASM_OP_SELECT:
case WASM_OP_DROP_64:
@ -6173,6 +6184,18 @@ re_scan:
break;
}
#if WASM_ENABLE_EXCE_HANDLING != 0
case WASM_OP_TRY:
case WASM_OP_CATCH:
case WASM_OP_THROW:
case WASM_OP_RETHROW:
case WASM_OP_DELEGATE:
case WASM_OP_CATCH_ALL:
/* TODO */
set_error_buf(error_buf, error_buf_size, "unsupported opcode");
goto fail;
#endif
case WASM_OP_DROP:
{
BranchBlock *cur_block = loader_ctx->frame_csp - 1;