From 3475f9cdb47a6d6f8ad2ce49bbc3af46bca92f09 Mon Sep 17 00:00:00 2001 From: Carl Shapiro Date: Mon, 21 Mar 2011 13:35:24 -0700 Subject: Move finalization out of the VM. This change introduces a new reference class whose referent points to instances requiring finalization. This makes the finalization of objects possible using a reference queue and a dedicated thread which removes objects from the queue. Change-Id: I0ff6dd272f00ca08c6ed3aa667bf766a039a944e --- vm/alloc/HeapInternal.h | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) (limited to 'vm/alloc/HeapInternal.h') diff --git a/vm/alloc/HeapInternal.h b/vm/alloc/HeapInternal.h index d10a41708..7f8c9c5e3 100644 --- a/vm/alloc/HeapInternal.h +++ b/vm/alloc/HeapInternal.h @@ -29,37 +29,15 @@ typedef struct HeapSource HeapSource; struct GcHeap { HeapSource *heapSource; - /* List of heap objects that will require finalization when - * collected. I.e., instance objects - * - * a) whose class definitions override java.lang.Object.finalize() - * - * *** AND *** - * - * b) that have never been finalized. - * - * Note that this does not exclude non-garbage objects; this - * is not the list of pending finalizations, but of objects that - * potentially have finalization in their futures. - */ - LargeHeapRefTable *finalizableRefs; - - /* The list of objects that need to have finalize() called - * on themselves. These references are part of the root set. - * - * This table is protected by gDvm.heapWorkerListLock, which must - * be acquired after the heap lock. - */ - LargeHeapRefTable *pendingFinalizationRefs; - /* Linked lists of subclass instances of java/lang/ref/Reference * that we find while recursing. The "next" pointers are hidden * in the objects' int Reference.vmData fields. * These lists are cleared and rebuilt each time the GC runs. */ - Object *softReferences; - Object *weakReferences; - Object *phantomReferences; + Object *softReferences; + Object *weakReferences; + Object *finalizerReferences; + Object *phantomReferences; /* The list of Reference objects that need to be cleared and/or * enqueued. The bottom two bits of the object pointers indicate -- cgit v1.2.3