From 10ccbc92df1bf9c3feb6f66c7ebfbc36d8630039 Mon Sep 17 00:00:00 2001 From: rtoy <rtoy> Date: Wed, 9 Jun 2004 15:36:49 +0000 Subject: [PATCH] Briefly document weak-pointer object. --- docs/internals/object.tex | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/internals/object.tex b/docs/internals/object.tex index 8e163973d..1922eae5d 100644 --- a/docs/internals/object.tex +++ b/docs/internals/object.tex @@ -734,3 +734,29 @@ A system area pointer data-block has the following format: scheme. We don't currently restrict system pointers to one area of memory, but if they do point onto the heap, it is up to the user to prevent being screwed by GC or whatever. + +\section{Weak Pointers} +\label{sec:weak-pointers} + +A weak-pointer data-block has the following format: +\begin{verbatim} +------------------------------------------------------- +| 4 (data-block words) | Weak pointer Type (8 bits) | +------------------------------------------------------- +| weak-pointer-value | +------------------------------------------------------- +| weak-pointer-broken | +------------------------------------------------------- +| mark-bit (T or NIL) | +------------------------------------------------------- +| next | +------------------------------------------------------- +\end{verbatim} + +The mark-bit is used when gencgc is available. It's used to note if +this weak pointer has been visited before so that scavenging +weak-pointers isn't an $O(n^2)$ process. + +The last slot is an internal slot used by the C runtime to chain all +the weak pointers together for GC. + -- GitLab