cs: check linklet imports when a procedure is expected

This commit is contained in:
Matthew Flatt 2020-08-13 15:52:45 -06:00
parent ab1b164982
commit be6312314b
3 changed files with 411 additions and 394 deletions

View File

@ -859,7 +859,11 @@
(when (eq? (variable-val var) variable-undefined)
(raise-linking-failure "is uninitialized" target-inst inst sym))
(let ([v (if import-abi
(variable-val var)
(let ([v (variable-val var)])
(when (eq? import-abi 'proc)
(unless (#%procedure? v)
(raise-linking-failure "was expected to have a procedure value" target-inst inst sym)))
v)
var)])
(cons v
(extract-imported-variables target-inst inst (cdr syms) (cdr imports-abi) accum)))))]))

File diff suppressed because it is too large Load Diff

View File

@ -172,7 +172,13 @@
(define im-ready? (import-group-lookup-ready? grp))
(for/list ([im (in-list (import-group-imports grp))])
(and im-ready?
(known-constant? (import-group-lookup grp (import-ext-id im))))))
(let ([k (import-group-lookup grp (import-ext-id im))])
(and (known-constant? k)
(if (known-procedure? k)
;; A call to the procedure is probably in unsafe form:
'proc
;; Otherwise, accept any value:
#t))))))
;; Convert internal to external identifiers for known-value info
(for/fold ([knowns (hasheq)]) ([ex-id (in-list ex-ids)])
(define id (ex-int-id ex-id))