Project

General

Profile

Feature #5033 ยป gc-mark-optimization.patch

kstephens (Kurt Stephens), 07/16/2011 04:45 PM

View differences:

gc.c
gc_mark(objspace, (VALUE)obj->as.node.u2.node, lev);
}
if (is_pointer_to_heap(objspace, obj->as.node.u3.node)) {
gc_mark(objspace, (VALUE)obj->as.node.u3.node, lev);
ptr = (VALUE)obj->as.node.u3.node; goto again;
}
}
return; /* no need to mark class. */
......
goto again;
}
else {
long i, len = RARRAY_LEN(obj);
VALUE *ptr = RARRAY_PTR(obj);
for (i=0; i < len; i++) {
gc_mark(objspace, *ptr++, lev);
}
long len = RARRAY_LEN(obj);
VALUE *vptr = RARRAY_PTR(obj);
if ( len ) {
while ( -- len ) {
gc_mark(objspace, *vptr++, lev);
}
ptr = *vptr; goto again;
}
}
break;
......
case T_OBJECT:
{
long i, len = ROBJECT_NUMIV(obj);
VALUE *ptr = ROBJECT_IVPTR(obj);
for (i = 0; i < len; i++) {
gc_mark(objspace, *ptr++, lev);
long len = ROBJECT_NUMIV(obj);
VALUE *vptr = ROBJECT_IVPTR(obj);
if ( len ) {
while ( -- len ) {
gc_mark(objspace, *vptr++, lev);
}
ptr = *vptr; goto again;
}
}
break;
......
gc_mark(objspace, obj->as.file.fptr->writeconv_asciicompat, lev);
gc_mark(objspace, obj->as.file.fptr->writeconv_pre_ecopts, lev);
gc_mark(objspace, obj->as.file.fptr->encs.ecopts, lev);
gc_mark(objspace, obj->as.file.fptr->write_lock, lev);
ptr = obj->as.file.fptr->write_lock; goto again;
}
break;
case T_REGEXP:
gc_mark(objspace, obj->as.regexp.src, lev);
ptr = obj->as.regexp.src; goto again;
break;
case T_FLOAT:
......
break;
case T_MATCH:
gc_mark(objspace, obj->as.match.regexp, lev);
if (obj->as.match.str) {
gc_mark(objspace, obj->as.match.regexp, lev);
ptr = obj->as.match.str;
goto again;
}
} else {
ptr = obj->as.match.regexp; goto again;
}
break;
case T_RATIONAL:
gc_mark(objspace, obj->as.rational.num, lev);
gc_mark(objspace, obj->as.rational.den, lev);
ptr = obj->as.rational.den; goto again;
break;
case T_COMPLEX:
gc_mark(objspace, obj->as.complex.real, lev);
gc_mark(objspace, obj->as.complex.imag, lev);
ptr = obj->as.complex.imag; goto again;
break;
case T_STRUCT:
{
long len = RSTRUCT_LEN(obj);
VALUE *ptr = RSTRUCT_PTR(obj);
VALUE *vptr = RSTRUCT_PTR(obj);
while (len--) {
gc_mark(objspace, *ptr++, lev);
}
if ( len ) {
while ( -- len ) {
gc_mark(objspace, *vptr++, lev);
}
ptr = *vptr; goto again;
}
}
break;
    (1-1/1)