From 471f3f8312664b951a45cdf89bc870a2ba526405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Tue, 11 Feb 2020 17:06:51 +0100 Subject: [PATCH] function-lambda-list: bytecmp: always use the annotation I think that the old method is a relic from the past when bytecodes had a different representation. bytecompiled functions also have proper annotations so there is no need to attempt to disassemble their lambda lists manually. Closes #561. --- src/lsp/top.lsp | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/src/lsp/top.lsp b/src/lsp/top.lsp index f14399db3..237aca7c5 100644 --- a/src/lsp/top.lsp +++ b/src/lsp/top.lsp @@ -809,38 +809,6 @@ Use special code 0 to cancel this operation.") (format t " No source code available for this function.~%")) (values))) -(defun reconstruct-bytecodes-lambda-list (data) - (declare (si::c-local data)) - (let ((output '())) - (dotimes (n (pop data)) ;; required values - (declare (fixnum n)) - (push (pop data) output)) - (let ((l (pop data))) ;; optional values - (declare (fixnum l)) - (unless (zerop l) - (push '&optional output) - (dotimes (n l) - (push (first data) output) - (setf data (cdddr data))))) - (let ((rest (pop data))) ;; &rest value - (when rest - (push '&rest output) - (push rest output))) - (let* ((allow-other-keys (pop data))) ;; &keys and &allow-other-keys - (unless (eql allow-other-keys 0) - (push '&key output) - (let ((l (pop data))) - (declare (fixnum l)) - (dotimes (n l) - (let* ((key (first data)) - (var (second data))) - (unless (and (keywordp key) (string= key var)) - (setf var (list (list key var)))) - (push var output)))) - (when allow-other-keys - (push '&allow-other-keys output)))) - (nreverse output))) - (defun lambda-list-from-annotations (name) (declare (si::c-local)) (let ((args (ext:get-annotation name :lambda-list nil))) @@ -868,16 +836,8 @@ Use special code 0 to cancel this operation.") (ndx (position '&aux list))) (return-from function-lambda-list (values (if ndx (subseq list 0 (1- ndx)) list) t)))))) - ;; Reconstruct the lambda list from the bytecodes - ((multiple-value-bind (lex-env bytecodes data) - (si::bc-split function) - (declare (ignore lex-env)) - (when bytecodes - (setq data (coerce data 'list)) - (return-from function-lambda-list - (values (reconstruct-bytecodes-lambda-list data) t))))) ;; If it's a compiled function of ECL itself, reconstruct the - ;; lambda-list from its documentation string. + ;; lambda-list from the annotation. (t (lambda-list-from-annotations (compiled-function-name function)))))