x86-64: Treat more symbols as having immediate storage class
[sbcl.git] / src / compiler / early-constantp.lisp
blob8f2c17d59a399ccd16975a37301da1c377c2bcca
1 ;;;; inline wrappers on CONSTANTP stuff
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
12 (in-package "SB!C")
14 ;;; Subtypes of this show up as the environment argument to inquiry functions.
15 (defstruct (abstract-lexenv
16 (:constructor nil) (:copier nil) (:predicate nil)))
18 #!-sb-fluid (declaim (inline sb!xc:constantp))
19 (defun sb!xc:constantp (form &optional (environment nil envp))
20 "True of any FORM that has a constant value: self-evaluating objects,
21 keywords, defined constants, quote forms. Additionally the
22 constant-foldability of some function calls special forms is recognized. If
23 ENVIRONMENT is provided the FORM is first macroexpanded in it."
24 (%constantp form environment envp))
26 #!-sb-fluid (declaim (inline constant-form-value))
27 (defun constant-form-value (form &optional (environment nil envp))
28 "Returns the value of the constant FORM in ENVIRONMENT. Behaviour
29 is undefined unless CONSTANTP has been first used to determine the
30 constantness of the FORM in ENVIRONMENT."
31 (%constant-form-value form environment envp))
33 (declaim (inline constant-typep))
34 (defun constant-typep (form type &optional (environment nil envp))
35 (and (%constantp form environment envp)
36 ;; FIXME: We probably should be passing the environment to
37 ;; TYPEP too, but (1) our XC version of typep AVERs that the
38 ;; environment is null (2) our real version ignores it anyhow.
39 (sb!xc:typep (%constant-form-value form environment envp) type)))