From f58c6ef4e88a13c19c306b763577623a532d6b28 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sat, 13 Oct 2007 15:47:45 -0600 Subject: [PATCH] mark destination object array in System.arraycopy() if it resides in the tenured heap --- src/builtin.cpp | 5 +++++ src/machine.h | 11 +++++++++++ 2 files changed, 16 insertions(+) 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) {