diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | bignum.c | 2 | ||||
-rw-r--r-- | internal.h | 1 | ||||
-rw-r--r-- | object.c | 9 |
4 files changed, 18 insertions, 1 deletions
@@ -1,4 +1,9 @@ -Wed Apr 3 16:34:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> +Wed Apr 3 16:35:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * bignum.c (rb_big_eq): hide intermediate Bignums not just freeing + memory. [ruby-core:53893] [Bug #8204] + + * object.c (rb_obj_hide): hide an object by clearing klass. * bignum.c (rb_big_eq): test as Fixnum if possible and get rid of zero length Bignum. [ruby-core:53893] [Bug #8204] @@ -1095,6 +1095,8 @@ big2str_karatsuba(VALUE x, int base, char* ptr, b = power_cache_get_power(base, n1, &m1); bigdivmod(x, b, &q, &r); + rb_obj_hide(q); + rb_obj_hide(r); lh = big2str_karatsuba(q, base, ptr, (len - m1)/2, len - m1, hbase, trim); rb_big_resize(q, 0); diff --git a/internal.h b/internal.h index 6cb6b91589..b19d321086 100644 --- a/internal.h +++ b/internal.h @@ -196,6 +196,7 @@ VALUE rb_int_pred(VALUE num); /* object.c */ VALUE rb_obj_equal(VALUE obj1, VALUE obj2); +VALUE rb_obj_hide(VALUE obj); /* parse.y */ VALUE rb_parser_get_yydebug(VALUE); @@ -43,6 +43,15 @@ static ID id_const_missing; (!SPECIAL_CONST_P(obj) && \ (BUILTIN_TYPE(obj) == T_CLASS || BUILTIN_TYPE(obj) == T_MODULE)) +VALUE +rb_obj_hide(VALUE obj) +{ + if (!SPECIAL_CONST_P(obj)) { + RBASIC(obj)->klass = 0; + } + return obj; +} + /* * call-seq: * obj === other -> true or false |