[前][次][番号順一覧][スレッド一覧]

ruby-changes:62173

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Fri, 10 Jul 2020 12:24:02 +0900 (JST)
Subject: [ruby-changes:62173] 4b8170ce80 (master): vm_push_frame: move assertions out of the function

https://git.ruby-lang.org/ruby.git/commit/?id=4b8170ce80

From 4b8170ce8027863b2085c105f4c4aaad0489328b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Mon, 6 Jul 2020 14:58:57 +0900
Subject: vm_push_frame: move assertions out of the function

These assertions are purely static.  Ned not be checked on-the-fly.

diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 6d4bc5b..fffe540 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -327,6 +327,10 @@ vm_push_frame_debug_counter_inc( https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L327
 #define vm_push_frame_debug_counter_inc(ec, cfp, t) /* void */
 #endif
 
+STATIC_ASSERT(VM_ENV_DATA_INDEX_ME_CREF, VM_ENV_DATA_INDEX_ME_CREF == -2);
+STATIC_ASSERT(VM_ENV_DATA_INDEX_SPECVAL, VM_ENV_DATA_INDEX_SPECVAL == -1);
+STATIC_ASSERT(VM_ENV_DATA_INDEX_FLAGS,   VM_ENV_DATA_INDEX_FLAGS   == -0);
+
 static void
 vm_push_frame(rb_execution_context_t *ec,
 	      const rb_iseq_t *iseq,
@@ -364,9 +368,6 @@ vm_push_frame(rb_execution_context_t *ec, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L368
     }
 
     /* setup ep with managing data */
-    VM_ASSERT(VM_ENV_DATA_INDEX_ME_CREF == -2);
-    VM_ASSERT(VM_ENV_DATA_INDEX_SPECVAL == -1);
-    VM_ASSERT(VM_ENV_DATA_INDEX_FLAGS   == -0);
     *sp++ = cref_or_me; /* ep[-2] / Qnil or T_IMEMO(cref) or T_IMEMO(ment) */
     *sp++ = specval     /* ep[-1] / block handler or prev env ptr */;
     *sp   = type;       /* ep[-0] / ENV_FLAGS */
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]