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

ruby-changes:54742

From: shyouhei <ko1@a...>
Date: Thu, 31 Jan 2019 14:23:03 +0900 (JST)
Subject: [ruby-changes:54742] shyouhei:r66959 (trunk): _insn_operand_info.erb: use C99

shyouhei	2019-01-31 14:22:58 +0900 (Thu, 31 Jan 2019)

  New Revision: 66959

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

  Log:
    _insn_operand_info.erb: use C99
    
    Same as r66957.

  Modified files:
    trunk/tool/ruby_vm/views/_insn_operand_info.erb
Index: tool/ruby_vm/views/_insn_operand_info.erb
===================================================================
--- tool/ruby_vm/views/_insn_operand_info.erb	(revision 66958)
+++ tool/ruby_vm/views/_insn_operand_info.erb	(revision 66959)
@@ -13,38 +13,25 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_insn_operand_info.erb#L13
 %
 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

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

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