зеркало из https://github.com/github/ruby.git
* class.c (class_alloc): Strat from age == 2.
Class and Module objects can be living long life. * iseq.c: Same for ISeq objects. * gc.c (RVALUE_AGE_RESET): added. * gc.c (newobj_of): allow to generate (age != 0) objects. * gc.c (rb_copy_wb_protected_attribute): reset age for wb unprotected objects. * include/ruby/ruby.h: add RUBY_TYPED_PROMOTED1 as an unrecommended flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
3977132bbb
Коммит
1b6aa03eb9
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
Thu Dec 11 19:06:01 2014 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* class.c (class_alloc): Strat from age == 2.
|
||||
Class and Module objects can be living long life.
|
||||
|
||||
* iseq.c: Same for ISeq objects.
|
||||
|
||||
* gc.c (RVALUE_AGE_RESET): added.
|
||||
|
||||
* gc.c (newobj_of): allow to generate (age != 0) objects.
|
||||
|
||||
* gc.c (rb_copy_wb_protected_attribute): reset age for wb unprotected
|
||||
objects.
|
||||
|
||||
* include/ruby/ruby.h: add RUBY_TYPED_PROMOTED1 as an unrecommended
|
||||
flag.
|
||||
|
||||
Thu Dec 11 05:37:52 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||
|
||||
* lib/prime.rb: Remove useless loop and block capture.
|
||||
|
|
2
class.c
2
class.c
|
@ -150,7 +150,7 @@ rb_class_detach_module_subclasses(VALUE klass)
|
|||
static VALUE
|
||||
class_alloc(VALUE flags, VALUE klass)
|
||||
{
|
||||
NEWOBJ_OF(obj, struct RClass, klass, (flags & T_MASK) | (RGENGC_WB_PROTECTED_CLASS ? FL_WB_PROTECTED : 0));
|
||||
NEWOBJ_OF(obj, struct RClass, klass, (flags & T_MASK) | FL_PROMOTED1 /* start from age == 2 */ | (RGENGC_WB_PROTECTED_CLASS ? FL_WB_PROTECTED : 0));
|
||||
obj->ptr = ALLOC(rb_classext_t);
|
||||
RCLASS_IV_TBL(obj) = 0;
|
||||
RCLASS_CONST_TBL(obj) = 0;
|
||||
|
|
21
gc.c
21
gc.c
|
@ -1151,14 +1151,18 @@ RVALUE_DEMOTE(rb_objspace_t *objspace, VALUE obj)
|
|||
check_rvalue_consistency(obj);
|
||||
}
|
||||
|
||||
static inline void
|
||||
RVALUE_AGE_RESET_RAW(VALUE obj)
|
||||
{
|
||||
RBASIC(obj)->flags = RVALUE_FLAGS_AGE_SET(RBASIC(obj)->flags, 0);
|
||||
}
|
||||
|
||||
static inline void
|
||||
RVALUE_AGE_RESET(VALUE obj)
|
||||
{
|
||||
check_rvalue_consistency(obj);
|
||||
if (RGENGC_CHECK_MODE) assert(!RVALUE_OLD_P(obj));
|
||||
|
||||
RBASIC(obj)->flags = RVALUE_FLAGS_AGE_SET(RBASIC(obj)->flags, 0);
|
||||
|
||||
RVALUE_AGE_RESET_RAW(obj);
|
||||
check_rvalue_consistency(obj);
|
||||
}
|
||||
|
||||
|
@ -1653,7 +1657,13 @@ newobj_of(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3)
|
|||
assert(RVALUE_MARKING(obj) == FALSE);
|
||||
assert(RVALUE_OLD_P(obj) == FALSE);
|
||||
assert(RVALUE_WB_UNPROTECTED(obj) == FALSE);
|
||||
if (RVALUE_AGE(obj) > 0) rb_bug("newobj: %s of age (%d) > 0.", obj_info(obj), RVALUE_AGE(obj));
|
||||
|
||||
if (flags & FL_PROMOTED1) {
|
||||
if (RVALUE_AGE(obj) != 2) rb_bug("newobj: %s of age (%d) != 2.", obj_info(obj), RVALUE_AGE(obj));
|
||||
}
|
||||
else {
|
||||
if (RVALUE_AGE(obj) > 0) rb_bug("newobj: %s of age (%d) > 0.", obj_info(obj), RVALUE_AGE(obj));
|
||||
}
|
||||
if (rgengc_remembered(objspace, (VALUE)obj)) rb_bug("newobj: %s is remembered.", obj_info(obj));
|
||||
#endif
|
||||
|
||||
|
@ -5556,7 +5566,10 @@ rb_copy_wb_protected_attribute(VALUE dest, VALUE obj)
|
|||
#if USE_RGENGC
|
||||
if (RVALUE_WB_UNPROTECTED(obj)) {
|
||||
MARK_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(dest), dest);
|
||||
RVALUE_AGE_RESET_RAW(dest);
|
||||
}
|
||||
|
||||
check_rvalue_consistency(dest);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1019,7 +1019,8 @@ void *rb_check_typeddata(VALUE, const rb_data_type_t *);
|
|||
|
||||
/* bits for rb_data_type_struct::flags */
|
||||
#define RUBY_TYPED_FREE_IMMEDIATELY 1 /* TYPE field */
|
||||
#define RUBY_TYPED_WB_PROTECTED FL_WB_PROTECTED
|
||||
#define RUBY_TYPED_WB_PROTECTED FL_WB_PROTECTED /* THIS FLAG DEPENDS ON Ruby version */
|
||||
#define RUBY_TYPED_PROMOTED1 FL_PROMOTED1 /* THIS FLAG DEPENDS ON Ruby version */
|
||||
|
||||
#define Data_Wrap_Struct(klass,mark,free,sval)\
|
||||
rb_data_object_alloc((klass),(sval),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free))
|
||||
|
|
2
iseq.c
2
iseq.c
|
@ -182,7 +182,7 @@ static const rb_data_type_t iseq_data_type = {
|
|||
iseq_memsize,
|
||||
}, /* functions */
|
||||
0, 0,
|
||||
RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
|
||||
RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_PROMOTED1 /* start from age == 2 */ | RUBY_TYPED_WB_PROTECTED
|
||||
};
|
||||
|
||||
static VALUE
|
||||
|
|
Загрузка…
Ссылка в новой задаче