From 1a83474ded0b3ed90549c4c6e43e0b3e9ab09851 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 6 Aug 2023 13:32:27 +0900 Subject: [PATCH] Simplify try-rescue loop --- wasm/setjmp.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/wasm/setjmp.c b/wasm/setjmp.c index 0663b57300..198d210bbf 100644 --- a/wasm/setjmp.c +++ b/wasm/setjmp.c @@ -165,9 +165,9 @@ rb_wasm_try_catch_loop_run(struct rb_wasm_try_catch *try_catch, rb_wasm_jmp_buf break; } - while (1) { + { // catch longjmp with target jmp_buf - if (rb_asyncify_unwind_buf && _rb_wasm_active_jmpbuf == target) { + while (rb_asyncify_unwind_buf && _rb_wasm_active_jmpbuf == target) { // do similar steps setjmp does when JMP_BUF_STATE_RETURNING // stop unwinding @@ -182,14 +182,9 @@ rb_wasm_try_catch_loop_run(struct rb_wasm_try_catch *try_catch, rb_wasm_jmp_buf if (try_catch->catch_f) { try_catch->catch_f(try_catch->context); } - continue; - } else if (rb_asyncify_unwind_buf /* unrelated unwind */) { - return; } - // no unwind, then exit - break; + // no unwind or unrelated unwind, then exit } - return; } void *