diff --git a/collects/compiler/zo-marshal.rkt b/collects/compiler/zo-marshal.rkt index 78559d05d5..91380a3e51 100644 --- a/collects/compiler/zo-marshal.rkt +++ b/collects/compiler/zo-marshal.rkt @@ -1002,8 +1002,9 @@ [l (if any-refs? (cons (vector-length closure-map) l) l)] - [tl-map (for/fold ([v 0]) ([i (in-set toplevel-map)]) - (bitwise-ior v (arithmetic-shift 1 i)))]) + [tl-map (and toplevel-map + (for/fold ([v 0]) ([i (in-set toplevel-map)]) + (bitwise-ior v (arithmetic-shift 1 i))))]) (out-marshaled unclosed-procedure-type-num (list* (+ (if rest? CLOS_HAS_REST 0) @@ -1014,13 +1015,14 @@ (if (memq 'single-result flags) CLOS_SINGLE_RESULT 0)) num-all-params max-let-depth - (if (tl-map . < . #x7FFFFFFF) - tl-map - ;; Encode as an even-sized vector of 16-bit integers: - (let ([len (* 2 (quotient (+ (integer-length tl-map) 31) 32))]) - (for/vector ([i (in-range len)]) - (let ([s (* i 16)]) - (bitwise-bit-field tl-map s (+ s 16)))))) + (and tl-map + (if (tl-map . < . #x7FFFFFFF) + tl-map + ;; Encode as an even-sized vector of 16-bit integers: + (let ([len (* 2 (quotient (+ (integer-length tl-map) 31) 32))]) + (for/vector ([i (in-range len)]) + (let ([s (* i 16)]) + (bitwise-bit-field tl-map s (+ s 16))))))) name l) out))])) diff --git a/collects/tests/compiler/zo-exs.rkt b/collects/tests/compiler/zo-exs.rkt index 2abdaab4ff..c395604236 100644 --- a/collects/tests/compiler/zo-exs.rkt +++ b/collects/tests/compiler/zo-exs.rkt @@ -31,6 +31,15 @@ (prefix 0 empty empty) (list 1 (list 2 3) (list 2 3) 4 5))) + (roundtrip + (compilation-top 0 + (prefix 1 empty empty) + (list (lam 'proc null 0 null #f #(0) '(val/ref) (set 0) 3 1)))) + (roundtrip + (compilation-top 0 + (prefix 1 empty empty) + (list (lam 'proc null 0 null #f #(0) '(val/ref) #f 3 1)))) + #;(roundtrip (compilation-top 0 (prefix 0 empty empty)