Project

General

Profile

Feature #12364 ยป 0001-Copy-the-serial-number-from-the-super-class-to-the-s.patch

tenderlovemaking (Aaron Patterson), 05/10/2016 12:33 AM

View differences:

benchmark/bm_vm2_poly_singleton.rb
class C1
def m; 1; end
end
o1 = C1.new
o2 = C1.new
o2.singleton_class
i = 0
while i<6_000_000 # benchmark loop 2
o = (i % 2 == 0) ? o1 : o2
o.m; o.m; o.m; o.m; o.m; o.m; o.m; o.m
i += 1
end
class.c
klass = RBASIC(obj)->klass;
if (!(FL_TEST(klass, FL_SINGLETON) &&
rb_ivar_get(klass, id_attached) == obj)) {
rb_serial_t serial = RCLASS_SERIAL(klass);
klass = rb_make_metaclass(obj, klass);
RCLASS_SERIAL(klass) = serial;
}
if (OBJ_TAINTED(obj)) {
    (1-1/1)