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

ruby-changes:51111

From: mame <ko1@a...>
Date: Wed, 2 May 2018 09:57:55 +0900 (JST)
Subject: [ruby-changes:51111] mame:r63318 (trunk): tool/ruby_vm/views/_insn_name_info.erb: Auto-detect the longest insn name

mame	2018-05-02 09:57:50 +0900 (Wed, 02 May 2018)

  New Revision: 63318

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

  Log:
    tool/ruby_vm/views/_insn_name_info.erb: Auto-detect the longest insn name

  Modified files:
    trunk/iseq.c
    trunk/tool/ruby_vm/views/_insn_name_info.erb
Index: tool/ruby_vm/views/_insn_name_info.erb
===================================================================
--- tool/ruby_vm/views/_insn_name_info.erb	(revision 63317)
+++ tool/ruby_vm/views/_insn_name_info.erb	(revision 63318)
@@ -23,6 +23,7 @@ const unsigned short rb_vm_insn_name_off https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_insn_name_info.erb#L23
     <%= d.map {|i| sprintf("%4d", i) }.join(', ') %>,
 % end
 };
+const int rb_vm_max_insn_name_size = <%= RubyVM::Instructions.map {|i| i.name.size }.max %>;
 ASSERT_VM_INSTRUCTION_SIZE(rb_vm_insn_name_offset);
 
 PACKED_STRUCT(struct rb_vm_insn_name_info_tag {
Index: iseq.c
===================================================================
--- iseq.c	(revision 63317)
+++ iseq.c	(revision 63318)
@@ -1831,7 +1831,8 @@ rb_iseq_disasm_insn(VALUE ret, const VAL https://github.com/ruby/ruby/blob/trunk/iseq.c#L1831
 
     insn_name_buff = insn_name(insn);
     if (1) {
-	rb_str_catf(str, "%04"PRIuSIZE" %-28s ", pos, insn_name_buff);
+	extern const int rb_vm_max_insn_name_size;
+	rb_str_catf(str, "%04"PRIuSIZE" %-*s ", pos, rb_vm_max_insn_name_size, insn_name_buff);
     }
     else {
 	rb_str_catf(str, "%04"PRIuSIZE" %-28.*s ", pos,

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

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