Commit 892e2101 authored by Marius Gerbershagen's avatar Marius Gerbershagen

cmp: make behaviour of declaim inline more sensible

    ECL needs the definition of a function to inline it. Previously,
    this definition would only be saved in the file local environment
    (*cmp-env-root*) but not in the global environment used by
    proclaim. Hence, ECL could only inline functions in the same file.
    Now, we also put the definition of inline functions in the global
    environment during load time. This leads to a behaviour of declaim
    for inline functions, which is consistent with other declarations
    (meaning that the declarations stay only in force during
    compilation, but are proclaimed again at load time of the compiled
    file).
    Fixes #451.
parent 8812ba21
......@@ -159,10 +159,12 @@
(defun inline-possible (fname &optional (env *cmp-env*))
(not (declared-notinline-p fname env)))
;;; Install inline expansion of function. If the function is DECLAIMED
;;; inline, then we only keep the definition in the compiler environment.
;;; If the function is PROCLAIMED inline, then we also keep a copy as
;;; a symbol property.
;;; Install inline expansion of function. If the function is
;;; PROCLAIMED inline, then we keep a copy of the definition as a
;;; symbol property. If the function is DECLAIMED inline, then we keep
;;; the definition in the compiler environment during compilation and
;;; install it as a symbol property during loading of the compiled
;;; file.
(defun maybe-install-inline-function (fname form env)
(let* ((x (cmp-env-search-declaration 'inline env))
(flag (assoc fname x :test #'same-fname-p))
......@@ -170,8 +172,11 @@
(proclaimed (sys:get-sysprop fname 'inline)))
`(progn
,(when declared
`(eval-when (:compile-toplevel)
(c::declare-inline ',fname *cmp-env-root* ',form)))
`(progn
(eval-when (:compile-toplevel)
(c::declare-inline ',fname *cmp-env-root* ',form))
(eval-when (:load-toplevel :execute)
(si:put-sysprop ',fname 'inline ',form))))
,(when proclaimed
`(eval-when (:compile-toplevel :load-toplevel :execute)
(si:put-sysprop ',fname 'inline ',form))))))
......
......@@ -87,7 +87,7 @@
((consp x)
(destructuring-bind (c-name lisp-name) x
(if (si::mangle-name lisp-name)
(warn "The funciton ~s is already in the runtime.~%C-EXPORT-FNAME declaration ignored." lisp-name)
(warn "The function ~s is already in the runtime.~%C-EXPORT-FNAME declaration ignored." lisp-name)
(si:put-sysprop lisp-name 'Lfun c-name))))
(t
(error "Syntax error in proclamation ~s" decl)))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment