From d41a2612f45c614eb8344521a37f278a53766add Mon Sep 17 00:00:00 2001 From: dearblue Date: Sun, 24 Dec 2023 13:56:25 +0900 Subject: [PATCH] Allow `OP_RETURN_BLK` to cross C boundaries The restriction was introduced in commit b563bcb7ff87b859ccdfa30f5d7c3f06cb26a239 to resolve https://github.com/mruby/mruby/issues/3462. Subsequently, the `RBreak` object, introduced by mruby 1.3.0, allowed crossing the C boundary. ```ruby def cross; Class.new { proc { return }.call }; end; cross # => unexpected return (LocalJumpError) # without this patch # => nothing raised # with this patch ``` --- src/vm.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/vm.c b/src/vm.c index 390d0742b..e61e39bab 100644 --- a/src/vm.c +++ b/src/vm.c @@ -2319,10 +2319,6 @@ RETRY_TRY_BLOCK: } /* check jump destination */ while (cibase <= ci && ci->proc != dst) { - if (ci->cci > CINFO_NONE) { /* jump cross C boundary */ - localjump_error(mrb, LOCALJUMP_ERROR_RETURN); - goto L_RAISE; - } ci--; } if (ci <= cibase) { /* no jump destination */