mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c (rb_gc_writebarrier): give up rescan A and register B directly
if A has huge number of children. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d7ebd9e641
commit
88927b04ae
2 changed files with 21 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Jun 20 07:46:48 2013 Masaya Tarui <tarui@ruby-lang.org>
|
||||||
|
|
||||||
|
* gc.c (rb_gc_writebarrier): give up rescan A and register B directly
|
||||||
|
if A has huge number of children.
|
||||||
|
|
||||||
Thu Jun 20 07:30:35 2013 Koichi Sasada <ko1@atdot.net>
|
Thu Jun 20 07:30:35 2013 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* common.mk: add new rules `gcbench-rdoc', `gcbench-hash'.
|
* common.mk: add new rules `gcbench-rdoc', `gcbench-hash'.
|
||||||
|
|
13
gc.c
13
gc.c
|
@ -3786,6 +3786,7 @@ void
|
||||||
rb_gc_writebarrier(VALUE a, VALUE b)
|
rb_gc_writebarrier(VALUE a, VALUE b)
|
||||||
{
|
{
|
||||||
rb_objspace_t *objspace = &rb_objspace;
|
rb_objspace_t *objspace = &rb_objspace;
|
||||||
|
int type;
|
||||||
|
|
||||||
if (RGENGC_CHECK_MODE) {
|
if (RGENGC_CHECK_MODE) {
|
||||||
if (!RVALUE_PROMOTED(a)) rb_bug("rb_gc_wb: referer object %p (%s) is not promoted.\n", (void *)a, obj_type_name(a));
|
if (!RVALUE_PROMOTED(a)) rb_bug("rb_gc_wb: referer object %p (%s) is not promoted.\n", (void *)a, obj_type_name(a));
|
||||||
|
@ -3793,11 +3794,23 @@ rb_gc_writebarrier(VALUE a, VALUE b)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rgengc_remembered(objspace, a)) {
|
if (!rgengc_remembered(objspace, a)) {
|
||||||
|
type = BUILTIN_TYPE(a);
|
||||||
|
/* TODO: 2 << 16 is just a magic number. */
|
||||||
|
if ((type == T_ARRAY && RARRAY_LEN(a) >= 2 << 16) ||
|
||||||
|
(type == T_HASH && RHASH_SIZE(a) >= 2 << 16)) {
|
||||||
|
if (!rgengc_remembered(objspace, b)) {
|
||||||
|
rgengc_report(2, objspace, "rb_gc_wb: %p (%s) -> %p (%s)\n",
|
||||||
|
(void *)a, obj_type_name(a), (void *)b, obj_type_name(b));
|
||||||
|
rgengc_remember(objspace, b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
rgengc_report(2, objspace, "rb_gc_wb: %p (%s) -> %p (%s)\n",
|
rgengc_report(2, objspace, "rb_gc_wb: %p (%s) -> %p (%s)\n",
|
||||||
(void *)a, obj_type_name(a), (void *)b, obj_type_name(b));
|
(void *)a, obj_type_name(a), (void *)b, obj_type_name(b));
|
||||||
rgengc_remember(objspace, a);
|
rgengc_remember(objspace, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_gc_giveup_promoted_writebarrier(VALUE obj)
|
rb_gc_giveup_promoted_writebarrier(VALUE obj)
|
||||||
|
|
Loading…
Reference in a new issue