From 4c8f3933f59ca21346a16c014519ce144c9f43c9 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 17 Jul 2014 17:53:36 -0600 Subject: [PATCH] fix order of operations regression in referenceTargetUnreachable We need to dereference the GcJreference** before we change what it points to. The code was mistakenly reordered in the recent type refactoring. --- src/machine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/machine.cpp b/src/machine.cpp index 519d7ff01f..6ebb966748 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -409,11 +409,11 @@ void referenceTargetUnreachable(Thread* t, Heap::Visitor* v, GcJreference** p) (*p)->target() = 0; if (objectClass(t, *p) == type(t, GcCleaner::Type)) { - *p = cast(t, (*p)->vmNext()); - // In openjdk, sun/misc/Cleaner extends PhantomReference GcCleaner* cleaner = (*p)->as(t); + *p = cast(t, (*p)->vmNext()); + cleaner->setQueueNext(t, roots(t)->objectsToClean()); roots(t)->setObjectsToClean(t, cleaner); } else {