ruby-changes:46682
From: nobu <ko1@a...>
Date: Fri, 19 May 2017 23:58:42 +0900 (JST)
Subject: [ruby-changes:46682] nobu:r58797 (trunk): compile.c: dump_disasm_list_with_cursor
nobu 2017-05-19 23:58:38 +0900 (Fri, 19 May 2017) New Revision: 58797 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58797 Log: compile.c: dump_disasm_list_with_cursor * compile.c (dump_disasm_list_with_cursor): improve disassemble list. show whole elemetns and mark the current element. Modified files: trunk/compile.c Index: compile.c =================================================================== --- compile.c (revision 58796) +++ compile.c (revision 58797) @@ -427,7 +427,8 @@ freeze_hide_obj(VALUE obj) https://github.com/ruby/ruby/blob/trunk/compile.c#L427 #define gl_node_level ISEQ_COMPILE_DATA(iseq)->node_level #endif -static void dump_disasm_list(LINK_ELEMENT *elem); +static void dump_disasm_list_with_cursor(const LINK_ELEMENT *elem, const LINK_ELEMENT *curr); +static void dump_disasm_list(const LINK_ELEMENT *elem); static int insn_data_length(INSN *iobj); static int calc_sp_depth(int depth, INSN *iobj); @@ -1631,7 +1632,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L1632 line_info_index = code_index = sp = 0; #define BADINSN_ERROR \ - (dump_disasm_list(list), \ + (dump_disasm_list_with_cursor(&anchor->anchor, list), \ xfree(generated_iseq), \ xfree(line_info_table), \ COMPILE_ERROR) @@ -6494,7 +6495,13 @@ insn_data_to_s_detail(INSN *iobj) https://github.com/ruby/ruby/blob/trunk/compile.c#L6495 } static void -dump_disasm_list(struct iseq_link_element *link) +dump_disasm_list(const LINK_ELEMENT *link) +{ + dump_disasm_list_with_cursor(link, NULL); +} + +static void +dump_disasm_list_with_cursor(const LINK_ELEMENT *link, const LINK_ELEMENT *curr) { int pos = 0; INSN *iobj; @@ -6504,6 +6511,7 @@ dump_disasm_list(struct iseq_link_elemen https://github.com/ruby/ruby/blob/trunk/compile.c#L6511 printf("-- raw disasm--------\n"); while (link) { + if (curr) putc(curr == link ? '*' : ' ', stdout); switch (link->type) { case ISEQ_ELEMENT_INSN: { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/