Merge pull request #300 from dicej/order-of-operations

fix order of operations regression in referenceTargetUnreachable
This commit is contained in:
Joshua Warner 2014-07-17 19:29:52 -06:00
commit 1a0ccb1df8

View File

@ -409,11 +409,11 @@ void referenceTargetUnreachable(Thread* t, Heap::Visitor* v, GcJreference** p)
(*p)->target() = 0; (*p)->target() = 0;
if (objectClass(t, *p) == type(t, GcCleaner::Type)) { if (objectClass(t, *p) == type(t, GcCleaner::Type)) {
*p = cast<GcJreference>(t, (*p)->vmNext());
// In openjdk, sun/misc/Cleaner extends PhantomReference // In openjdk, sun/misc/Cleaner extends PhantomReference
GcCleaner* cleaner = (*p)->as<GcCleaner>(t); GcCleaner* cleaner = (*p)->as<GcCleaner>(t);
*p = cast<GcJreference>(t, (*p)->vmNext());
cleaner->setQueueNext(t, roots(t)->objectsToClean()); cleaner->setQueueNext(t, roots(t)->objectsToClean());
roots(t)->setObjectsToClean(t, cleaner); roots(t)->setObjectsToClean(t, cleaner);
} else { } else {