Project

General

Profile

Feature #16648 ยป 0001-gc-prefech-objects-seems-to-improve-full-GC-performa.patch

bpowers (Bobby Powers), 02/22/2020 05:53 PM

View differences:

gc.c
mark_method_entry(rb_objspace_t *objspace, const rb_method_entry_t *me)
{
const rb_method_definition_t *def = me->def;
__builtin_prefetch(def);
gc_mark(objspace, me->owner);
gc_mark(objspace, me->defined_class);
......
gc_mark(rb_objspace_t *objspace, VALUE obj)
{
if (!is_markable_object(objspace, obj)) return;
__builtin_prefetch(RBASIC(obj));
gc_mark_ptr(objspace, obj);
}
......
else {
long i, len = RARRAY_LEN(obj);
const VALUE *ptr = RARRAY_CONST_PTR_TRANSIENT(obj);
for (i=0; i < len; i++) {
__builtin_prefetch(RBASIC(ptr[i]));
}
for (i=0; i < len; i++) {
gc_mark(objspace, ptr[i]);
}
......
if (ptr) {
uint32_t i, len = ROBJECT_NUMIV(obj);
for (i=0; i < len; i++) {
__builtin_prefetch(RBASIC(ptr[i]));
}
for (i = 0; i < len; i++) {
gc_mark(objspace, ptr[i]);
}
......
long i;
const long len = RSTRUCT_LEN(obj);
const VALUE * const ptr = RSTRUCT_CONST_PTR(obj);
for (i=0; i < len; i++) {
__builtin_prefetch(RBASIC(ptr[i]));
}
for (i=0; i<len; i++) {
gc_mark(objspace, ptr[i]);
}
......
static void
gc_mark_from(rb_objspace_t *objspace, VALUE obj, VALUE parent)
{
__builtin_prefetch(RBASIC(obj));
gc_mark_set_parent(objspace, parent);
rgengc_check_relation(objspace, obj);
if (gc_mark_set(objspace, obj) == FALSE) return;
    (1-1/1)