summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--iseq.c3
-rw-r--r--tool/ruby_vm/views/_insn_name_info.erb1
2 files changed, 3 insertions, 1 deletions
diff --git a/iseq.c b/iseq.c
index 4748bdd..74a29a6 100644
--- a/iseq.c
+++ b/iseq.c
@@ -1831,7 +1831,8 @@ rb_iseq_disasm_insn(VALUE ret, const VALUE *code, size_t pos,
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,
diff --git a/tool/ruby_vm/views/_insn_name_info.erb b/tool/ruby_vm/views/_insn_name_info.erb
index 581869f..f690a7b 100644
--- a/tool/ruby_vm/views/_insn_name_info.erb
+++ b/tool/ruby_vm/views/_insn_name_info.erb
@@ -23,6 +23,7 @@ const unsigned short rb_vm_insn_name_offset[] = {
<%= 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 {