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

ruby-changes:60784

From: Nobuyoshi <ko1@a...>
Date: Wed, 15 Apr 2020 16:07:05 +0900 (JST)
Subject: [ruby-changes:60784] 69b3e0ac59 (master): Create succ_index_table as a part of `iseq_setup`

https://git.ruby-lang.org/ruby.git/commit/?id=69b3e0ac59

From 69b3e0ac59f99bbd7e9a76af283f0be1991a3bde Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 15 Apr 2020 12:57:14 +0900
Subject: Create succ_index_table as a part of `iseq_setup`

With compiling `CPDEBUG >= 2`, `rb_iseq_disasm` segfaults if this
table has not been created.  Also `ibf_load_iseq_each` calls
`rb_iseq_insns_info_encode_positions`.

diff --git a/compile.c b/compile.c
index a32a7f1..3c94818 100644
--- a/compile.c
+++ b/compile.c
@@ -1423,6 +1423,13 @@ iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) https://github.com/ruby/ruby/blob/trunk/compile.c#L1423
     debugs("[compile step 6 (update_catch_except_flags)] \n");
     update_catch_except_flags(iseq->body);
 
+#if VM_INSN_INFO_TABLE_IMPL == 2
+    if (iseq->body->insns_info.succ_index_table == NULL) {
+        debugs("[compile step 7 (rb_iseq_insns_info_encode_positions)] \n");
+        rb_iseq_insns_info_encode_positions(iseq);
+    }
+#endif
+
     if (compile_debug > 1) {
 	VALUE str = rb_iseq_disasm(iseq);
 	printf("%s\n", StringValueCStr(str));
diff --git a/iseq.c b/iseq.c
index 9a6dad3..9e9fdeb 100644
--- a/iseq.c
+++ b/iseq.c
@@ -615,6 +615,7 @@ void https://github.com/ruby/ruby/blob/trunk/iseq.c#L615
 rb_iseq_insns_info_encode_positions(const rb_iseq_t *iseq)
 {
 #if VM_INSN_INFO_TABLE_IMPL == 2
+    /* create succ_index_table */
     struct rb_iseq_constant_body *const body = iseq->body;
     int size = body->insns_info.size;
     int max_pos = body->iseq_size;
@@ -657,13 +658,6 @@ finish_iseq_build(rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/iseq.c#L658
     ISEQ_COMPILE_DATA_CLEAR(iseq);
     compile_data_free(data);
 
-#if VM_INSN_INFO_TABLE_IMPL == 2 /* succinct bitvector */
-    /* create succ_index_table */
-    if (body->insns_info.succ_index_table == NULL) {
-	rb_iseq_insns_info_encode_positions(iseq);
-    }
-#endif
-
 #if VM_CHECK_MODE > 0 && VM_INSN_INFO_TABLE_IMPL > 0
     validate_get_insn_info(iseq);
 #endif
-- 
cgit v0.10.2


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

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