aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-01 18:06:28 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-01 18:06:28 +0000
commit6058eeaf0360cd5e56106db1f360a7edf3c91f1a (patch)
treeff1f9409bc8036390b592f1172fc3bae3ee79898
parent3b090adf7c3e95997630e36074f621cc3fbc96f9 (diff)
downloadruby-6058eeaf0360cd5e56106db1f360a7edf3c91f1a.tar.gz
* tool/transcode-tblgen.rb: record infos and BYTE_LOOKUPs as index of
word_array to avoid relocation. * transcode.c (transcode_restartable0): add word_array to get infos and BYTE_LOOKUPs. * transcode_data.h (BYTE_LOOKUP_INFO): change return type to uintptr_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--tool/transcode-tblgen.rb4
-rw-r--r--transcode.c7
-rw-r--r--transcode_data.h2
4 files changed, 18 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 02f72b8fd8..2c879da908 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Tue Sep 2 03:04:33 2008 Tanaka Akira <akr@fsij.org>
+
+ * tool/transcode-tblgen.rb: record infos and BYTE_LOOKUPs as index of
+ word_array to avoid relocation.
+
+ * transcode.c (transcode_restartable0): add word_array to get infos
+ and BYTE_LOOKUPs.
+
+ * transcode_data.h (BYTE_LOOKUP_INFO): change return type to
+ uintptr_t.
+
Tue Sep 2 02:48:30 2008 Tanaka Akira <akr@fsij.org>
* tool/transcode-tblgen.rb: don't need to cast offsets array.
diff --git a/tool/transcode-tblgen.rb b/tool/transcode-tblgen.rb
index 99065869d9..1915d31f64 100644
--- a/tool/transcode-tblgen.rb
+++ b/tool/transcode-tblgen.rb
@@ -358,7 +358,7 @@ End
size = words_code[/\[\d+\]/][1...-1].to_i
words_code.sub!(/^(\};\n\z)/) {
- "\#define #{infos_name} (((uintptr_t)word_array)+sizeof(uintptr_t)*#{size})\n" +
+ "\#define #{infos_name} (sizeof(uintptr_t)*#{size})\n" +
format_infos(infos) + "\n" +
$1
}
@@ -368,7 +368,7 @@ End
size = words_code[/\[\d+\]/][1...-1].to_i
words_code.sub!(/^(\};\n\z)/) {
- "\#define #{name} ((uintptr_t)(word_array+#{size}))\n" +
+ "\#define #{name} (sizeof(uintptr_t)*#{size})\n" +
<<"End" + "\n" + $1
#{offsets_name},
#{infos_name},
diff --git a/transcode.c b/transcode.c
index bc1597e5b0..add97c9695 100644
--- a/transcode.c
+++ b/transcode.c
@@ -480,7 +480,7 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos,
while (1) {
inchar_start = in_p;
tc->recognized_len = 0;
- next_table = tr->conv_tree_start;
+ next_table = ((uintptr_t)tr->word_array) + tr->conv_tree_start;
SUSPEND_OUTPUT_FOLLOWED_BY_INPUT(24);
@@ -498,7 +498,8 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos,
next_info = INVALID;
else {
unsigned int next_offset = BL_BASE(next_table)[2+next_byte-BL_BASE(next_table)[0]];
- next_info = (VALUE)BYTE_LOOKUP_INFO(next_table)[next_offset];
+#define BL_INFO(next_table) ((const struct byte_lookup *const *)(((uintptr_t)tr->word_array) + BYTE_LOOKUP_INFO(next_table)))
+ next_info = (VALUE)BL_INFO(next_table)[next_offset];
}
follow_info:
switch (next_info & 0x1F) {
@@ -514,7 +515,7 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos,
SUSPEND(econv_source_buffer_empty, 5);
}
next_byte = (unsigned char)*in_p++;
- next_table = next_info;
+ next_table = ((uintptr_t)tr->word_array) + next_info;
goto follow_byte;
case ZERObt: /* drop input */
continue;
diff --git a/transcode_data.h b/transcode_data.h
index a40391614c..78f72f890a 100644
--- a/transcode_data.h
+++ b/transcode_data.h
@@ -19,7 +19,7 @@ typedef unsigned char base_element;
typedef uintptr_t BYTE_LOOKUP[2];
#define BYTE_LOOKUP_BASE(bl) (((uintptr_t *)(bl))[0])
-#define BYTE_LOOKUP_INFO(bl) ((const struct byte_lookup *const *)(((uintptr_t *)(bl))[1]))
+#define BYTE_LOOKUP_INFO(bl) (((uintptr_t *)(bl))[1])
#ifndef PType
/* data file needs to treat this as a pointer, to remove warnings */