summaryrefslogtreecommitdiff
path: root/tool/ruby_vm
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-31 05:22:58 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-31 05:22:58 +0000
commite20714062bf57efcbff0dd3162b148dd35312865 (patch)
treea81fd5200780ca1c0c288939dff32d1231e5064e /tool/ruby_vm
parent971f965da9a9f8f7cea9bead6c883e79dfc5b715 (diff)
_insn_operand_info.erb: use C99
Same as r66957. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/ruby_vm')
-rw-r--r--tool/ruby_vm/views/_insn_operand_info.erb39
1 files changed, 13 insertions, 26 deletions
diff --git a/tool/ruby_vm/views/_insn_operand_info.erb b/tool/ruby_vm/views/_insn_operand_info.erb
index 6a28cac4f4..69d361521a 100644
--- a/tool/ruby_vm/views/_insn_operand_info.erb
+++ b/tool/ruby_vm/views/_insn_operand_info.erb
@@ -13,38 +13,25 @@
%
CONSTFUNC(MAYBE_UNUSED(static const char *insn_op_types(VALUE insn)));
CONSTFUNC(MAYBE_UNUSED(static int insn_op_type(VALUE insn, long pos)));
-extern const char *rb_vm_insn_op_info;
-extern const unsigned short rb_vm_insn_op_offset[];
-#ifdef RUBY_VM_INSNS_INFO
-const unsigned short rb_vm_insn_op_offset[] = {
-% c.each_slice 14 do |d|
- <%= d.map {|i| sprintf("%3d", i) }.join(', ') %>,
-% end
-};
-ASSERT_VM_INSTRUCTION_SIZE(rb_vm_insn_op_offset);
-
-PACKED_STRUCT(struct rb_vm_insn_op_info_tag {
-% b.each_slice 3 do |d|
- <%= d.map {|i|
- sprintf("const char L%03d[%2d]", i, a[i].length + 1)
- }.join('; ') %>;
+const char *
+insn_op_types(VALUE i)
+{
+ static const char x[] =
+% a.each_slice 5 do |d|
+ <%= d.map {|i| sprintf("%-6s", cstr(i)) }.join(' "\0" ') %> "\0"
% end
-});
+ ;
-static const struct rb_vm_insn_op_info_tag rb_vm_insn_op_base = {
-% a.each_slice 8 do |d|
- <%= d.map {|i| sprintf("%-6s", cstr(i)) }.join(', ') %>,
+ static const unsigned short y[] = {
+% c.each_slice 12 do |d|
+ <%= d.map {|i| sprintf("%3d", i) }.join(', ') %>,
% end
-};
+ };
-const char *rb_vm_insn_op_info = (const char *)&rb_vm_insn_op_base;
-#endif
+ ASSERT_VM_INSTRUCTION_SIZE(y);
-const char *
-insn_op_types(VALUE i)
-{
- return &rb_vm_insn_op_info[rb_vm_insn_op_offset[i]];
+ return &x[y[i]];
}
int