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

ruby-changes:49469

From: nobu <ko1@a...>
Date: Thu, 4 Jan 2018 08:05:09 +0900 (JST)
Subject: [ruby-changes:49469] nobu:r61584 (trunk): compile.c: fix disasm dump

nobu	2018-01-04 08:05:02 +0900 (Thu, 04 Jan 2018)

  New Revision: 61584

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61584

  Log:
    compile.c: fix disasm dump
    
    * compile.c (DECL_ANCHOR): initialize as anchor type, which is not
      a valid iseq element.
    
    * compile.c (BADINSN_DUMP): dump from the first element, excluding
      the anchor itself.

  Modified files:
    trunk/compile.c
Index: compile.c
===================================================================
--- compile.c	(revision 61583)
+++ compile.c	(revision 61584)
@@ -36,6 +36,7 @@ https://github.com/ruby/ruby/blob/trunk/compile.c#L36
 
 typedef struct iseq_link_element {
     enum {
+	ISEQ_ELEMENT_ANCHOR,
 	ISEQ_ELEMENT_LABEL,
 	ISEQ_ELEMENT_INSN,
 	ISEQ_ELEMENT_ADJUST,
@@ -438,7 +439,7 @@ do { \ https://github.com/ruby/ruby/blob/trunk/compile.c#L439
 /* leave name uninitialized so that compiler warn if INIT_ANCHOR is
  * missing */
 #define DECL_ANCHOR(name) \
-    LINK_ANCHOR name[1] = {{{0,},}}
+    LINK_ANCHOR name[1] = {{{ISEQ_ELEMENT_ANCHOR,},}}
 #define INIT_ANCHOR(name) \
     (name->last = &name->anchor)
 
@@ -1712,7 +1713,7 @@ get_ivar_ic_value(rb_iseq_t *iseq,ID id) https://github.com/ruby/ruby/blob/trunk/compile.c#L1713
 }
 
 #define BADINSN_DUMP(anchor, list, dest) \
-    dump_disasm_list_with_cursor(&anchor->anchor, list, dest)
+    dump_disasm_list_with_cursor(FIRST_ELEMENT(anchor), list, dest)
 
 #define BADINSN_ERROR \
     (xfree(generated_iseq), \
@@ -1923,6 +1924,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L1924
 		}
 		break;
 	    }
+	  default: break;
 	}
 	list = list->next;
     }
@@ -2242,6 +2244,7 @@ get_destination_insn(INSN *iobj) https://github.com/ruby/ruby/blob/trunk/compile.c#L2244
 		events |= trace->event;
 	    }
 	    break;
+	  default: break;
 	}
 	list = list->next;
     }

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

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