Update of /cvsroot/sbcl/sbcl/src/code
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv31199/src/code
Modified Files:
hash-table.lisp target-hash-table.lisp
Log Message:
1.0.11.12: MAPHASH and WITH-HASH-TABLE documentation
* paraphrase the hash-table traversal/side-effect rule
Index: hash-table.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/hash-table.lisp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- hash-table.lisp 30 Sep 2007 23:18:50 -0000 1.15
+++ hash-table.lisp 6 Nov 2007 14:21:50 -0000 1.16
@@ -95,11 +95,16 @@
#!+sb-doc
"WITH-HASH-TABLE-ITERATOR ((function hash-table) &body body)
-Provides a method of manually looping over the elements of a hash-table.
-FUNCTION is bound to a generator-macro that, within the scope of the
-invocation, returns one or three values. The first value tells whether any
-objects remain in the hash table. When the first value is non-NIL, the second
-and third values are the key and the value of the next object."
+Provides a method of manually looping over the elements of a
+hash-table. FUNCTION is bound to a generator-macro that, within the
+scope of the invocation, returns one or three values. The first value
+tells whether any objects remain in the hash table. When the first
+value is non-NIL, the second and third values are the key and the
+value of the next object.
+
+Consequences are undefined if HASH-TABLE is mutated during execution
+of BODY, except for changing or removing elements corresponding to the
+current key."
;; This essentially duplicates MAPHASH, so any changes here should
;; be reflected there as well.
(let ((n-function (gensym "WITH-HASH-TABLE-ITERATOR-")))
Index: target-hash-table.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/target-hash-table.lisp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- target-hash-table.lisp 6 Nov 2007 13:43:25 -0000 1.41
+++ target-hash-table.lisp 6 Nov 2007 14:21:51 -0000 1.42
@@ -840,8 +840,12 @@
(declaim (inline maphash))
(defun maphash (function-designator hash-table)
#!+sb-doc
- "For each entry in HASH-TABLE, call the designated two-argument function on
-the key and value of the entry. Return NIL."
+ "For each entry in HASH-TABLE, call the designated two-argument
+function on the key and value of the entry. Return NIL.
+
+Consequences are undefined if HASH-TABLE is mutated during the call to
+MAPHASH, except for changing or removing elements corresponding to the
+current key."
;; This essentially duplicates WITH-HASH-TABLE-ITERATOR, so
;; any changes here should be reflected there as well.
(let ((fun (%coerce-callable-to-fun function-designator))

Update of /cvsroot/sbcl/sbcl/src/compiler/x86
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv29591/src/compiler/x86
Modified Files:
macros.lisp
Log Message:
1.0.11.11: expand zero-object WITH-PINNED-OBJECTS to a PROGN
* x86 and x86-64 only.
Index: macros.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/compiler/x86/macros.lisp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- macros.lisp 28 Jun 2007 13:04:59 -0000 1.48
+++ macros.lisp 6 Nov 2007 14:17:40 -0000 1.49
@@ -550,22 +550,24 @@
;;; helper for alien stuff.
(def!macro with-pinned-objects ((&rest objects) &body body)
"Arrange with the garbage collector that the pages occupied by
-OBJECTS will not be moved in memory for the duration of BODY.
-Useful for e.g. foreign calls where another thread may trigger
-garbage collection"
- `(multiple-value-prog1
- (progn
- ,@(loop for p in objects
- collect
- ;; There is no race here wrt to gc, because at every
- ;; point during the execution there is a reference to
- ;; P on the stack or in a register.
- `(push-word-on-c-stack
- (int-sap (sb!kernel:get-lisp-obj-address ,p))))
- ,@body)
- ;; If the body returned normally, we should restore the stack pointer
- ;; for the benefit of any following code in the same function. If
- ;; there's a non-local exit in the body, sp is garbage anyway and
- ;; will get set appropriately from {a, the} frame pointer before it's
- ;; next needed
- (pop-words-from-c-stack ,(length objects))))
+OBJECTS will not be moved in memory for the duration of BODY. Useful
+for e.g. foreign calls where another thread may trigger garbage
+collection"
+ (if objects
+ `(multiple-value-prog1
+ (progn
+ ,@(loop for p in objects
+ collect
+ ;; There is no race here wrt to gc, because at every
+ ;; point during the execution there is a reference to
+ ;; P on the stack or in a register.
+ `(push-word-on-c-stack
+ (int-sap (sb!kernel:get-lisp-obj-address ,p))))
+ ,@body)
+ ;; If the body returned normally, we should restore the stack pointer
+ ;; for the benefit of any following code in the same function. If
+ ;; there's a non-local exit in the body, sp is garbage anyway and
+ ;; will get set appropriately from {a, the} frame pointer before it's
+ ;; next needed
+ (pop-words-from-c-stack ,(length objects)))
+ `(progn ,@body)))