diff --git a/racket/src/ChezScheme/mats/4.ms b/racket/src/ChezScheme/mats/4.ms index a5a9f7d710..091fb925c1 100644 --- a/racket/src/ChezScheme/mats/4.ms +++ b/racket/src/ChezScheme/mats/4.ms @@ -4822,6 +4822,30 @@ ;; Check that the GC update the reference to `key2` in `e`: (eq? (car e) key2))))))) + ;; ---------------------------------------- + ;; Check GC interaction with zero-sized contnuations - unlikely + ;; to crash even if things are wrong, but it's worth a try + + (let () + (define (loop i) + (if (zero? i) + (call/cc (lambda (k) (k '()))) + (let ([keeps (loop (sub1 i))]) + (call/cc + (lambda (k) + (cons k keeps)))))) + + (with-interrupts-disabled + (collect 0) + (let ([keeps (filter (lambda (c) + (eqv? 0 (#%$continuation-stack-clength c))) + (loop 1000))]) + ;; The `keeps` list is probably non-empty + (collect 0 0) + (collect 0 0) + (keep-live keeps) + #t))) + ;; ---------------------------------------- ;; Check fasl: (let ([s (gensym)]) diff --git a/racket/src/ChezScheme/s/cpnanopass.ss b/racket/src/ChezScheme/s/cpnanopass.ss index 7e5627062e..51d4cab734 100644 --- a/racket/src/ChezScheme/s/cpnanopass.ss +++ b/racket/src/ChezScheme/s/cpnanopass.ss @@ -12962,6 +12962,8 @@ ,(if 1-shot? `(immediate ,(constant opportunistic-1-shot-flag)) %ac0)) + ;; NB: clength will be 0 if we're reifying to hide a continuation link + ;; where the attachments field is #f. Make sure the GC is ok with that. (set! ,(%mref ,%xp ,(constant continuation-stack-clength-disp)) ,%ac0) (set! ,(%tc-ref scheme-stack-size) ,(%inline - ,(%tc-ref scheme-stack-size) ,%ac0)) ,(finish %xp)))]