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
4899 4899
mark_method_entry(rb_objspace_t *objspace, const rb_method_entry_t *me)
4900 4900
{
4901 4901
    const rb_method_definition_t *def = me->def;
4902
    __builtin_prefetch(def);
4902 4903

  
4903 4904
    gc_mark(objspace, me->owner);
4904 4905
    gc_mark(objspace, me->defined_class);
......
5230 5231
gc_mark(rb_objspace_t *objspace, VALUE obj)
5231 5232
{
5232 5233
    if (!is_markable_object(objspace, obj)) return;
5234
    __builtin_prefetch(RBASIC(obj));
5233 5235
    gc_mark_ptr(objspace, obj);
5234 5236
}
5235 5237

  
......
5396 5398
	else {
5397 5399
	    long i, len = RARRAY_LEN(obj);
5398 5400
            const VALUE *ptr = RARRAY_CONST_PTR_TRANSIENT(obj);
5401
	    for (i=0; i < len; i++) {
5402
	      __builtin_prefetch(RBASIC(ptr[i]));
5403
	    }
5399 5404
	    for (i=0; i < len; i++) {
5400 5405
                gc_mark(objspace, ptr[i]);
5401 5406
	    }
......
5437 5442

  
5438 5443
            if (ptr) {
5439 5444
                uint32_t i, len = ROBJECT_NUMIV(obj);
5445
	    for (i=0; i < len; i++) {
5446
	      __builtin_prefetch(RBASIC(ptr[i]));
5447
	    }
5440 5448
                for (i  = 0; i < len; i++) {
5441 5449
                    gc_mark(objspace, ptr[i]);
5442 5450
                }
......
5486 5494
            long i;
5487 5495
            const long len = RSTRUCT_LEN(obj);
5488 5496
            const VALUE * const ptr = RSTRUCT_CONST_PTR(obj);
5489

  
5497
	    for (i=0; i < len; i++) {
5498
	      __builtin_prefetch(RBASIC(ptr[i]));
5499
	    }
5490 5500
            for (i=0; i<len; i++) {
5491 5501
                gc_mark(objspace, ptr[i]);
5492 5502
            }
......
6803 6813
static void
6804 6814
gc_mark_from(rb_objspace_t *objspace, VALUE obj, VALUE parent)
6805 6815
{
6816
    __builtin_prefetch(RBASIC(obj));
6806 6817
    gc_mark_set_parent(objspace, parent);
6807 6818
    rgengc_check_relation(objspace, obj);
6808 6819
    if (gc_mark_set(objspace, obj) == FALSE) return;