1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

(COMPILED): Rename to CLOSURE

In preparation for the use of `PVEC_COMPILED` objects for
interpreted functions, rename them to use a more neutral name.

* src/lisp.h (enum pvec_type): Rename `PVEC_COMPILED` to `PVEC_CLOSURE`.
(enum Lisp_Compiled): Use `CLOSURE_` prefix i.s.o `COMPILED_`.
Also use `CODE` rather than `BYTECODE`.
(CLOSUREP): Rename from `COMPILEDP`.
(enum Lisp_Closure): Rename from `Lisp_Compiled`.

* src/alloc.c, src/bytecode.c, src/comp.c, src/data.c, src/eval.c,
* src/fns.c, src/lisp.h, src/lread.c, src/pdumper.c, src/print.c,
* src/profiler.c: Rename all uses accordingly.
* src/.gdbinit (xclosure): Rename from `xcompiled`.
(xcompiled): New obsolete alias.
(xpr): Adjust accordingly.  Also adjust to new PVEC_CLOSURE tag name.
This commit is contained in:
Stefan Monnier 2024-03-24 18:32:25 -04:00
parent 1e931f1c3d
commit 2fa839c188
13 changed files with 116 additions and 109 deletions

View file

@ -3481,7 +3481,7 @@ cleanup_vector (struct Lisp_Vector *vector)
case PVEC_XWIDGET_VIEW:
case PVEC_TS_NODE:
case PVEC_SQLITE:
case PVEC_COMPILED:
case PVEC_CLOSURE:
case PVEC_CHAR_TABLE:
case PVEC_SUB_CHAR_TABLE:
case PVEC_RECORD:
@ -3813,17 +3813,17 @@ stack before executing the byte-code.
usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
if (! ((FIXNUMP (args[COMPILED_ARGLIST])
|| CONSP (args[COMPILED_ARGLIST])
|| NILP (args[COMPILED_ARGLIST]))
&& STRINGP (args[COMPILED_BYTECODE])
&& !STRING_MULTIBYTE (args[COMPILED_BYTECODE])
&& VECTORP (args[COMPILED_CONSTANTS])
&& FIXNATP (args[COMPILED_STACK_DEPTH])))
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[COMPILED_BYTECODE]);
pin_string (args[CLOSURE_CODE]);
/* We used to purecopy everything here, if purify-flag was set. This worked
OK for Emacs-23, but with Emacs-24's lexical binding code, it can be
@ -3833,7 +3833,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
just wasteful and other times plainly wrong (e.g. those free vars may want
to be setcar'd). */
Lisp_Object val = Fvector (nargs, args);
XSETPVECTYPE (XVECTOR (val), PVEC_COMPILED);
XSETPVECTYPE (XVECTOR (val), PVEC_CLOSURE);
return val;
}
@ -3845,12 +3845,12 @@ usage: (make-closure PROTOTYPE &rest CLOSURE-VARS) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object protofun = args[0];
CHECK_TYPE (COMPILEDP (protofun), Qbyte_code_function_p, protofun);
CHECK_TYPE (CLOSUREP (protofun), Qbyte_code_function_p, protofun);
/* Create a copy of the constant vector, filling it with the closure
variables in the beginning. (The overwritten part should just
contain placeholder values.) */
Lisp_Object proto_constvec = AREF (protofun, COMPILED_CONSTANTS);
Lisp_Object proto_constvec = AREF (protofun, CLOSURE_CONSTANTS);
ptrdiff_t constsize = ASIZE (proto_constvec);
ptrdiff_t nvars = nargs - 1;
if (nvars > constsize)
@ -3866,7 +3866,7 @@ usage: (make-closure PROTOTYPE &rest CLOSURE-VARS) */)
struct Lisp_Vector *v = allocate_vectorlike (protosize, false);
v->header = XVECTOR (protofun)->header;
memcpy (v->contents, XVECTOR (protofun)->contents, protosize * word_size);
v->contents[COMPILED_CONSTANTS] = constvec;
v->contents[CLOSURE_CONSTANTS] = constvec;
return make_lisp_ptr (v, Lisp_Vectorlike);
}
@ -6046,7 +6046,7 @@ purecopy (Lisp_Object obj)
obj = make_lisp_hash_table (purecopy_hash_table (table));
}
else if (COMPILEDP (obj) || VECTORP (obj) || RECORDP (obj))
else if (CLOSUREP (obj) || VECTORP (obj) || RECORDP (obj))
{
struct Lisp_Vector *objp = XVECTOR (obj);
ptrdiff_t nbytes = vector_nbytes (objp);
@ -6059,7 +6059,7 @@ purecopy (Lisp_Object obj)
for (i = 0; i < size; i++)
vec->contents[i] = purecopy (vec->contents[i]);
/* Byte code strings must be pinned. */
if (COMPILEDP (obj) && size >= 2 && STRINGP (vec->contents[1])
if (CLOSUREP (obj) && size >= 2 && STRINGP (vec->contents[1])
&& !STRING_MULTIBYTE (vec->contents[1]))
pin_string (vec->contents[1]);
XSETVECTOR (obj, vec);
@ -8014,11 +8014,11 @@ symbol_uses_obj (Lisp_Object symbol, Lisp_Object obj)
return (EQ (val, obj)
|| EQ (sym->u.s.function, obj)
|| (!NILP (sym->u.s.function)
&& COMPILEDP (sym->u.s.function)
&& EQ (AREF (sym->u.s.function, COMPILED_BYTECODE), obj))
&& CLOSUREP (sym->u.s.function)
&& EQ (AREF (sym->u.s.function, CLOSURE_CODE), obj))
|| (!NILP (val)
&& COMPILEDP (val)
&& EQ (AREF (val, COMPILED_BYTECODE), obj)));
&& CLOSUREP (val)
&& EQ (AREF (val, CLOSURE_CODE), obj)));
}
/* Find at most FIND_MAX symbols which have OBJ as their value or
@ -8343,7 +8343,7 @@ union
enum CHECK_LISP_OBJECT_TYPE CHECK_LISP_OBJECT_TYPE;
enum DEFAULT_HASH_SIZE DEFAULT_HASH_SIZE;
enum Lisp_Bits Lisp_Bits;
enum Lisp_Compiled Lisp_Compiled;
enum Lisp_Closure Lisp_Closure;
enum maxargs maxargs;
enum MAX_ALLOCA MAX_ALLOCA;
enum More_Lisp_Bits More_Lisp_Bits;