Skip to content

Commit 6f85011

Browse files
committed
Fix number of values being broken by unwind-protect cleanup
The new direct values code neglected to reset the number of values in the thread-local values, so whatever a cleanup did would be kept in the event of a nonlocal exit. Reproducer: (defun reproduce (cleanup) (block done (multiple-value-bind (body status headers) (values :body 200 :headers) (unwind-protect (return-from done (values-list (list body status headers :uri nil))) (funcall cleanup))))) (loop for cleanup in (list (lambda () (values)) (lambda () (values :one)) (lambda () (values :one :two))) collect (multiple-value-list (reproduce cleanup))) should return (:body 200 :headers) three times, did return () (:body) (:body 200) as per the cleanup values. This is all in native code obviously.
1 parent 75f77bb commit 6f85011

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎src/lisp/kernel/cleavir/ir.lisp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ And convert everything to JIT constants."
221221
(%i1 0))))
222222

223223
(defun load-all-values (nret storage)
224+
(cmp::set-thread-nvalues nret)
224225
(%intrinsic-call "llvm.memcpy.p0.p0.i64"
225226
(list (cmp::thread-return-values) storage
226227
(cmp::irc-shl nret 3 :nuw t)

0 commit comments

Comments
 (0)