зеркало из https://github.com/github/ruby.git
* gc.c (rgengc_rememberset_mark): change scan algorithm for performance:
from object's pointer base to bitmap one. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6e4cfd9475
Коммит
5d10f35142
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Jun 6 00:52:42 2013 Masaya Tarui <tarui@ruby-lang.org>
|
||||||
|
|
||||||
|
* gc.c (rgengc_rememberset_mark): change scan algorithm for performance:
|
||||||
|
from object's pointer base to bitmap one.
|
||||||
|
|
||||||
Thu Jun 6 00:30:04 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
Thu Jun 6 00:30:04 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* win32/win32.c (NET_LUID): define it on MinGW32.
|
* win32/win32.c (NET_LUID): define it on MinGW32.
|
||||||
|
|
43
gc.c
43
gc.c
|
@ -3591,33 +3591,38 @@ rgengc_remembered(rb_objspace_t *objspace, VALUE obj)
|
||||||
static size_t
|
static size_t
|
||||||
rgengc_rememberset_mark(rb_objspace_t *objspace)
|
rgengc_rememberset_mark(rb_objspace_t *objspace)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i, j;
|
||||||
size_t shady_object_count = 0;
|
size_t shady_object_count = 0;
|
||||||
RVALUE *p, *pend;
|
RVALUE *p, *offset;
|
||||||
uintptr_t *bits;
|
uintptr_t *bits, bitset;
|
||||||
|
|
||||||
for (i=0; i<heaps_used; i++) {
|
for (i=0; i<heaps_used; i++) {
|
||||||
if (0 /* TODO: optimization - skip it if there are no remembered objects */) {
|
p = objspace->heap.sorted[i]->start;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = objspace->heap.sorted[i]->start; pend = p + objspace->heap.sorted[i]->limit;
|
|
||||||
bits = GET_HEAP_REMEMBERSET_BITS(p);
|
bits = GET_HEAP_REMEMBERSET_BITS(p);
|
||||||
|
|
||||||
while (p < pend) {
|
offset = p - NUM_IN_SLOT(p);
|
||||||
if (MARKED_IN_BITMAP(bits, p)) {
|
|
||||||
gc_mark(objspace, (VALUE)p);
|
|
||||||
rgengc_report(2, objspace, "rgengc_rememberset_mark: mark %p (%s)\n", p, obj_type_name((VALUE)p));
|
|
||||||
|
|
||||||
if (RVALUE_SUNNY(p)) {
|
for(j=0;j< HEAP_BITMAP_LIMIT;j++){
|
||||||
rgengc_report(2, objspace, "rgengc_rememberset_mark: clear %p (%s)\n", p, obj_type_name((VALUE)p));
|
if(bits[j]){
|
||||||
CLEAR_IN_BITMAP(bits, p);
|
p = offset + j * (sizeof(uintptr_t) * CHAR_BIT);
|
||||||
}
|
bitset = bits[j];
|
||||||
else {
|
while (bitset) {
|
||||||
shady_object_count++;
|
if (bitset & 1) {
|
||||||
|
gc_mark(objspace, (VALUE)p);
|
||||||
|
rgengc_report(2, objspace, "rgengc_rememberset_mark: mark %p (%s)\n", p, obj_type_name((VALUE)p));
|
||||||
|
|
||||||
|
if (RVALUE_SUNNY(p)) {
|
||||||
|
rgengc_report(2, objspace, "rgengc_rememberset_mark: clear %p (%s)\n", p, obj_type_name((VALUE)p));
|
||||||
|
CLEAR_IN_BITMAP(bits, p);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shady_object_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
bitset>>=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче