GC stress fix in make()

This commit is contained in:
Joel Dice 2007-07-19 21:29:34 -06:00
parent de9213ce30
commit 9f91f221dd
2 changed files with 9 additions and 15 deletions

View File

@ -1,4 +1,4 @@
#MAKEFLAGS = -s MAKEFLAGS = -s
arch = $(shell uname -m) arch = $(shell uname -m)
ifeq ($(arch),i586) ifeq ($(arch),i586)

View File

@ -76,19 +76,7 @@ popFrame(Thread* t)
} }
} }
void object
registerWeakReference(Thread* t, object r)
{
PROTECT(t, r);
ACQUIRE(t, t->vm->referenceLock);
// jreferenceNext(t, r)
cast<object>(r, 3 * BytesPerWord) = t->vm->weakReferences;
t->vm->weakReferences = r;
}
inline object
make(Thread* t, object class_) make(Thread* t, object class_)
{ {
PROTECT(t, class_); PROTECT(t, class_);
@ -99,7 +87,13 @@ make(Thread* t, object class_)
sizeInBytes - sizeof(object)); sizeInBytes - sizeof(object));
if (UNLIKELY(classVmFlags(t, class_) & WeakReferenceFlag)) { if (UNLIKELY(classVmFlags(t, class_) & WeakReferenceFlag)) {
registerWeakReference(t, instance); PROTECT(t, instance);
ACQUIRE(t, t->vm->referenceLock);
// jreferenceNext(t, r)
cast<object>(instance, 3 * BytesPerWord) = t->vm->weakReferences;
t->vm->weakReferences = instance;
} }
return instance; return instance;