From 97a829b63ff520094ebfc77c33158549051d7128 Mon Sep 17 00:00:00 2001
From: wlott <wlott>
Date: Fri, 23 Nov 1990 18:13:32 +0000
Subject: [PATCH] Let-bind a special in interpreted-function-type so that we
 can tell when we are recursivly called with the same function object.  If we
 are, we just return a generic function type.

---
 compiler/eval.lisp | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/compiler/eval.lisp b/compiler/eval.lisp
index f98965ce4..aee5953b3 100644
--- a/compiler/eval.lisp
+++ b/compiler/eval.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman (FAHLMAN@CMUC). 
 ;;; **********************************************************************
 ;;;
-;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/eval.lisp,v 1.14 1990/11/20 18:36:03 ram Exp $
+;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/eval.lisp,v 1.15 1990/11/23 18:13:32 wlott Exp $
 ;;; 
 ;;; This file contains the interpreter.  We first convert to the compiler's
 ;;; IR1 and interpret that.
@@ -255,13 +255,19 @@
 ;;; LEAF-TYPE of the definition, converting the definition if not currently
 ;;; cached.
 ;;;
+(defvar *already-looking-for-type-of* nil)
+;;;
 (defun interpreted-function-type (fun)
-  (let* ((eval-fun (get-eval-function fun))
-	 (def (or (eval-function-definition eval-fun)
-		  (system:without-gcing
-		    (convert-eval-fun eval-fun)
-		    (eval-function-definition eval-fun)))))
-    (c::leaf-type (c::functional-entry-function def))))
+  (if (member fun *already-looking-for-type-of*)
+      (specifier-type 'function)
+      (let* ((*already-looking-for-type-of*
+	      (cons fun *already-looking-for-type-of*))
+	     (eval-fun (get-eval-function fun))
+	     (def (or (eval-function-definition eval-fun)
+		      (system:without-gcing
+		       (convert-eval-fun eval-fun)
+		       (eval-function-definition eval-fun)))))
+	(c::leaf-type (c::functional-entry-function def)))))
 
 
 ;;; 
-- 
GitLab