summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-02-24 22:27:45 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2011-02-24 22:27:45 -0500
commit876c194cbac17a6220dbf406b0a602325978011c (patch)
treef76a686c53e547a24039d9de2deaf68598e75518 /src
parentcb9336bd977d3345b86234c36d45228f7fb27eec (diff)
downloademacs-876c194cbac17a6220dbf406b0a602325978011c.tar.gz
Get rid of funvec.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of `byte-constant'. (byte-compile-close-variables, displaying-byte-compile-warnings): Add edebug spec. (byte-compile-toplevel-file-form): New fun, split out of byte-compile-file-form. (byte-compile-from-buffer): Use it to avoid applying cconv multiple times. (byte-compile): Only strip `function' if it's present. (byte-compile-lambda): Add `reserved-csts' argument. Use new lexenv arg of byte-compile-top-level. (byte-compile-reserved-constants): New var. (byte-compile-constants-vector): Obey it. (byte-compile-constants-vector): Handle new `byte-constant' form. (byte-compile-top-level): Add args `lexenv' and `reserved-csts'. (byte-compile-form): Don't check callargs here. (byte-compile-normal-call): Do it here instead. (byte-compile-push-unknown-constant) (byte-compile-resolve-unknown-constant): Remove, unused. (byte-compile-make-closure): Use `make-byte-code' rather than `curry', putting the environment into the "constant" pool. (byte-compile-get-closed-var): Use special byte-constant. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new intermediate special form `internal-make-vector'. (byte-optimize-lapcode): Handle new form of `byte-constant'. * lisp/help-fns.el (describe-function-1): Don't handle funvecs. * lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to function if the content is a lambda expression, not if it's a closure. * emacs-lisp/eieio-come.el: Remove. * lisp/emacs-lisp/eieio.el: Don't require eieio-comp. (defmethod): Do a bit more work to find the body and wrap it into a function before passing it to eieio-defmethod. (eieio-defmethod): New arg `code' for it. * lisp/emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in debugger backtrace. * lisp/emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be more careful when quoting a function value. * lisp/emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst. (cconv-closure-convert-rec): Catch stray `internal-make-closure'. * lisp/Makefile.in (COMPILE_FIRST): Compile pcase and cconv early. * src/eval.c (Qcurry): Remove. (funcall_funvec): Remove. (funcall_lambda): Move new byte-code handling to reduce impact. Treat all args as lexical in the case of lexbind. (Fcurry): Remove. * src/data.c (Qfunction_vector): Remove. (Ffunvecp): Remove. * src/lread.c (read1): Revert to calling make_byte_code here. (read_vector): Don't call make_byte_code any more. * src/lisp.h (enum pvec_type): Rename back to PVEC_COMPILED. (XSETCOMPILED): Rename back from XSETFUNVEC. (FUNVEC_SIZE): Remove. (FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): Remove. (COMPILEDP): Rename back from FUNVECP. * src/fns.c (Felt): Remove unexplained FUNVEC check. * src/doc.c (Fdocumentation): Don't handle funvec. * src/alloc.c (make_funvec, Ffunvec): Remove. * doc/lispref/vol2.texi (Top): * doc/lispref/vol1.texi (Top): * doc/lispref/objects.texi (Programming Types, Funvec Type, Type Predicates): * doc/lispref/functions.texi (Functions, What Is a Function, FunctionCurrying): * doc/lispref/elisp.texi (Top): Remove mentions of funvec and curry.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog56
-rw-r--r--src/ChangeLog.funvec37
-rw-r--r--src/alloc.c71
-rw-r--r--src/bytecode.c9
-rw-r--r--src/data.c25
-rw-r--r--src/doc.c5
-rw-r--r--src/eval.c133
-rw-r--r--src/fns.c25
-rw-r--r--src/image.c3
-rw-r--r--src/keyboard.c2
-rw-r--r--src/lisp.h33
-rw-r--r--src/lread.c33
-rw-r--r--src/print.c6
13 files changed, 133 insertions, 305 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d522b6c55dc..e7902b8c083 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,23 @@
+2011-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * eval.c (Qcurry): Remove.
+ (funcall_funvec): Remove.
+ (funcall_lambda): Move new byte-code handling to reduce impact.
+ Treat all args as lexical in the case of lexbind.
+ (Fcurry): Remove.
+ * data.c (Qfunction_vector): Remove.
+ (Ffunvecp): Remove.
+ * lread.c (read1): Revert to calling make_byte_code here.
+ (read_vector): Don't call make_byte_code any more.
+ * lisp.h (enum pvec_type): Rename back to PVEC_COMPILED.
+ (XSETCOMPILED): Rename back from XSETFUNVEC.
+ (FUNVEC_SIZE): Remove.
+ (FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): Remove.
+ (COMPILEDP): Rename back from FUNVECP.
+ * fns.c (Felt): Remove unexplained FUNVEC check.
+ * doc.c (Fdocumentation): Don't handle funvec.
+ * alloc.c (make_funvec, Ffunvec): Remove.
+
2011-02-21 Stefan Monnier <monnier@iro.umontreal.ca>
* bytecode.c (exec_byte_code): Change stack_ref and stack_set to use
@@ -113,6 +133,42 @@
Merge funvec patch.
+2004-05-20 Miles Bader <miles@gnu.org>
+
+ * lisp.h: Declare make_funvec and Ffunvec.
+ (enum pvec_type): Rename `PVEC_COMPILED' to `PVEC_FUNVEC'.
+ (XSETFUNVEC): Rename from `XSETCOMPILED'.
+ (FUNVEC_SIZE, FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): New macros.
+ (COMPILEDP): Define in terms of funvec macros.
+ (FUNVECP, GC_FUNVECP): Rename from `COMPILEDP' & `GC_COMPILEDP'.
+ (FUNCTIONP): Use FUNVECP instead of COMPILEDP.
+ * alloc.c (make_funvec, funvec): New functions.
+ (Fmake_byte_code): Make sure the first element is a list.
+
+ * eval.c (Qcurry): New variable.
+ (funcall_funvec, Fcurry): New functions.
+ (syms_of_eval): Initialize them.
+ (funcall_lambda): Handle non-bytecode funvec objects by calling
+ funcall_funvec.
+ (Ffuncall, Feval): Use FUNVECP insetad of COMPILEDP.
+ * lread.c (read1): Return result of read_vector for `#[' syntax
+ directly; read_vector now does any extra work required.
+ (read_vector): Handle both funvec and byte-code objects, converting the
+ type as necessary. `bytecodeflag' argument is now called
+ `read_funvec'.
+ * data.c (Ffunvecp): New function.
+ * doc.c (Fdocumentation): Return nil for unknown funvecs.
+ * fns.c (mapcar1, Felt, concat): Allow funvecs.
+
+ * eval.c (Ffunctionp): Use `funvec' operators instead of `compiled'
+ operators.
+ * alloc.c (Fmake_byte_code, Fpurecopy, mark_object): Likewise.
+ * keyboard.c (Fcommand_execute): Likewise.
+ * image.c (parse_image_spec): Likewise.
+ * fns.c (Flength, concat, internal_equal): Likewise.
+ * data.c (Faref, Ftype_of): Likewise.
+ * print.c (print_preprocess, print_object): Likewise.
+
2004-04-10 Miles Bader <miles@gnu.org>
* eval.c (Fspecialp): New function.
diff --git a/src/ChangeLog.funvec b/src/ChangeLog.funvec
deleted file mode 100644
index 098539f1dd9..00000000000
--- a/src/ChangeLog.funvec
+++ /dev/null
@@ -1,37 +0,0 @@
-2004-05-20 Miles Bader <miles@gnu.org>
-
- * lisp.h: Declare make_funvec and Ffunvec.
- (enum pvec_type): Rename `PVEC_COMPILED' to `PVEC_FUNVEC'.
- (XSETFUNVEC): Renamed from `XSETCOMPILED'.
- (FUNVEC_SIZE, FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): New macros.
- (COMPILEDP): Define in terms of funvec macros.
- (FUNVECP, GC_FUNVECP): Renamed from `COMPILEDP' & `GC_COMPILEDP'.
- (FUNCTIONP): Use FUNVECP instead of COMPILEDP.
- * alloc.c (make_funvec, funvec): New functions.
- (Fmake_byte_code): Make sure the first element is a list.
-
- * eval.c (Qcurry): New variable.
- (funcall_funvec, Fcurry): New functions.
- (syms_of_eval): Initialize them.
- (funcall_lambda): Handle non-bytecode funvec objects by calling
- funcall_funvec.
- (Ffuncall, Feval): Use FUNVECP insetad of COMPILEDP.
- * lread.c (read1): Return result of read_vector for `#[' syntax
- directly; read_vector now does any extra work required.
- (read_vector): Handle both funvec and byte-code objects, converting the
- type as necessary. `bytecodeflag' argument is now called
- `read_funvec'.
- * data.c (Ffunvecp): New function.
- * doc.c (Fdocumentation): Return nil for unknown funvecs.
- * fns.c (mapcar1, Felt, concat): Allow funvecs.
-
- * eval.c (Ffunctionp): Use `funvec' operators instead of `compiled'
- operators.
- * alloc.c (Fmake_byte_code, Fpurecopy, mark_object): Likewise.
- * keyboard.c (Fcommand_execute): Likewise.
- * image.c (parse_image_spec): Likewise.
- * fns.c (Flength, concat, internal_equal): Likewise.
- * data.c (Faref, Ftype_of): Likewise.
- * print.c (print_preprocess, print_object): Likewise.
-
-;; arch-tag: f35a6a00-4a11-4739-a4b6-9cf98296f315
diff --git a/src/alloc.c b/src/alloc.c
index 81a17b5c13b..0b7db7ec627 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2924,37 +2924,6 @@ See also the function `vector'. */)
}
-/* Return a new `function vector' containing KIND as the first element,
- followed by NUM_NIL_SLOTS nil elements, and further elements copied from
- the vector PARAMS of length NUM_PARAMS (so the total length of the
- resulting vector is 1 + NUM_NIL_SLOTS + NUM_PARAMS).
-
- If NUM_PARAMS is zero, then PARAMS may be NULL.
-
- A `function vector', a.k.a. `funvec', is a funcallable vector in Emacs Lisp.
- See the function `funvec' for more detail. */
-
-Lisp_Object
-make_funvec (Lisp_Object kind, int num_nil_slots, int num_params,
- Lisp_Object *params)
-{
- int param_index;
- Lisp_Object funvec;
-
- funvec = Fmake_vector (make_number (1 + num_nil_slots + num_params), Qnil);
-
- ASET (funvec, 0, kind);
-
- for (param_index = 0; param_index < num_params; param_index++)
- ASET (funvec, 1 + num_nil_slots + param_index, params[param_index]);
-
- XSETPVECTYPE (XVECTOR (funvec), PVEC_FUNVEC);
- XSETFUNVEC (funvec, XVECTOR (funvec));
-
- return funvec;
-}
-
-
DEFUN ("vector", Fvector, Svector, 0, MANY, 0,
doc: /* Return a newly created vector with specified arguments as elements.
Any number of arguments, even zero arguments, are allowed.
@@ -2974,27 +2943,6 @@ usage: (vector &rest OBJECTS) */)
}
-DEFUN ("funvec", Ffunvec, Sfunvec, 1, MANY, 0,
- doc: /* Return a newly created `function vector' of type KIND.
-A `function vector', a.k.a. `funvec', is a funcallable vector in Emacs Lisp.
-KIND indicates the kind of funvec, and determines its behavior when called.
-The meaning of the remaining arguments depends on KIND. Currently
-implemented values of KIND, and their meaning, are:
-
- A list -- A byte-compiled function. See `make-byte-code' for the usual
- way to create byte-compiled functions.
-
- `curry' -- A curried function. Remaining arguments are a function to
- call, and arguments to prepend to user arguments at the
- time of the call; see the `curry' function.
-
-usage: (funvec KIND &rest PARAMS) */)
- (int nargs, Lisp_Object *args)
-{
- return make_funvec (args[0], 0, nargs - 1, args + 1);
-}
-
-
DEFUN ("make-byte-code", Fmake_byte_code, Smake_byte_code, 4, MANY, 0,
doc: /* Create a byte-code object with specified arguments as elements.
The arguments should be the arglist, bytecode-string, constant vector,
@@ -3008,10 +2956,6 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
register int index;
register struct Lisp_Vector *p;
- /* Make sure the arg-list is really a list, as that's what's used to
- distinguish a byte-compiled object from other funvecs. */
- CHECK_LIST (args[0]);
-
XSETFASTINT (len, nargs);
if (!NILP (Vpurify_flag))
val = make_pure_vector ((EMACS_INT) nargs);
@@ -3033,8 +2977,8 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
args[index] = Fpurecopy (args[index]);
p->contents[index] = args[index];
}
- XSETPVECTYPE (p, PVEC_FUNVEC);
- XSETFUNVEC (val, p);
+ XSETPVECTYPE (p, PVEC_COMPILED);
+ XSETCOMPILED (val, p);
return val;
}
@@ -4817,7 +4761,7 @@ Does not copy symbols. Copies strings without text properties. */)
obj = make_pure_string (SSDATA (obj), SCHARS (obj),
SBYTES (obj),
STRING_MULTIBYTE (obj));
- else if (FUNVECP (obj) || VECTORP (obj))
+ else if (COMPILEDP (obj) || VECTORP (obj))
{
register struct Lisp_Vector *vec;
register EMACS_INT i;
@@ -4829,10 +4773,10 @@ Does not copy symbols. Copies strings without text properties. */)
vec = XVECTOR (make_pure_vector (size));
for (i = 0; i < size; i++)
vec->contents[i] = Fpurecopy (XVECTOR (obj)->contents[i]);
- if (FUNVECP (obj))
+ if (COMPILEDP (obj))
{
- XSETPVECTYPE (vec, PVEC_FUNVEC);
- XSETFUNVEC (obj, vec);
+ XSETPVECTYPE (vec, PVEC_COMPILED);
+ XSETCOMPILED (obj, vec);
}
else
XSETVECTOR (obj, vec);
@@ -5418,7 +5362,7 @@ mark_object (Lisp_Object arg)
}
else if (SUBRP (obj))
break;
- else if (FUNVECP (obj) && FUNVEC_COMPILED_P (obj))
+ else if (COMPILEDP (obj))
/* We could treat this just like a vector, but it is better to
save the COMPILED_CONSTANTS element for last and avoid
recursion there. */
@@ -6320,7 +6264,6 @@ The time is in seconds as a floating point value. */);
defsubr (&Scons);
defsubr (&Slist);
defsubr (&Svector);
- defsubr (&Sfunvec);
defsubr (&Smake_byte_code);
defsubr (&Smake_list);
defsubr (&Smake_vector);
diff --git a/src/bytecode.c b/src/bytecode.c
index 639c543dbf9..464bc3d12de 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -51,7 +51,7 @@ by Hallvard:
*
* define BYTE_CODE_METER to enable generation of a byte-op usage histogram.
*/
-/* #define BYTE_CODE_SAFE 1 */
+/* #define BYTE_CODE_SAFE */
/* #define BYTE_CODE_METER */
@@ -1720,8 +1720,13 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
break;
#endif
+ case 0:
+ /* Actually this is Bstack_ref with offset 0, but we use Bdup
+ for that instead. */
+ /* case Bstack_ref: */
+ abort ();
+
/* Handy byte-codes for lexical binding. */
- /* case Bstack_ref: */ /* Use `dup' instead. */
case Bstack_ref+1:
case Bstack_ref+2:
case Bstack_ref+3:
diff --git a/src/data.c b/src/data.c
index ecedba24101..186e9cb9859 100644
--- a/src/data.c
+++ b/src/data.c
@@ -84,7 +84,7 @@ static Lisp_Object Qsymbol, Qstring, Qcons, Qmarker, Qoverlay;
Lisp_Object Qwindow;
static Lisp_Object Qfloat, Qwindow_configuration;
Lisp_Object Qprocess;
-static Lisp_Object Qcompiled_function, Qfunction_vector, Qbuffer, Qframe, Qvector;
+static Lisp_Object Qcompiled_function, Qbuffer, Qframe, Qvector;
static Lisp_Object Qchar_table, Qbool_vector, Qhash_table;
static Lisp_Object Qsubrp, Qmany, Qunevalled;
Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
@@ -194,11 +194,8 @@ for example, (type-of 1) returns `integer'. */)
return Qwindow;
if (SUBRP (object))
return Qsubr;
- if (FUNVECP (object))
- if (FUNVEC_COMPILED_P (object))
- return Qcompiled_function;
- else
- return Qfunction_vector;
+ if (COMPILEDP (object))
+ return Qcompiled_function;
if (BUFFERP (object))
return Qbuffer;
if (CHAR_TABLE_P (object))
@@ -397,13 +394,6 @@ DEFUN ("byte-code-function-p", Fbyte_code_function_p, Sbyte_code_function_p,
return Qnil;
}
-DEFUN ("funvecp", Ffunvecp, Sfunvecp, 1, 1, 0,
- doc: /* Return t if OBJECT is a `function vector' object. */)
- (Lisp_Object object)
-{
- return FUNVECP (object) ? Qt : Qnil;
-}
-
DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0,
doc: /* Return t if OBJECT is a character or a string. */)
(register Lisp_Object object)
@@ -2113,9 +2103,9 @@ or a byte-code object. IDX starts at 0. */)
{
int size = 0;
if (VECTORP (array))
- size = ASIZE (array);
- else if (FUNVECP (array))
- size = FUNVEC_SIZE (array);
+ size = XVECTOR (array)->size;
+ else if (COMPILEDP (array))
+ size = XVECTOR (array)->size & PSEUDOVECTOR_SIZE_MASK;
else
wrong_type_argument (Qarrayp, array);
@@ -3180,7 +3170,6 @@ syms_of_data (void)
Qwindow = intern_c_string ("window");
/* Qsubr = intern_c_string ("subr"); */
Qcompiled_function = intern_c_string ("compiled-function");
- Qfunction_vector = intern_c_string ("function-vector");
Qbuffer = intern_c_string ("buffer");
Qframe = intern_c_string ("frame");
Qvector = intern_c_string ("vector");
@@ -3206,7 +3195,6 @@ syms_of_data (void)
staticpro (&Qwindow);
/* staticpro (&Qsubr); */
staticpro (&Qcompiled_function);
- staticpro (&Qfunction_vector);
staticpro (&Qbuffer);
staticpro (&Qframe);
staticpro (&Qvector);
@@ -3243,7 +3231,6 @@ syms_of_data (void)
defsubr (&Smarkerp);
defsubr (&Ssubrp);
defsubr (&Sbyte_code_function_p);
- defsubr (&Sfunvecp);
defsubr (&Schar_or_string_p);
defsubr (&Scar);
defsubr (&Scdr);
diff --git a/src/doc.c b/src/doc.c
index 834321108b5..de20edb2d98 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -357,11 +357,6 @@ string is passed through `substitute-command-keys'. */)
else
return Qnil;
}
- else if (FUNVECP (fun))
- {
- /* Unless otherwise handled, funvecs have no documentation. */
- return Qnil;
- }
else if (STRINGP (fun) || VECTORP (fun))
{
return build_string ("Keyboard macro.");
diff --git a/src/eval.c b/src/eval.c
index 63484d40e1b..869d70e3d7f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -60,7 +60,6 @@ Lisp_Object Qinhibit_quit;
Lisp_Object Qand_rest, Qand_optional;
Lisp_Object Qdebug_on_error;
Lisp_Object Qdeclare;
-Lisp_Object Qcurry;
Lisp_Object Qinternal_interpreter_environment, Qclosure;
Lisp_Object Qdebug;
@@ -2405,7 +2404,7 @@ eval_sub (Lisp_Object form)
}
}
}
- else if (FUNVECP (fun))
+ else if (COMPILEDP (fun))
val = apply_lambda (fun, original_args);
else
{
@@ -2890,7 +2889,7 @@ DEFUN ("functionp", Ffunctionp, Sfunctionp, 1, 1, 0,
if (SUBRP (object))
return (XSUBR (object)->max_args != UNEVALLED) ? Qt : Qnil;
- else if (FUNVECP (object))
+ else if (COMPILEDP (object))
return Qt;
else if (CONSP (object))
{
@@ -3034,7 +3033,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
}
}
}
- else if (FUNVECP (fun))
+ else if (COMPILEDP (fun))
val = funcall_lambda (fun, numargs, args + 1);
else
{
@@ -3107,54 +3106,6 @@ apply_lambda (Lisp_Object fun, Lisp_Object args)
return tem;
}
-
-/* Call a non-bytecode funvec object FUN, on the argments in ARGS (of
- length NARGS). */
-
-static Lisp_Object
-funcall_funvec (Lisp_Object fun, int nargs, Lisp_Object *args)
-{
- int size = FUNVEC_SIZE (fun);
- Lisp_Object tag = (size > 0 ? AREF (fun, 0) : Qnil);
-
- if (EQ (tag, Qcurry))
- {
- /* A curried function is a way to attach arguments to a another
- function. The first element of the vector is the identifier
- `curry', the second is the wrapped function, and remaining
- elements are the attached arguments. */
- int num_curried_args = size - 2;
- /* Offset of the curried and user args in the final arglist. Curried
- args are first in the new arg vector, after the function. User
- args follow. */
- int curried_args_offs = 1;
- int user_args_offs = curried_args_offs + num_curried_args;
- /* The curried function and arguments. */
- Lisp_Object *curry_params = XVECTOR (fun)->contents + 1;
- /* The arguments in the curry vector. */
- Lisp_Object *curried_args = curry_params + 1;
- /* The number of arguments with which we'll call funcall, and the
- arguments themselves. */
- int num_funcall_args = 1 + num_curried_args + nargs;
- Lisp_Object *funcall_args
- = (Lisp_Object *) alloca (num_funcall_args * sizeof (Lisp_Object));
-
- /* First comes the real function. */
- funcall_args[0] = curry_params[0];
-
- /* Then the arguments in the appropriate order. */
- memcpy (funcall_args + curried_args_offs, curried_args,
- num_curried_args * sizeof (Lisp_Object));
- memcpy (funcall_args + user_args_offs, args,
- nargs * sizeof (Lisp_Object));
-
- return Ffuncall (num_funcall_args, funcall_args);
- }
- else
- xsignal1 (Qinvalid_function, fun);
-}
-
-
/* Apply a Lisp function FUN to the NARGS evaluated arguments in ARG_VECTOR
and return the result of evaluation.
FUN must be either a lambda-expression or a compiled-code object. */
@@ -3167,34 +3118,6 @@ funcall_lambda (Lisp_Object fun, int nargs,
int count = SPECPDL_INDEX ();
int i, optional, rest;
- if (COMPILEDP (fun)
- && FUNVEC_SIZE (fun) > COMPILED_PUSH_ARGS
- && ! NILP (XVECTOR (fun)->contents[COMPILED_PUSH_ARGS]))
- /* A byte-code object with a non-nil `push args' slot means we
- shouldn't bind any arguments, instead just call the byte-code
- interpreter directly; it will push arguments as necessary.
-
- Byte-code objects with either a non-existant, or a nil value for
- the `push args' slot (the default), have dynamically-bound
- arguments, and use the argument-binding code below instead (as do
- all interpreted functions, even lexically bound ones). */
- {
- /* If we have not actually read the bytecode string
- and constants vector yet, fetch them from the file. */
- if (CONSP (AREF (fun, COMPILED_BYTECODE)))
- Ffetch_bytecode (fun);
- return exec_byte_code (AREF (fun, COMPILED_BYTECODE),
- AREF (fun, COMPILED_CONSTANTS),
- AREF (fun, COMPILED_STACK_DEPTH),
- AREF (fun, COMPILED_ARGLIST),
- nargs, arg_vector);
- }
-
- if (FUNVECP (fun) && !FUNVEC_COMPILED_P (fun))
- /* Byte-compiled functions are handled directly below, but we
- call other funvec types via funcall_funvec. */
- return funcall_funvec (fun, nargs, arg_vector);
-
if (CONSP (fun))
{
if (EQ (XCAR (fun), Qclosure))
@@ -3213,6 +3136,27 @@ funcall_lambda (Lisp_Object fun, int nargs,
}
else if (COMPILEDP (fun))
{
+ if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_PUSH_ARGS
+ && ! NILP (XVECTOR (fun)->contents[COMPILED_PUSH_ARGS]))
+ /* A byte-code object with a non-nil `push args' slot means we
+ shouldn't bind any arguments, instead just call the byte-code
+ interpreter directly; it will push arguments as necessary.
+
+ Byte-code objects with either a non-existant, or a nil value for
+ the `push args' slot (the default), have dynamically-bound
+ arguments, and use the argument-binding code below instead (as do
+ all interpreted functions, even lexically bound ones). */
+ {
+ /* If we have not actually read the bytecode string
+ and constants vector yet, fetch them from the file. */
+ if (CONSP (AREF (fun, COMPILED_BYTECODE)))
+ Ffetch_bytecode (fun);
+ return exec_byte_code (AREF (fun, COMPILED_BYTECODE),
+ AREF (fun, COMPILED_CONSTANTS),
+ AREF (fun, COMPILED_STACK_DEPTH),
+ AREF (fun, COMPILED_ARGLIST),
+ nargs, arg_vector);
+ }
syms_left = AREF (fun, COMPILED_ARGLIST);
lexenv = Qnil;
}
@@ -3248,11 +3192,7 @@ funcall_lambda (Lisp_Object fun, int nargs,
val = Qnil;
/* Bind the argument. */
- if (!NILP (lexenv) && SYMBOLP (next)
- /* FIXME: there's no good reason to allow dynamic-scoping
- on function arguments, other than consistency with let. */
- && !XSYMBOL (next)->declared_special
- && NILP (Fmemq (next, Vinternal_interpreter_environment)))
+ if (!NILP (lexenv) && SYMBOLP (next))
/* Lexically bind NEXT by adding it to the lexenv alist. */
lexenv = Fcons (Fcons (next, val), lexenv);
else
@@ -3532,24 +3472,6 @@ context where binding is lexical by default. */)
-DEFUN ("curry", Fcurry, Scurry, 1, MANY, 0,
- doc: /* Return FUN curried with ARGS.
-The result is a function-like object that will append any arguments it
-is called with to ARGS, and call FUN with the resulting list of arguments.
-
-For instance:
- (funcall (curry '+ 3 4 5) 2) is the same as (funcall '+ 3 4 5 2)
-and:
- (mapcar (curry 'concat "The ") '("a" "b" "c"))
- => ("The a" "The b" "The c")
-
-usage: (curry FUN &rest ARGS) */)
- (int nargs, Lisp_Object *args)
-{
- return make_funvec (Qcurry, 0, nargs, args);
-}
-
-
DEFUN ("backtrace-debug", Fbacktrace_debug, Sbacktrace_debug, 2, 2, 0,
doc: /* Set the debug-on-exit flag of eval frame LEVEL levels down to FLAG.
The debugger is entered when that frame exits, if the flag is non-nil. */)
@@ -3764,9 +3686,6 @@ before making `inhibit-quit' nil. */);
Qclosure = intern_c_string ("closure");
staticpro (&Qclosure);
- Qcurry = intern_c_string ("curry");
- staticpro (&Qcurry);
-
Qdebug = intern_c_string ("debug");
staticpro (&Qdebug);
@@ -3901,11 +3820,9 @@ alist of active lexical bindings. */);
defsubr (&Srun_hook_with_args_until_success);
defsubr (&Srun_hook_with_args_until_failure);
defsubr (&Sfetch_bytecode);
- defsubr (&Scurry);
defsubr (&Sbacktrace_debug);
defsubr (&Sbacktrace);
defsubr (&Sbacktrace_frame);
- defsubr (&Scurry);
defsubr (&Sspecial_variable_p);
defsubr (&Sfunctionp);
}
diff --git a/src/fns.c b/src/fns.c
index 5748c3d6e02..b800846b781 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -127,8 +127,8 @@ To get the number of bytes, use `string-bytes'. */)
XSETFASTINT (val, MAX_CHAR);
else if (BOOL_VECTOR_P (sequence))
XSETFASTINT (val, XBOOL_VECTOR (sequence)->size);
- else if (FUNVECP (sequence))
- XSETFASTINT (val, FUNVEC_SIZE (sequence));
+ else if (COMPILEDP (sequence))
+ XSETFASTINT (val, ASIZE (sequence) & PSEUDOVECTOR_SIZE_MASK);
else if (CONSP (sequence))
{
i = 0;
@@ -488,7 +488,7 @@ concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_speci
{
this = args[argnum];
if (!(CONSP (this) || NILP (this) || VECTORP (this) || STRINGP (this)
- || FUNVECP (this) || BOOL_VECTOR_P (this)))
+ || COMPILEDP (this) || BOOL_VECTOR_P (this)))
wrong_type_argument (Qsequencep, this);
}
@@ -512,7 +512,7 @@ concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_speci
Lisp_Object ch;
EMACS_INT this_len_byte;
- if (VECTORP (this) || FUNVECP (this))
+ if (VECTORP (this) || COMPILEDP (this))
for (i = 0; i < len; i++)
{
ch = AREF (this, i);
@@ -1311,9 +1311,7 @@ DEFUN ("elt", Felt, Selt, 2, 2, 0,
return Fcar (Fnthcdr (n, sequence));
/* Faref signals a "not array" error, so check here. */
- if (! FUNVECP (sequence))
- CHECK_ARRAY (sequence, Qsequencep);
-
+ CHECK_ARRAY (sequence, Qsequencep);
return Faref (sequence, n);
}
@@ -2092,14 +2090,13 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int
if (WINDOW_CONFIGURATIONP (o1))
return compare_window_configurations (o1, o2, 0);
- /* Aside from them, only true vectors, char-tables, function vectors,
- and fonts (font-spec, font-entity, font-ojbect) are sensible to
- compare, so eliminate the others now. */
+ /* Aside from them, only true vectors, char-tables, compiled
+ functions, and fonts (font-spec, font-entity, font-ojbect)
+ are sensible to compare, so eliminate the others now. */
if (size & PSEUDOVECTOR_FLAG)
{
- if (!(size & (PVEC_FUNVEC
- | PVEC_CHAR_TABLE | PVEC_SUB_CHAR_TABLE
- | PVEC_FONT)))
+ if (!(size & (PVEC_COMPILED
+ | PVEC_CHAR_TABLE | PVEC_SUB_CHAR_TABLE | PVEC_FONT)))
return 0;
size &= PSEUDOVECTOR_SIZE_MASK;
}
@@ -2302,7 +2299,7 @@ mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq)
1) lists are not relocated and 2) the list is marked via `seq' so will not
be freed */
- if (VECTORP (seq) || FUNVECP (seq))
+ if (VECTORP (seq) || COMPILEDP (seq))
{
for (i = 0; i < leni; i++)
{
diff --git a/src/image.c b/src/image.c
index f4a50e92ab1..a7c6346f62c 100644
--- a/src/image.c
+++ b/src/image.c
@@ -835,8 +835,9 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
case IMAGE_FUNCTION_VALUE:
value = indirect_function (value);
+ /* FIXME: Shouldn't we use Ffunctionp here? */
if (SUBRP (value)
- || FUNVECP (value)
+ || COMPILEDP (value)
|| (CONSP (value) && EQ (XCAR (value), Qlambda)))
break;
return 0;
diff --git a/src/keyboard.c b/src/keyboard.c
index 1f14af78844..78aa1cfea77 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10179,7 +10179,7 @@ a special event, so ignore the prefix argument and don't clear it. */)
return Fexecute_kbd_macro (final, prefixarg, Qnil);
}
- if (CONSP (final) || SUBRP (final) || FUNVECP (final))
+ if (CONSP (final) || SUBRP (final) || COMPILEDP (final))
/* Don't call Fcall_interactively directly because we want to make
sure the backtrace has an entry for `call-interactively'.
For the same reason, pass `cmd' rather than `final'. */
diff --git a/src/lisp.h b/src/lisp.h
index badeb4258fb..223cdbc92f0 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -349,7 +349,7 @@ enum pvec_type
PVEC_NORMAL_VECTOR = 0,
PVEC_PROCESS = 0x200,
PVEC_FRAME = 0x400,
- PVEC_FUNVEC = 0x800,
+ PVEC_COMPILED = 0x800,
PVEC_WINDOW = 0x1000,
PVEC_WINDOW_CONFIGURATION = 0x2000,
PVEC_SUBR = 0x4000,
@@ -607,7 +607,7 @@ extern Lisp_Object make_number (EMACS_INT);
#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW))
#define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL))
#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR))
-#define XSETFUNVEC(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FUNVEC))
+#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
#define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE))
#define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BOOL_VECTOR))
@@ -623,9 +623,6 @@ extern Lisp_Object make_number (EMACS_INT);
eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)), \
AREF ((ARRAY), (IDX)) = (VAL))
-/* Return the size of the psuedo-vector object FUNVEC. */
-#define FUNVEC_SIZE(funvec) (ASIZE (funvec) & PSEUDOVECTOR_SIZE_MASK)
-
/* Convenience macros for dealing with Lisp strings. */
#define SDATA(string) (XSTRING (string)->data + 0)
@@ -1474,7 +1471,7 @@ struct Lisp_Float
typedef unsigned char UCHAR;
#endif
-/* Meanings of slots in a byte-compiled function vector: */
+/* Meanings of slots in a Lisp_Compiled: */
#define COMPILED_ARGLIST 0
#define COMPILED_BYTECODE 1
@@ -1484,24 +1481,6 @@ typedef unsigned char UCHAR;
#define COMPILED_INTERACTIVE 5
#define COMPILED_PUSH_ARGS 6
-/* Return non-zero if TAG, the first element from a funvec object, refers
- to a byte-code object. Byte-code objects are distinguished from other
- `funvec' objects by having a (possibly empty) list as their first
- element -- other funvec types use a non-nil symbol there. */
-#define FUNVEC_COMPILED_TAG_P(tag) \
- (NILP (tag) || CONSP (tag))
-
-/* Return non-zero if FUNVEC, which should be a `funvec' object, is a
- byte-compiled function. Byte-compiled function are funvecs with the
- arglist as the first element (other funvec types will have a symbol
- identifying the type as the first object). */
-#define FUNVEC_COMPILED_P(funvec) \
- (FUNVEC_SIZE (funvec) > 0 && FUNVEC_COMPILED_TAG_P (AREF (funvec, 0)))
-
-/* Return non-zero if OBJ is byte-compile function. */
-#define COMPILEDP(obj) \
- (FUNVECP (obj) && FUNVEC_COMPILED_P (obj))
-
/* Flag bits in a character. These also get used in termhooks.h.
Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE
(MUlti-Lingual Emacs) might need 22 bits for the character value
@@ -1657,7 +1636,7 @@ typedef struct {
#define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW)
#define TERMINALP(x) PSEUDOVECTORP (x, PVEC_TERMINAL)
#define SUBRP(x) PSEUDOVECTORP (x, PVEC_SUBR)
-#define FUNVECP(x) PSEUDOVECTORP (x, PVEC_FUNVEC)
+#define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED)
#define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER)
#define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE)
#define SUB_CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_SUB_CHAR_TABLE)
@@ -1851,7 +1830,7 @@ typedef struct {
#define FUNCTIONP(OBJ) \
((CONSP (OBJ) && EQ (XCAR (OBJ), Qlambda)) \
|| (SYMBOLP (OBJ) && !NILP (Ffboundp (OBJ))) \
- || FUNVECP (OBJ) \
+ || COMPILEDP (OBJ) \
|| SUBRP (OBJ))
/* defsubr (Sname);
@@ -2725,7 +2704,6 @@ EXFUN (Fmake_list, 2);
extern Lisp_Object allocate_misc (void);
EXFUN (Fmake_vector, 2);
EXFUN (Fvector, MANY);
-EXFUN (Ffunvec, MANY);
EXFUN (Fmake_symbol, 1);
EXFUN (Fmake_marker, 0);
EXFUN (Fmake_string, 2);
@@ -2745,7 +2723,6 @@ extern Lisp_Object make_pure_c_string (const char *data);
extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object);
extern Lisp_Object make_pure_vector (EMACS_INT);
EXFUN (Fgarbage_collect, 0);
-extern Lisp_Object make_funvec (Lisp_Object, int, int, Lisp_Object *);
EXFUN (Fmake_byte_code, MANY);
EXFUN (Fmake_bool_vector, 2);
extern Lisp_Object Qchar_table_extra_slots;
diff --git a/src/lread.c b/src/lread.c
index b30a75b67c3..77b397a03df 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2497,8 +2497,14 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
invalid_syntax ("#&...", 5);
}
if (c == '[')
- /* `function vector' objects, including byte-compiled functions. */
- return read_vector (readcharfun, 1);
+ {
+ /* Accept compiled functions at read-time so that we don't have to
+ build them using function calls. */
+ Lisp_Object tmp;
+ tmp = read_vector (readcharfun, 1);
+ return Fmake_byte_code (XVECTOR (tmp)->size,
+ XVECTOR (tmp)->contents);
+ }
if (c == '(')
{
Lisp_Object tmp;
@@ -3311,7 +3317,7 @@ isfloat_string (const char *cp, int ignore_trailing)
static Lisp_Object
-read_vector (Lisp_Object readcharfun, int read_funvec)
+read_vector (Lisp_Object readcharfun, int bytecodeflag)
{
register int i;
register int size;
@@ -3319,11 +3325,6 @@ read_vector (Lisp_Object readcharfun, int read_funvec)
register Lisp_Object tem, item, vector;
register struct Lisp_Cons *otem;
Lisp_Object len;
- /* If we're reading a funvec object we start out assuming it's also a
- byte-code object (a subset of funvecs), so we can do any special
- processing needed. If it's just an ordinary funvec object, we'll
- realize that as soon as we've read the first element. */
- int read_bytecode = read_funvec;
tem = read_list (1, readcharfun);
len = Flength (tem);
@@ -3335,18 +3336,11 @@ read_vector (Lisp_Object readcharfun, int read_funvec)
{
item = Fcar (tem);
- /* If READ_BYTECODE is set, check whether this is really a byte-code
- object, or just an ordinary `funvec' object -- non-byte-code
- funvec objects use the same reader syntax. We can tell from the
- first element which one it is. */
- if (read_bytecode && i == 0 && ! FUNVEC_COMPILED_TAG_P (item))
- read_bytecode = 0; /* Nope. */
-
/* If `load-force-doc-strings' is t when reading a lazily-loaded
bytecode object, the docstring containing the bytecode and
constants values must be treated as unibyte and passed to
Fread, to get the actual bytecode string and constants vector. */
- if (read_bytecode && load_force_doc_strings)
+ if (bytecodeflag && load_force_doc_strings)
{
if (i == COMPILED_BYTECODE)
{
@@ -3400,13 +3394,6 @@ read_vector (Lisp_Object readcharfun, int read_funvec)
free_cons (otem);
}
- if (read_bytecode && size >= 4)
- /* Convert this vector to a bytecode object. */
- vector = Fmake_byte_code (size, XVECTOR (vector)->contents);
- else if (read_funvec && size >= 1)
- /* Convert this vector to an ordinary funvec object. */
- XSETFUNVEC (vector, XVECTOR (vector));
-
return vector;
}
diff --git a/src/print.c b/src/print.c
index 11bce153ffc..00847d67318 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1155,7 +1155,7 @@ print_preprocess (Lisp_Object obj)
loop:
if (STRINGP (obj) || CONSP (obj) || VECTORP (obj)
- || FUNVECP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj)
+ || COMPILEDP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj)
|| HASH_TABLE_P (obj)
|| (! NILP (Vprint_gensym)
&& SYMBOLP (obj)
@@ -1337,7 +1337,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
/* Detect circularities and truncate them. */
if (STRINGP (obj) || CONSP (obj) || VECTORP (obj)
- || FUNVECP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj)
+ || COMPILEDP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj)
|| HASH_TABLE_P (obj)
|| (! NILP (Vprint_gensym)
&& SYMBOLP (obj)
@@ -1960,7 +1960,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
else
{
EMACS_INT size = XVECTOR (obj)->size;
- if (FUNVECP (obj))
+ if (COMPILEDP (obj))
{
PRINTCHAR ('#');
size &= PSEUDOVECTOR_SIZE_MASK;