declare the closure environment in c99

`max_align_t' is C11 and the union goes into every unit, so a program
with no closure in it stopped building under -std=c99. `unify' also
bound a rigid variable one way round only.
This commit is contained in:
2026-09-30 14:36:07 +03:00
parent 024e97553b
commit f5eee71eb7
5 changed files with 56 additions and 10 deletions

View File

@@ -693,13 +693,19 @@
(define +closure-env-bytes+ 16)
;;; +closure-env-bytes+ for maximum capacity, max-align-t for
;;; effectiveness, hence union
;;; +closure-env-bytes+ for maximum capacity, and an alignment wide
;;; enough for anything that fits in them, hence union. `max_align_t'
;;; would say that in one word, but it is C11 and the target is C99, so
;;; the widest built-ins say it instead: a union is aligned for the
;;; strictest of its members.
(define +closure-env-type+ 'ƛenv)
(define (closure-env-declaration)
`(union ,+closure-env-type+ ((align max-align-t)
(bytes (¤ char ,+closure-env-bytes+)))))
`(union ,+closure-env-type+ ((bytes (¤ char ,+closure-env-bytes+))
(align-integer (long long))
(align-real (long double))
(align-pointer (* void))
(align-code (fn ((* void)) void)))))
(define +closure-structs+ (make-hash-table))
(define +closure-forwards+ (make-hash-table))