From bdaeb6afaa01b873cc13915fe8c9b3c286bc7806 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 20 Jan 2020 09:22:04 -0700 Subject: [PATCH] fix missing continuation call in `cp-push-mvrs` original commit: 2758eb1848fbc21f7f6af718d952547132b265a0 --- LOG | 4 ++++ mats/3.ms | 18 ++++++++++++++++++ s/cpnanopass.ss | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/LOG b/LOG index 19352da7ba..05adccc518 100644 --- a/LOG +++ b/LOG @@ -1769,3 +1769,7 @@ is enabled, so local transformer code can be profiled. syntax.ss, profile.ms +- fix compiler bug related to call-with-values and a first argument + whose body result is compiled to an allocation, inline form, or + foreign call + cpnanopass.ss, 3.ms diff --git a/mats/3.ms b/mats/3.ms index 2410d66d9e..8658669d50 100644 --- a/mats/3.ms +++ b/mats/3.ms @@ -2069,6 +2069,24 @@ (lambda l (equal? l '((7))))) #t #f) + + ; regression test for handling mvcall with inline form + (equal? + '(result x) + (let ([bx (box #f)]) + (define-record-type thing + (fields pos) + (nongenerative #{thing hlg584lmg5htbdauw7dkid2sh-0})) + (set-box! bx (make-thing 'x)) + (let ([posx (unbox bx)]) + (cons 'result + (call-with-values + (lambda () + (if (thing? posx) + ;; compiled as inline load: + (thing-pos posx) + (do-something-else))) + list))))) ) (mat let-values diff --git a/s/cpnanopass.ss b/s/cpnanopass.ss index f5d064e3ec..f9395b1c21 100644 --- a/s/cpnanopass.ss +++ b/s/cpnanopass.ss @@ -9738,7 +9738,7 @@ (let ([tmp (make-tmp 't)]) `(seq (set! ,tmp ,rhs) - (mvcall ,(make-info-call (info-call-src info) (info-call-sexpr info) #f #f #f) #f ,consumer ,tmp ())))] + ,(k `(mvcall ,(make-info-call (info-call-src info) (info-call-sexpr info) #f #f #f) #f ,consumer ,tmp ()))))] [else ; set! & mvset `(seq ,e ,(k `(mvcall ,(make-info-call (info-call-src info) (info-call-sexpr info) #f #f #f) #f ,consumer ,(%constant svoid) ())))]))))) (CaseLambdaClause : CaseLambdaClause (ir) -> CaseLambdaClause ()