path: root/class.c
diff options
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-12 19:26:07 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-12 19:26:07 +0000
commit244916d43b9924f094d268c99df90fd81df68e68 (patch)
tree77f0f61e616de201741292cb653de80aee1c7f67 /class.c
parent8c8f92cd7ae38b7fc54ff136dd1d929509eb8d0d (diff)
resolve class name earlier and more consistently
This further avoids class name resolution issues which came about due to relying on hash table ordering before r53376. Pre-caching the class name when it is never used raises memory use, but the overall gain from moving away from st still gives us a small gain. Reverting r53376 and this patch and testing with "valgrind -v ./ruby -rrdoc -eexit" on x86 (32-bit) shows: before: in use at exit: 1,662,239 bytes in 25,286 blocks total heap usage: 49,514 allocs, 24,228 frees, 6,005,561 bytes allocated after, with this change: in use at exit: 1,646,529 bytes in 24,572 blocks total heap usage: 48,891 allocs, 24,319 frees, 6,003,921 bytes allocated * class.c (Init_class_hierarchy): resolve name for rb_cObject ASAP * object.c (rb_mod_const_set): move name resolution to rb_const_set * variable.c (rb_const_set): do class resolution here [ruby-core:72807] [Bug #11977] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
1 files changed, 4 insertions, 0 deletions
diff --git a/class.c b/class.c
index 5c72a4b..b4eaabc 100644
--- a/class.c
+++ b/class.c
@@ -547,6 +547,10 @@ Init_class_hierarchy(void)
rb_cBasicObject = boot_defclass("BasicObject", 0);
rb_cObject = boot_defclass("Object", rb_cBasicObject);
+ /* resolve class name ASAP for order-independence */
+ rb_class_name(rb_cObject);
rb_cModule = boot_defclass("Module", rb_cObject);
rb_cClass = boot_defclass("Class", rb_cModule);