@@ -3315,7 +3315,7 @@ f(x) = yt(x)
33153315 (set-car! (lam: vinfo lam) (append (car (lam: vinfo lam)) `((,g Any 2))))
33163316 g))
33173317 ;; evaluate the arguments of a call, creating temporary locations as needed
3318- (define (compile-args lst break-labels)
3318+ (define (compile-args lst break-labels (linearize #t) )
33193319 (if (null? lst) '()
33203320 (let ((temps? (or *very-linear-mode*
33213321 (any (lambda (e)
@@ -3332,9 +3332,9 @@ f(x) = yt(x)
33323332 (if (null? lst)
33333333 (reverse! vals)
33343334 (let* ((arg (car lst))
3335- (aval (compile arg break-labels #t #f)))
3335+ (aval (compile arg break-labels #t #f linearize )))
33363336 (loop (cdr lst)
3337- (cons (if (and temps? (not simple?)
3337+ (cons (if (and temps? linearize (not simple?)
33383338 (not (simple-atom? arg)) (not (ssavalue? arg))
33393339 (not (simple-atom? aval)) (not (ssavalue? aval))
33403340 (not (and (pair? arg)
@@ -3361,7 +3361,7 @@ f(x) = yt(x)
33613361 ;; value must be returned.
33623362 ;; `tail` means we are in tail position, where a value needs to be `return`ed
33633363 ;; from the current function.
3364- (define (compile e break-labels value tail)
3364+ (define (compile e break-labels value tail (linearize-args #t) )
33653365 (if (or (not (pair? e)) (memq (car e) '(null ssavalue quote inert top core copyast the_exception $
33663366 globalref outerref cdecl stdcall fastcall thiscall llvmcall)))
33673367 (let ((e1 (if (and arg-map (symbol? e))
@@ -3386,11 +3386,11 @@ f(x) = yt(x)
33863386 ;; NOTE: 2nd and 3rd arguments of ccall must be left in place
33873387 ;; the 1st should be compiled if an atom.
33883388 (append (list)
3389- (cond (atom? (cadr e) (compile-args (list (cadr e)) break-labels))
3389+ (cond (atom? (cadr e) (compile-args (list (cadr e)) break-labels linearize-args ))
33903390 (else (cadr e)))
33913391 (list-head (cddr e) 2)
3392- (compile-args (list-tail e 4) break-labels))
3393- (compile-args (cdr e) break-labels)))
3392+ (compile-args (list-tail e 4) break-labels linearize-args ))
3393+ (compile-args (cdr e) break-labels linearize-args )))
33943394 (callex (cons (car e) args)))
33953395 (cond (tail (emit-return callex))
33963396 (value callex)
@@ -3602,7 +3602,11 @@ f(x) = yt(x)
36023602 ((composite_type)
36033603 (let* ((para (compile (caddr e) break-labels #t #f))
36043604 (supe (compile (list-ref e 4) break-labels #t #f))
3605- (ftys (compile (list-ref e 5) break-labels #t #f)))
3605+ ;; composite_type has an unconventional evaluation rule that
3606+ ;; needs to do work around the evaluation of the field types,
3607+ ;; so the field type expressions need to be kept in place as
3608+ ;; much as possible. (part of issue #21923)
3609+ (ftys (compile (list-ref e 5) break-labels #t #f #f)))
36063610 (emit `(composite_type ,(cadr e) ,para ,(cadddr e) ,supe ,ftys ,@(list-tail e 6)))))
36073611 (else
36083612 (emit e)))
0 commit comments