mark destination object array in System.arraycopy() if it resides in the tenured heap

This commit is contained in:
Joel Dice 2007-10-13 15:47:45 -06:00
parent 64313aa243
commit f58c6ef4e8
2 changed files with 16 additions and 0 deletions

View File

@ -457,6 +457,11 @@ Java_java_lang_System_arraycopy
sbody + (srcOffset * elementSize),
length * elementSize);
}
if (classObjectMask(t, objectClass(t, d))) {
mark(t, reinterpret_cast<object*>(dbody) + dstOffset, length);
}
return;
}
}

View File

@ -1417,6 +1417,17 @@ allocate(Thread* t, unsigned sizeInBytes)
}
}
inline void
mark(Thread* t, object* targets, unsigned count)
{
if (t->m->heap->needsMark(reinterpret_cast<void**>(targets))) {
ACQUIRE_RAW(t, t->m->heapLock);
for (unsigned i = 0; i < count; ++i) {
t->m->heap->mark(reinterpret_cast<void**>(targets + i));
}
}
}
inline void
mark(Thread* t, object& target)
{