Function: make-byte-code
make-byte-code is a function defined in alloc.c.
Signature
(make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS)
Documentation
Create a byte-code object with specified arguments as elements.
The arguments should be the ARGLIST, bytecode-string BYTE-CODE, constant
vector CONSTANTS, maximum stack size DEPTH, (optional) DOCSTRING,
and (optional) INTERACTIVE-SPEC.
The first four arguments are required; at most six have any
significance.
The ARGLIST can be either like the one of lambda, in which case the arguments
will be dynamically bound before executing the byte code, or it can be an
integer of the form NNNNNNNRMMMMMMM where the 7bit MMMMMMM specifies the
minimum number of arguments, the 7-bit NNNNNNN specifies the maximum number
of arguments (ignoring &rest) and the R bit specifies whether there is a &rest
argument to catch the left-over arguments. If such an integer is used, the
arguments will not be dynamically bound but will be instead pushed on the
stack before executing the byte-code.
Probably introduced at or before Emacs version 28.1.
Source Code
// Defined in /usr/src/emacs/src/alloc.c
{
if (! ((FIXNUMP (args[CLOSURE_ARGLIST])
|| CONSP (args[CLOSURE_ARGLIST])
|| NILP (args[CLOSURE_ARGLIST]))
&& STRINGP (args[CLOSURE_CODE])
&& !STRING_MULTIBYTE (args[CLOSURE_CODE])
&& VECTORP (args[CLOSURE_CONSTANTS])
&& FIXNATP (args[CLOSURE_STACK_DEPTH])))
error ("Invalid byte-code object");
/* Bytecode must be immovable. */
pin_string (args[CLOSURE_CODE]);
Lisp_Object val = Fvector (nargs, args);
XSETPVECTYPE (XVECTOR (val), PVEC_CLOSURE);
return val;
}