* bug fix: Type mismatch for the value of conditional expressions are
correctly reported when detected at compile-time, instead of complaining
about a constant NIL (similar for non-EQ-comparable catch tags).
+ * bug fix: Referring to INLINE global functions as values should not result
+ in a compilation failure. (lp#1035721)
* optimization: faster ISQRT on fixnums and small bignums
* optimization: faster and smaller INTEGER-LENGTH on fixnums on x86-64.
* optimization: On x86-64, the number of multi-byte NOP instructions used
(functional
(ir2-convert-closure node block leaf res))
(global-var
- (let ((unsafe (policy node (zerop safety)))
- (name (leaf-source-name leaf)))
- (ecase (global-var-kind leaf)
- ((:special :unknown)
- (aver (symbolp name))
- (let ((name-tn (emit-constant name)))
- (if (or unsafe (info :variable :always-bound name))
- (vop fast-symbol-value node block name-tn res)
- (vop symbol-value node block name-tn res))))
- (:global
- (aver (symbolp name))
- (let ((name-tn (emit-constant name)))
- (if (or unsafe (info :variable :always-bound name))
- (vop fast-symbol-global-value node block name-tn res)
- (vop symbol-global-value node block name-tn res))))
- (:global-function
- (let ((fdefn-tn (make-load-time-constant-tn :fdefinition name)))
- (if unsafe
- (vop fdefn-fun node block fdefn-tn res)
- (vop safe-fdefn-fun node block fdefn-tn res))))))))
+ (ir2-convert-global-var node block leaf res)))
(move-lvar-result node block locs lvar))
(values))
+(defun ir2-convert-global-var (node block leaf res)
+ (let ((unsafe (policy node (zerop safety)))
+ (name (leaf-source-name leaf)))
+ (ecase (global-var-kind leaf)
+ ((:special :unknown)
+ (aver (symbolp name))
+ (let ((name-tn (emit-constant name)))
+ (if (or unsafe (info :variable :always-bound name))
+ (vop fast-symbol-value node block name-tn res)
+ (vop symbol-value node block name-tn res))))
+ (:global
+ (aver (symbolp name))
+ (let ((name-tn (emit-constant name)))
+ (if (or unsafe (info :variable :always-bound name))
+ (vop fast-symbol-global-value node block name-tn res)
+ (vop symbol-global-value node block name-tn res))))
+ (:global-function
+ (let ((fdefn-tn (make-load-time-constant-tn :fdefinition name)))
+ (if unsafe
+ (vop fdefn-fun node block fdefn-tn res)
+ (vop safe-fdefn-fun node block fdefn-tn res)))))))
+
;;; some sanity checks for a CLAMBDA passed to IR2-CONVERT-CLOSURE
(defun assertions-on-ir2-converted-clambda (clambda)
;; This assertion was sort of an experiment. It would be nice and
(physenv-closure (get-lambda-physenv functional)))
(functional
(aver (eq (functional-kind functional) :toplevel-xep))
- nil))))
-
+ nil)))
+ global-var)
(cond (closure
(let* ((physenv (node-physenv ref))
(tn (find-in-physenv functional physenv)))
(emit-move ref ir2-block tn res)))
+ ;; we're about to emit a reference to a "closure" that's actually
+ ;; an inlinable global function.
+ ((and (global-var-p (setf global-var
+ (functional-inline-expanded functional)))
+ (eq :global-function (global-var-kind global-var)))
+ (ir2-convert-global-var ref ir2-block global-var res))
(t
+ ;; if we're here, we should have either a toplevel-xep (some
+ ;; global scope function in a different component) or an external
+ ;; reference to the "closure"'s body.
+ (aver (memq (functional-kind functional) '(:external :toplevel-xep)))
(let ((entry (make-load-time-constant-tn :entry functional)))
(emit-move ref ir2-block entry res)))))
(values))