summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-04 01:46:01 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-04 01:46:01 (GMT)
commit9edca48cffa91a6e267d77c538ed690529666537 (patch)
tree379db717757617a5c1f83e57d47a6539f2dfc3e8 /template
parent7acd7b2771bc5cc3074402e4145775c735168fcb (diff)
insns_info.inc.tmpl: share large tablese
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'template')
-rw-r--r--template/insns_info.inc.tmpl28
1 files changed, 18 insertions, 10 deletions
diff --git a/template/insns_info.inc.tmpl b/template/insns_info.inc.tmpl
index 11c2b28..c4bbf0f 100644
--- a/template/insns_info.inc.tmpl
+++ b/template/insns_info.inc.tmpl
@@ -13,28 +13,35 @@
#define <%=t%> '<%=c%>'
% end
-static const unsigned short insn_name_info_offset[] = {
+extern const struct rb_vm_insn_name_info rb_vm_insn_name_info_base;
+extern const unsigned short rb_vm_insn_name_info_offset[];
+extern const char rb_vm_insn_operand_info[][8];
+extern const unsigned short rb_vm_insn_stack_push_num_info[];
+#define insn_name_info (const char *)&rb_vm_insn_name_info_base+rb_vm_insn_name_info_offset
+#define insn_operand_info rb_vm_insn_operand_info
+#define rb_vm_insn_stack_push_num_info insn_stack_push_num_info
+
+#ifdef RUBY_VM_INSNS_INFO
+const unsigned short rb_vm_insn_name_info_offset[] = {
% insn_name_length = @insns.inject(0) do |ofs, insn|
<%= ofs %>,
% ofs + insn.name.size + 1
% end
};
-ASSERT_VM_INSTRUCTION_SIZE(insn_name_info_offset);
+ASSERT_VM_INSTRUCTION_SIZE(rb_vm_insn_name_info_offset);
-static const struct {
+const struct rb_vm_insn_name_info {
% @insns.each_with_index do |insn, i|
char L<%=i%>[<%= insn.name.size+1 %>];
% end
-} insn_name_info_base = {
+} rb_vm_insn_name_info_base = {
% @insns.each do |insn|
"<%= insn.name %>",
% end
};
-#define insn_name_info insn_name_info_base.L0+insn_name_info_offset
-
-static const char insn_operand_info[][8] = {
+const char rb_vm_insn_operand_info[][8] = {
% @insns.each do |insn|
"\<%= (insn.opes.size+1).to_s(8) %>""<%
insn.opes.each {|type, _|
@@ -43,16 +50,17 @@ static const char insn_operand_info[][8] = {
% end
};
-ASSERT_VM_INSTRUCTION_SIZE(insn_operand_info);
+ASSERT_VM_INSTRUCTION_SIZE(rb_vm_insn_operand_info);
#ifdef USE_INSN_RET_NUM
-static const unsigned short insn_stack_push_num_info[] = {
+const unsigned short rb_vm_insn_stack_push_num_info[] = {
% @insns.each do |insn|
<%= insn.rets.size %>,
% end
};
-ASSERT_VM_INSTRUCTION_SIZE(insn_stack_push_num_info);
+ASSERT_VM_INSTRUCTION_SIZE(rb_vm_insn_stack_push_num_info);
+#endif
#endif
#ifdef USE_INSN_STACK_INCREASE