Limit on number of arguments for compiled functions?

Robert Dodier <[email protected]> Tue, 10 Sep 2019 20:57:37 -0700
Newsgroups gmane.lisp.clisp.general
Message-ID <CAAsY_sTuZKD2L9CSM_=wY4hmdxQb2DAQiz3J-nF7Vhi2vzZJjA@mail.gmail.com>
Hi,

it appears that the maximum number of arguments for compiled functions
is something greater than CALL-ARGUMENTS-LIMIT.

Here's an example of what I'm seeing (Clisp 2.49 on Linux).

[1]> (defvar x (loop for i from 1 to 10000 collect i))
X
[2]> (defun f (&rest a) (last a))
F
[3]> (apply 'f x)

*** - APPLY: too many arguments given to #<FUNCTION F (&REST A)
(DECLARE (SYSTEM::IN-DEFUN F)) (BLOCK F (LAST A))>
The following restarts are available:
ABORT          :R1      Abort main loop
Break 1 [4]> :r1

OK, that error was expected, since 10000 > CALL-ARGUMENTS-LIMIT which is 4096.

[5]> (compile 'f)
F ;
NIL ;
NIL
[6]> (apply 'f x)
(10000)

Hmm, it looks like it worked the second time, after compiling F. Is
that to be expected? If so, is there a way to know what the actual
limit is for compiled functions?

Thanks for any light you can shed on this question, and all the best.

Robert Dodier


_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list