summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/ice-9/guardians.scm39
-rw-r--r--module/language/cps/compile-bytecode.scm1
-rw-r--r--module/system/base/types.scm2
-rw-r--r--module/system/base/types/internal.scm3
-rw-r--r--module/system/vm/assembler.scm1
5 files changed, 39 insertions, 7 deletions
diff --git a/module/ice-9/guardians.scm b/module/ice-9/guardians.scm
index 34e6537b9..2bc32a9fd 100644
--- a/module/ice-9/guardians.scm
+++ b/module/ice-9/guardians.scm
@@ -89,7 +89,44 @@
(define (make-guardian)
"Create a new guardian. A guardian protects a set of objects from
-garbage collection, allowing a program to apply cleanup or other"
+garbage collection, allowing a program to apply cleanup or other
+actions.
+
+@code{make-guardian} returns a procedure representing the guardian.
+Calling the guardian procedure with an argument adds the argument to
+the guardian's set of protected objects. Calling the guardian
+procedure without an argument returns one of the protected objects
+which are ready for garbage collection, or @code{#f} if no such object
+is available. Objects which are returned in this way are removed from
+the guardian.
+
+You can put a single object into a guardian more than once and you can
+put a single object into more than one guardian. The object will then
+be returned multiple times by the guardian procedures.
+
+An object is eligible to be returned from a guardian when it is no
+longer referenced from outside any guardian.
+
+There is no guarantee about the order in which objects are returned
+from a guardian. If you want to impose an order on finalization
+actions, for example, you can do that by keeping objects alive in some
+global data structure until they are no longer needed for finalizing
+other objects.
+
+Being an element in a weak vector, a key in a hash table with weak
+keys, or a value in a hash table with weak value does not prevent an
+object from being returned by a guardian. But as long as an object
+can be returned from a guardian it will not be removed from such a
+weak vector or hash table. In other words, a weak link does not
+prevent an object from being considered collectable, but being inside
+a guardian prevents a weak link from being broken.
+
+A key in a weak key hash table can be though of as having a strong
+reference to its associated value as long as the key is accessible.
+Consequently, when the key only accessible from within a guardian, the
+reference from the key to the value is also considered to be coming
+from within a guardian. Thus, if there is no other reference to the
+value, it is eligible to be returned from a guardian."
(define-values (push! pop!) (make-atomic-fifo))
(define (guard! obj)
(when (heap-object? obj)
diff --git a/module/language/cps/compile-bytecode.scm b/module/language/cps/compile-bytecode.scm
index 8ff16cfa5..41a359cd3 100644
--- a/module/language/cps/compile-bytecode.scm
+++ b/module/language/cps/compile-bytecode.scm
@@ -505,7 +505,6 @@
(#('vm-continuation? #f (a)) (unary emit-vm-continuation? a))
(#('bytevector? #f (a)) (unary emit-bytevector? a))
(#('thread? #f (a)) (unary emit-thread? a))
- (#('weak-set? #f (a)) (unary emit-weak-set? a))
(#('array? #f (a)) (unary emit-array? a))
(#('bitvector? #f (a)) (unary emit-bitvector? a))
(#('smob? #f (a)) (unary emit-smob? a))
diff --git a/module/system/base/types.scm b/module/system/base/types.scm
index 9347dcc51..5ecdea4cd 100644
--- a/module/system/base/types.scm
+++ b/module/system/base/types.scm
@@ -461,8 +461,6 @@ using BACKEND."
(cell->object source backend)))
(((_ & #x7f = %tc7-vm-continuation))
(inferior-object 'vm-continuation address))
- (((_ & #x7f = %tc7-weak-set))
- (inferior-object 'weak-set address))
(((_ & #x7f = %tc7-array))
(inferior-object 'array address))
(((_ & #x7f = %tc7-bitvector))
diff --git a/module/system/base/types/internal.scm b/module/system/base/types/internal.scm
index a0370eddc..8d7f29088 100644
--- a/module/system/base/types/internal.scm
+++ b/module/system/base/types/internal.scm
@@ -51,7 +51,6 @@
%tc7-vm-continuation
%tc7-bytevector
%tc7-thread
- %tc7-weak-set
%tc7-array
%tc7-bitvector
%tc7-port
@@ -147,7 +146,7 @@
(vm-continuation vm-continuation? #b1111111 #b1000111)
(bytevector bytevector? #b1111111 #b1001101)
(thread thread? #b1111111 #b1001111)
- (weak-set weak-set? #b1111111 #b1010101)
+ ;;(unused unused #b1111111 #b1010101)
;;(unused unused #b1111111 #b1010111)
(array array? #b1111111 #b1011101)
(bitvector bitvector? #b1111111 #b1011111)
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index d931dcd78..d92399b26 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -132,7 +132,6 @@
emit-vm-continuation?
emit-bytevector?
emit-thread?
- emit-weak-set?
emit-array?
emit-bitvector?
emit-ephemeron?