From 5fbfc21b67f4bd68502e186024636f5bf4350f90 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 8 Sep 2012 09:52:26 +0000 Subject: 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 --- class.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'class.c') 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 */ -- cgit v1.2.3