X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftarget-eval.lisp;h=51f445e48e0960e9583a29dcd8e1df9e81851509;hb=3bd7a97d1b11a2b0aee086ef211cae807f3dfc35;hp=3d6a7278baa99f7db68dbf944d9c059b30dc4c64;hpb=334af30b26555f0bf706f7157b399bdbd4fad548;p=sbcl.git diff --git a/src/code/target-eval.lisp b/src/code/target-eval.lisp index 3d6a727..51f445e 100644 --- a/src/code/target-eval.lisp +++ b/src/code/target-eval.lisp @@ -26,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. @@ -37,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. @@ -51,16 +51,17 @@ ;;;; 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) (aver (sb!eval:interpreted-function-p f)) (setf (sb!eval:interpreted-function-name f) @@ -157,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)