diff --git a/src/builtin.cpp b/src/builtin.cpp index 1f6542dcf0..624a1b2c10 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -457,6 +457,11 @@ Java_java_lang_System_arraycopy sbody + (srcOffset * elementSize), length * elementSize); } + + if (classObjectMask(t, objectClass(t, d))) { + mark(t, reinterpret_cast(dbody) + dstOffset, length); + } + return; } } diff --git a/src/machine.h b/src/machine.h index e8a8ecb481..b9b093d15e 100644 --- a/src/machine.h +++ b/src/machine.h @@ -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(targets))) { + ACQUIRE_RAW(t, t->m->heapLock); + for (unsigned i = 0; i < count; ++i) { + t->m->heap->mark(reinterpret_cast(targets + i)); + } + } +} + inline void mark(Thread* t, object& target) {