X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftarget-eval.lisp;h=51f445e48e0960e9583a29dcd8e1df9e81851509;hb=3bd7a97d1b11a2b0aee086ef211cae807f3dfc35;hp=8345ec774a61f0392ee4067117a49d0f7ef30a51;hpb=95a6db7329b91dd90d165dd4057b9b5098d34aa2;p=sbcl.git diff --git a/src/code/target-eval.lisp b/src/code/target-eval.lisp index 8345ec7..51f445e 100644 --- a/src/code/target-eval.lisp +++ b/src/code/target-eval.lisp @@ -7,28 +7,6 @@ ;;;; 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.") - -;;; 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 @@ -48,7 +26,7 @@ (:print-object (lambda (x stream) (print-unreadable-object (x stream :identity t) - (sb!impl::output-interpreted-function x stream))))) + (interpreted-function-%name x))))) ;; The name of this interpreted function, or NIL if none specified. (%name nil) ;; This function's debug arglist. @@ -59,8 +37,8 @@ ;; 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. @@ -73,18 +51,19 @@ ;;;; One of the steps in building a nice debuggable macro is changing ;;;; its MACRO-FUNCTION to print as e.g. ;;;; # -;;;; 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) @@ -103,7 +82,7 @@ ;;; 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))) @@ -179,32 +158,19 @@ (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)