- (cond
- ((zerop num)
- (move null-tn result))
- ((and star (= num 1))
- (move (tn-ref-tn things) result))
- (t
- (macrolet
- ((maybe-load (tn)
- (once-only ((tn tn))
- `(sc-case ,tn
- ((any-reg descriptor-reg zero null)
- ,tn)
- (control-stack
- (load-stack-tn temp ,tn)
- temp)))))
- (let* ((cons-cells (if star (1- num) num))
- (alloc (* (pad-data-block cons-size) cons-cells)))
- (pseudo-atomic (:extra alloc)
- (move alloc-tn res)
- (inst dep list-pointer-lowtag 31 3 res)
- (move res ptr)
- (dotimes (i (1- cons-cells))
- (storew (maybe-load (tn-ref-tn things)) ptr
- cons-car-slot list-pointer-lowtag)
- (setf things (tn-ref-across things))
- (inst addi (pad-data-block cons-size) ptr ptr)
- (storew ptr ptr
- (- cons-cdr-slot cons-size)
- list-pointer-lowtag))
- (storew (maybe-load (tn-ref-tn things)) ptr
- cons-car-slot list-pointer-lowtag)
- (storew (if star
- (maybe-load (tn-ref-tn (tn-ref-across things)))
- null-tn)
- ptr cons-cdr-slot list-pointer-lowtag))
- (move res result)))))))
-
+ (cond ((zerop num)
+ (move null-tn result))
+ ((and star (= num 1))
+ (move (tn-ref-tn things) result))
+ (t
+ (macrolet
+ ((store-car (tn list &optional (slot cons-car-slot))
+ `(let ((reg (sc-case ,tn
+ ((any-reg descriptor-reg zero null) ,tn)
+ (control-stack
+ (load-stack-tn temp ,tn)
+ temp))))
+ (storew reg ,list ,slot list-pointer-lowtag))))
+ (let* ((dx-p (node-stack-allocate-p node))
+ (cons-cells (if star (1- num) num))
+ (alloc (* (pad-data-block cons-size) cons-cells)))
+ (pseudo-atomic (:extra (if dx-p 0 alloc))
+ (when dx-p
+ (align-csp res))
+ (set-lowtag list-pointer-lowtag (if dx-p csp-tn alloc-tn) res)
+ (when dx-p
+ (inst addi alloc csp-tn csp-tn))
+ (move res ptr)
+ (dotimes (i (1- cons-cells))
+ (store-car (tn-ref-tn things) ptr)
+ (setf things (tn-ref-across things))
+ (inst addi (pad-data-block cons-size) ptr ptr)
+ (storew ptr ptr
+ (- cons-cdr-slot cons-size)
+ list-pointer-lowtag))
+ (store-car (tn-ref-tn things) ptr)
+ (cond (star
+ (setf things (tn-ref-across things))
+ (store-car (tn-ref-tn things) ptr cons-cdr-slot))
+ (t
+ (storew null-tn ptr
+ cons-cdr-slot list-pointer-lowtag)))
+ (aver (null (tn-ref-across things)))
+ (move res result))))))))