summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-12 08:43:55 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-12 08:43:55 (GMT)
commitc35ff11ae516421809e0d03c278576a70fda45c4 (patch)
tree990de489356901e7899c3a0f6d08d7e05901f48b /marshal.c
parentce5196b228a1f1599caf7c9f608d1eb7e40272bd (diff)
* id_table.h: introduce ID key table.
[Feature #11420] This table only manage ID->VALUE table to reduce overhead of st. Some functions prefixed rb_id_table_* are provided. * id_table.c: implement rb_id_table_*. There are several algorithms to implement it. Now, there are roughly 4 types: * st * array * hash (implemented by Yura Sokolov) * mix of array and hash The macro ID_TABLE_IMPL can choose implementation. You can see detailes about them at the head of id_table.c. At the default, I choose 34 (mix of list and hash). This is not final decision. Please report your suitable parameters or your data structure. * symbol.c: introduce rb_id_serial_t and rb_id_to_serial() to represent ID by serial number. * internal.h: use id_table for method tables. * class.c, gc.c, marshal.c, vm.c, vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/marshal.c b/marshal.c
index fc33347..24453c1 100644
--- a/marshal.c
+++ b/marshal.c
@@ -17,6 +17,7 @@
#include "ruby/io.h"
#include "ruby/st.h"
#include "ruby/util.h"
+#include "id_table.h"
#include <math.h>
#ifdef HAVE_FLOAT_H
@@ -474,7 +475,7 @@ hash_each(VALUE key, VALUE value, struct dump_call_arg *arg)
}
#define SINGLETON_DUMP_UNABLE_P(klass) \
- (RCLASS_M_TBL(klass)->num_entries || \
+ (rb_id_table_size(RCLASS_M_TBL(klass)) > 0 || \
(RCLASS_IV_TBL(klass) && RCLASS_IV_TBL(klass)->num_entries > 1))
static void