Implement finalization.
Also make System.gc no longer a no-op. This replaces some of the
MemberOffsets exposed by Heap with intention-revealing functions
that we'll want to share between all the actual GC implementations,
but there's still more to be done.
Change-Id: I57ba26c0416fbbfe20142b7b6e27108684add7f9
diff --git a/src/mark_sweep.h b/src/mark_sweep.h
index fe37cab..cf099ad 100644
--- a/src/mark_sweep.h
+++ b/src/mark_sweep.h
@@ -49,6 +49,10 @@
// Sweeps unmarked objects to complete the garbage collection.
void Sweep();
+ Object* GetClearedReferences() {
+ return cleared_reference_list_;
+ }
+
private:
// Returns true if the object has its bit set in the mark bitmap.
bool IsMarked(const Object* object) const {
@@ -96,27 +100,10 @@
// Recursively blackens objects on the mark stack.
void ProcessMarkStack();
- // Adds a reference to the tail of a circular queue of references.
- static void EnqueuePendingReference(Object* ref, Object** list);
-
- // Removes the reference at the head of a circular queue of
- // references.
- static Object* DequeuePendingReference(Object** list);
-
- // Sets the referent field of a reference object to null.
- static void ClearReference(Object* reference);
-
- // Returns true if the reference object has not yet been enqueued.
- static bool IsEnqueuable(const Object* ref);
-
- void EnqueueReference(Object* ref);
-
void EnqueueFinalizerReferences(Object** ref);
void PreserveSomeSoftReferences(Object** ref);
- void EnqueueClearedReferences(Object** cleared_references);
-
void ClearWhiteReferences(Object** list);
void ProcessReferences(Object** soft_references, bool clear_soft_references,