Detect recursive inline functions

This commit is contained in:
Juan Jose Garcia Ripoll 2011-12-18 18:20:29 +01:00
parent 6512337535
commit 480d1dedfd
2 changed files with 8 additions and 2 deletions

View file

@ -70,8 +70,11 @@
(consp can-inline)
(eq (first can-inline) 'function)
(<= (cmp-env-optimization 'space) 1))
(cmpnote "Inlining ~a" fname)
(c1expr `(funcall ,can-inline ,@args)))
(when (member fname *inlined-functions* :test #'eq)
(cmperr "Recursive function ~A declared inline." fname))
(let ((*inlined-functions* (cons fname *inlined-functions*)))
(cmpnote "Inlining ~a" fname)
(c1expr `(funcall ,can-inline ,@args))))
(t (c1call-global fname args))))
(defun c1call-local (fname args)

View file

@ -29,6 +29,9 @@
;;; temporaries for intermediate results of the evaluation of inlined
;;; function calls.
(defvar *inlined-functions* '()
"List of functions being inlined right now. Used to detect recursive inlines.")
;;; --cmputil.lsp--
;;;
;;; Variables and constants for error handling