mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
tool/ruby_vm/views/_insn_name_info.erb: Auto-detect the longest insn name
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8bfc46a117
commit
18c40b16d0
2 changed files with 3 additions and 1 deletions
3
iseq.c
3
iseq.c
|
@ -1831,7 +1831,8 @@ rb_iseq_disasm_insn(VALUE ret, const VALUE *code, size_t pos,
|
||||||
|
|
||||||
insn_name_buff = insn_name(insn);
|
insn_name_buff = insn_name(insn);
|
||||||
if (1) {
|
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 {
|
else {
|
||||||
rb_str_catf(str, "%04"PRIuSIZE" %-28.*s ", pos,
|
rb_str_catf(str, "%04"PRIuSIZE" %-28.*s ", pos,
|
||||||
|
|
|
@ -23,6 +23,7 @@ const unsigned short rb_vm_insn_name_offset[] = {
|
||||||
<%= d.map {|i| sprintf("%4d", i) }.join(', ') %>,
|
<%= d.map {|i| sprintf("%4d", i) }.join(', ') %>,
|
||||||
% end
|
% 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);
|
ASSERT_VM_INSTRUCTION_SIZE(rb_vm_insn_name_offset);
|
||||||
|
|
||||||
PACKED_STRUCT(struct rb_vm_insn_name_info_tag {
|
PACKED_STRUCT(struct rb_vm_insn_name_info_tag {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue