From 9f91f221dd6b035228e5c8320f4c71255d8105d9 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 19 Jul 2007 21:29:34 -0600 Subject: [PATCH] GC stress fix in make() --- makefile | 2 +- src/run.cpp | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/makefile b/makefile index ea327eb334..1994bd5349 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,4 @@ -#MAKEFLAGS = -s +MAKEFLAGS = -s arch = $(shell uname -m) ifeq ($(arch),i586) diff --git a/src/run.cpp b/src/run.cpp index f33d9e8c36..11a685c55a 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -76,19 +76,7 @@ popFrame(Thread* t) } } -void -registerWeakReference(Thread* t, object r) -{ - PROTECT(t, r); - - ACQUIRE(t, t->vm->referenceLock); - - // jreferenceNext(t, r) - cast(r, 3 * BytesPerWord) = t->vm->weakReferences; - t->vm->weakReferences = r; -} - -inline object +object make(Thread* t, object class_) { PROTECT(t, class_); @@ -99,7 +87,13 @@ make(Thread* t, object class_) sizeInBytes - sizeof(object)); if (UNLIKELY(classVmFlags(t, class_) & WeakReferenceFlag)) { - registerWeakReference(t, instance); + PROTECT(t, instance); + + ACQUIRE(t, t->vm->referenceLock); + + // jreferenceNext(t, r) + cast(instance, 3 * BytesPerWord) = t->vm->weakReferences; + t->vm->weakReferences = instance; } return instance;