From 92f2cf1bf9430514a182f6e7bb8c2090b8285cbd Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Mon, 24 Jun 2024 15:59:38 +0900 Subject: [PATCH] With ASAN `EC_REPUSH_TAG` doesn't work With ASAN, `EC_TMPPOP_TAG`/`EC_REPUSH_TAG` doesn't work so rewrite it without them. They are used for the performance, but here calling stacked `END{}` and not so performance critical. --- eval_jump.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/eval_jump.c b/eval_jump.c index e8e74f4e70..7593a35e36 100644 --- a/eval_jump.c +++ b/eval_jump.c @@ -112,21 +112,21 @@ rb_ec_exec_end_proc(rb_execution_context_t * ec) { enum ruby_tag_type state; volatile VALUE errinfo = ec->errinfo; + volatile bool finished = false; - EC_PUSH_TAG(ec); - if ((state = EC_EXEC_TAG()) == TAG_NONE) { - again: - exec_end_procs_chain(&ephemeral_end_procs, &ec->errinfo); - exec_end_procs_chain(&end_procs, &ec->errinfo); + while (!finished) { + EC_PUSH_TAG(ec); + if ((state = EC_EXEC_TAG()) == TAG_NONE) { + exec_end_procs_chain(&ephemeral_end_procs, &ec->errinfo); + exec_end_procs_chain(&end_procs, &ec->errinfo); + finished = true; + } + EC_POP_TAG(); + if (state != TAG_NONE) { + error_handle(ec, ec->errinfo, state); + if (!NIL_P(ec->errinfo)) errinfo = ec->errinfo; + } } - else { - EC_TMPPOP_TAG(); - error_handle(ec, ec->errinfo, state); - if (!NIL_P(ec->errinfo)) errinfo = ec->errinfo; - EC_REPUSH_TAG(); - goto again; - } - EC_POP_TAG(); ec->errinfo = errinfo; }