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;