summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-04 01:30:20 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-04 01:30:20 (GMT)
commit7acd7b2771bc5cc3074402e4145775c735168fcb (patch)
tree200173f8861a6c37bd50a494ffbc3996c14720c7 /template
parenta1bbb2a78077e2c337e4a737f4b562c99e2174a1 (diff)
insns_info.inc: position independent
* template/insns_info.inc.tmpl (insn_name_info): make position independent for large strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'template')
-rw-r--r--template/insns_info.inc.tmpl20
1 files changed, 8 insertions, 12 deletions
diff --git a/template/insns_info.inc.tmpl b/template/insns_info.inc.tmpl
index bf26279..11c2b28 100644
--- a/template/insns_info.inc.tmpl
+++ b/template/insns_info.inc.tmpl
@@ -13,13 +13,6 @@
#define <%=t%> '<%=c%>'
% end
-#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
-static const char *insn_name_info[] = {
-% @insns.each do |insn|
- "<%= insn.name %>",
-% end
-};
-#else
static const unsigned short insn_name_info_offset[] = {
% insn_name_length = @insns.inject(0) do |ofs, insn|
<%= ofs %>,
@@ -29,14 +22,17 @@ static const unsigned short insn_name_info_offset[] = {
ASSERT_VM_INSTRUCTION_SIZE(insn_name_info_offset);
-static const char insn_name_info_base[<%=insn_name_length%>] = ""
+static const struct {
+% @insns.each_with_index do |insn, i|
+ char L<%=i%>[<%= insn.name.size+1 %>];
+% end
+} insn_name_info_base = {
% @insns.each do |insn|
- "<%= insn.name %>\0"
+ "<%= insn.name %>",
% end
-;
+};
-#define insn_name_info insn_name_info_base+insn_name_info_offset
-#endif
+#define insn_name_info insn_name_info_base.L0+insn_name_info_offset
static const char insn_operand_info[][8] = {
% @insns.each do |insn|