aboutsummaryrefslogtreecommitdiffstats
path: root/class.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-08 09:52:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-08 09:52:26 +0000
commit5fbfc21b67f4bd68502e186024636f5bf4350f90 (patch)
tree3ff79b074c314852173be275c081b16483b1f3ac /class.c
parentea005c47faf3563b7fc9a3f92525a05e745df033 (diff)
downloadruby-5fbfc21b67f4bd68502e186024636f5bf4350f90.tar.gz
internal.h: allocator function in rb_classext_t
* internal.h (struct rb_classext_struct): move allocator function into rb_classext_t from ordinary method table. [ruby-dev:46121] [Feature #6993] * object.c (rb_obj_alloc): call allocator function directly. * vm_method.c (rb_define_alloc_func, rb_undef_alloc_func) (rb_get_alloc_func): use allocator function in rb_classext_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/class.c b/class.c
index 1d871fb7ee..8d9889ec3b 100644
--- a/class.c
+++ b/class.c
@@ -59,6 +59,7 @@ class_alloc(VALUE flags, VALUE klass)
RCLASS_ORIGIN(obj) = (VALUE)obj;
RCLASS_IV_INDEX_TBL(obj) = 0;
RCLASS_REFINED_CLASS(obj) = Qnil;
+ RCLASS_EXT(obj)->allocator = 0;
return (VALUE)obj;
}
@@ -169,6 +170,7 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);
}
RCLASS_SUPER(clone) = RCLASS_SUPER(orig);
+ RCLASS_EXT(clone)->allocator = RCLASS_EXT(orig)->allocator;
if (RCLASS_IV_TBL(orig)) {
st_data_t id;
@@ -236,6 +238,7 @@ rb_singleton_class_clone(VALUE obj)
}
RCLASS_SUPER(clone) = RCLASS_SUPER(klass);
+ RCLASS_EXT(clone)->allocator = RCLASS_EXT(klass)->allocator;
if (RCLASS_IV_TBL(klass)) {
RCLASS_IV_TBL(clone) = st_copy(RCLASS_IV_TBL(klass));
}
@@ -897,10 +900,6 @@ method_entry_i(st_data_t key, st_data_t value, st_data_t data)
st_table *list = (st_table *)data;
long type;
- if ((ID)key == ID_ALLOCATOR) {
- return ST_CONTINUE;
- }
-
if (!st_lookup(list, key, 0)) {
if (UNDEFINED_METHOD_ENTRY_P(me)) {
type = -1; /* none */