;;;; provided with absolutely no warranty. See the COPYING and CREDITS
;;;; files for more information.
-(in-package "SB!IMPL")
-
-;;; FIXME: These probably belong in some package other than SB!IMPL.
-;;; Perhaps SB!KERNEL?
-
-(defconstant call-arguments-limit most-positive-fixnum
- #!+sb-doc
- "The exclusive upper bound on the number of arguments which may be passed
- to a function, including rest args.")
-
-(defconstant lambda-parameters-limit most-positive-fixnum
- #!+sb-doc
- "The exclusive upper bound on the number of parameters which may be specifed
- in a given lambda list. This is actually the limit on required and optional
- parameters. With &key and &aux you can get more.")
-
-(defconstant multiple-values-limit most-positive-fixnum
- #!+sb-doc
- "The exclusive upper bound on the number of multiple-values that you can
- have.")
-\f
-;;; FIXME: more than one IN-PACKAGE in one file, ick
(in-package "SB!EVAL")
;;; This is defined here so that the printer etc. can call
;; false, then the function is not in the cache (or is in the process of
;; being removed.)
(definition nil :type (or sb!c::clambda null))
- ;; The number of consequtive GCs that this function has been unused. This is
- ;; used to control cache replacement.
+ ;; The number of consecutive GCs that this function has been unused.
+ ;; This is used to control cache replacement.
(gcs 0 :type sb!c::index)
;; True if Lambda has been converted at least once, and thus warnings should
;; be suppressed on additional conversions.
;;;; One of the steps in building a nice debuggable macro is changing
;;;; its MACRO-FUNCTION to print as e.g.
;;;; #<Interpreted Function "DEFMACRO BAR" {9166351}>
-;;;; instead of some
-;;;; weird internal representation showing the environment argument and stuff.
-;;;; This function is called in order to try to make that happen.
+;;;; instead of some weird internal representation showing the
+;;;; environment argument and stuff. This function is called in order
+;;;; to try to make that happen.
;;;;
-;;;; When we're running in the target SBCL, we own the INTERPRETED-FUNCTION
-;;;; definition, and we can do this; that's what the definition below does.
-;;;; When we're a Python cross-compiler running in some arbitrary ANSI Common
-;;;; Lisp, we can't do this (and we don't care that much about making nice
-;;;; debuggable macros anyway). In that environment, a stub no-op version of
-;;;; this function is used.
+;;;; When we're running in the target SBCL, we own the
+;;;; INTERPRETED-FUNCTION definition, and we can do this; that's what
+;;;; the definition below does. When we're a Python cross-compiler
+;;;; running in some arbitrary ANSI Common Lisp, we can't do this (and
+;;;; we don't care that much about making nice debuggable macros
+;;;; anyway). In that environment, a stub no-op version of this
+;;;; function is used.
(defun try-to-rename-interpreted-function-as-macro (f name lambda-list)
- (assert (sb!eval:interpreted-function-p f))
+ (aver (sb!eval:interpreted-function-p f))
(setf (sb!eval:interpreted-function-name f)
(format nil "DEFMACRO ~S" name)
(sb!eval:interpreted-function-arglist f)
\f
;;;; EVAL and friends
-;;; This needs to be initialized in the cold load, since the top-level catcher
-;;; will always restore the initial value.
+;;; This needs to be initialized in the cold load, since the top-level
+;;; catcher will always restore the initial value.
(defvar *eval-stack-top* 0)
;;; Pick off a few easy cases, and call INTERNAL-EVAL for the rest. If
-;;; *ALREADY-EVALED-THIS* is true, then we bind it to NIL before doing a call
-;;; so that the effect is confined to the lexical scope of the EVAL-WHEN.
+;;; *ALREADY-EVALED-THIS* is true, then we bind it to NIL before doing
+;;; a call so that the effect is confined to the lexical scope of the
+;;; EVAL-WHEN.
(defun eval (original-exp)
#!+sb-doc
- "Evaluates its single arg in a null lexical environment, returns the
+ "Evaluates its single argument in a null lexical environment, returns the
result or results."
(declare (optimize (safety 1)))
(let ((exp (macroexpand original-exp)))
((null name)
(do ((args (cdr exp) (cddr args)))
((null (cddr args))
- ;; We duplicate the call to SET so that the correct
- ;; value gets returned.
+ ;; We duplicate the call to SET so that the
+ ;; correct value gets returned.
(set (first args) (eval (second args))))
(set (first args) (eval (second args)))))
(let ((symbol (first name)))
(t
exp))))
-;;; not needed in new from-scratch cross-compilation procedure -- WHN 19990714
-#|
-;;; Dummy stubs for SB!EVAL:INTERNAL-EVAL and SB!EVAL:MAKE-INTERPRETED-FUNCTION
-;;; in case the compiler isn't loaded yet.
-(defun sb!eval:internal-eval (x)
- (error "attempt to evaluation a complex expression:~% ~S~@
- This expression must be compiled, but the compiler is not loaded."
- x))
-(defun sb!eval:make-interpreted-function (x)
- (error "EVAL called on #'(lambda (x) ...) when the compiler isn't loaded:~
- ~% ~S~%"
- x))
-|#
-
+;;; Given a function, return three values:
+;;; 1] A lambda expression that could be used to define the function,
+;;; or NIL if the definition isn't available.
+;;; 2] NIL if the function was definitely defined in a null lexical
+;;; environment, and T otherwise.
+;;; 3] Some object that \"names\" the function. Although this is
+;;; allowed to be any object, CMU CL always returns a valid
+;;; function name or a string.
+;;;
;;; If interpreted, use the interpreter interface. Otherwise, see
;;; whether it was compiled with COMPILE. If that fails, check for an
;;; inline expansion.
(defun function-lambda-expression (fun)
- #!+sb-doc
- "Given a function, return three values:
- 1] A lambda expression that could be used to define the function, or NIL if
- the definition isn't available.
- 2] NIL if the function was definitely defined in a null lexical environment,
- and T otherwise.
- 3] Some object that \"names\" the function. Although this is allowed to be
- any object, CMU CL always returns a valid function name or a string."
(declare (type function fun))
(if (sb!eval:interpreted-function-p fun)
(sb!eval:interpreted-function-lambda-expression fun)