aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2011-02-24 22:27:45 -0500
committerStefan Monnier2011-02-24 22:27:45 -0500
commit876c194cbac17a6220dbf406b0a602325978011c (patch)
treef76a686c53e547a24039d9de2deaf68598e75518 /src
parentcb9336bd977d3345b86234c36d45228f7fb27eec (diff)
downloademacs-876c194cbac17a6220dbf406b0a602325978011c.tar.gz
emacs-876c194cbac17a6220dbf406b0a602325978011c.zip
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 @@
12011-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * eval.c (Qcurry): Remove.
4 (funcall_funvec): Remove.
5 (funcall_lambda): Move new byte-code handling to reduce impact.
6 Treat all args as lexical in the case of lexbind.
7 (Fcurry): Remove.
8 * data.c (Qfunction_vector): Remove.
9 (Ffunvecp): Remove.
10 * lread.c (read1): Revert to calling make_byte_code here.
11 (read_vector): Don't call make_byte_code any more.
12 * lisp.h (enum pvec_type): Rename back to PVEC_COMPILED.
13 (XSETCOMPILED): Rename back from XSETFUNVEC.
14 (FUNVEC_SIZE): Remove.
15 (FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): Remove.
16 (COMPILEDP): Rename back from FUNVECP.
17 * fns.c (Felt): Remove unexplained FUNVEC check.
18 * doc.c (Fdocumentation): Don't handle funvec.
19 * alloc.c (make_funvec, Ffunvec): Remove.
20
12011-02-21 Stefan Monnier <monnier@iro.umontreal.ca> 212011-02-21 Stefan Monnier <monnier@iro.umontreal.ca>
2 22
3 * bytecode.c (exec_byte_code): Change stack_ref and stack_set to use 23 * bytecode.c (exec_byte_code): Change stack_ref and stack_set to use
@@ -113,6 +133,42 @@
113 133
114 Merge funvec patch. 134 Merge funvec patch.
115 135
1362004-05-20 Miles Bader <miles@gnu.org>
137
138 * lisp.h: Declare make_funvec and Ffunvec.
139 (enum pvec_type): Rename `PVEC_COMPILED' to `PVEC_FUNVEC'.
140 (XSETFUNVEC): Rename from `XSETCOMPILED'.
141 (FUNVEC_SIZE, FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): New macros.
142 (COMPILEDP): Define in terms of funvec macros.
143 (FUNVECP, GC_FUNVECP): Rename from `COMPILEDP' & `GC_COMPILEDP'.
144 (FUNCTIONP): Use FUNVECP instead of COMPILEDP.
145 * alloc.c (make_funvec, funvec): New functions.
146 (Fmake_byte_code): Make sure the first element is a list.
147
148 * eval.c (Qcurry): New variable.
149 (funcall_funvec, Fcurry): New functions.
150 (syms_of_eval): Initialize them.
151 (funcall_lambda): Handle non-bytecode funvec objects by calling
152 funcall_funvec.
153 (Ffuncall, Feval): Use FUNVECP insetad of COMPILEDP.
154 * lread.c (read1): Return result of read_vector for `#[' syntax
155 directly; read_vector now does any extra work required.
156 (read_vector): Handle both funvec and byte-code objects, converting the
157 type as necessary. `bytecodeflag' argument is now called
158 `read_funvec'.
159 * data.c (Ffunvecp): New function.
160 * doc.c (Fdocumentation): Return nil for unknown funvecs.
161 * fns.c (mapcar1, Felt, concat): Allow funvecs.
162
163 * eval.c (Ffunctionp): Use `funvec' operators instead of `compiled'
164 operators.
165 * alloc.c (Fmake_byte_code, Fpurecopy, mark_object): Likewise.
166 * keyboard.c (Fcommand_execute): Likewise.
167 * image.c (parse_image_spec): Likewise.
168 * fns.c (Flength, concat, internal_equal): Likewise.
169 * data.c (Faref, Ftype_of): Likewise.
170 * print.c (print_preprocess, print_object): Likewise.
171
1162004-04-10 Miles Bader <miles@gnu.org> 1722004-04-10 Miles Bader <miles@gnu.org>
117 173
118 * eval.c (Fspecialp): New function. 174 * 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 @@
12004-05-20 Miles Bader <miles@gnu.org>
2
3 * lisp.h: Declare make_funvec and Ffunvec.
4 (enum pvec_type): Rename `PVEC_COMPILED' to `PVEC_FUNVEC'.
5 (XSETFUNVEC): Renamed from `XSETCOMPILED'.
6 (FUNVEC_SIZE, FUNVEC_COMPILED_TAG_P, FUNVEC_COMPILED_P): New macros.
7 (COMPILEDP): Define in terms of funvec macros.
8 (FUNVECP, GC_FUNVECP): Renamed from `COMPILEDP' & `GC_COMPILEDP'.
9 (FUNCTIONP): Use FUNVECP instead of COMPILEDP.
10 * alloc.c (make_funvec, funvec): New functions.
11 (Fmake_byte_code): Make sure the first element is a list.
12
13 * eval.c (Qcurry): New variable.
14 (funcall_funvec, Fcurry): New functions.
15 (syms_of_eval): Initialize them.
16 (funcall_lambda): Handle non-bytecode funvec objects by calling
17 funcall_funvec.
18 (Ffuncall, Feval): Use FUNVECP insetad of COMPILEDP.
19 * lread.c (read1): Return result of read_vector for `#[' syntax
20 directly; read_vector now does any extra work required.
21 (read_vector): Handle both funvec and byte-code objects, converting the
22 type as necessary. `bytecodeflag' argument is now called
23 `read_funvec'.
24 * data.c (Ffunvecp): New function.
25 * doc.c (Fdocumentation): Return nil for unknown funvecs.
26 * fns.c (mapcar1, Felt, concat): Allow funvecs.
27
28 * eval.c (Ffunctionp): Use `funvec' operators instead of `compiled'
29 operators.
30 * alloc.c (Fmake_byte_code, Fpurecopy, mark_object): Likewise.
31 * keyboard.c (Fcommand_execute): Likewise.
32 * image.c (parse_image_spec): Likewise.
33 * fns.c (Flength, concat, internal_equal): Likewise.
34 * data.c (Faref, Ftype_of): Likewise.
35 * print.c (print_preprocess, print_object): Likewise.
36
37;; 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'. */)
2924} 2924}
2925 2925
2926 2926
2927/* Return a new `function vector' containing KIND as the first element,
2928 followed by NUM_NIL_SLOTS nil elements, and further elements copied from
2929 the vector PARAMS of length NUM_PARAMS (so the total length of the
2930 resulting vector is 1 + NUM_NIL_SLOTS + NUM_PARAMS).
2931
2932 If NUM_PARAMS is zero, then PARAMS may be NULL.
2933
2934 A `function vector', a.k.a. `funvec', is a funcallable vector in Emacs Lisp.
2935 See the function `funvec' for more detail. */
2936
2937Lisp_Object
2938make_funvec (Lisp_Object kind, int num_nil_slots, int num_params,
2939 Lisp_Object *params)
2940{
2941 int param_index;
2942 Lisp_Object funvec;
2943
2944 funvec = Fmake_vector (make_number (1 + num_nil_slots + num_params), Qnil);
2945
2946 ASET (funvec, 0, kind);
2947
2948 for (param_index = 0; param_index < num_params; param_index++)
2949 ASET (funvec, 1 + num_nil_slots + param_index, params[param_index]);
2950
2951 XSETPVECTYPE (XVECTOR (funvec), PVEC_FUNVEC);
2952 XSETFUNVEC (funvec, XVECTOR (funvec));
2953
2954 return funvec;
2955}
2956
2957
2958DEFUN ("vector", Fvector, Svector, 0, MANY, 0, 2927DEFUN ("vector", Fvector, Svector, 0, MANY, 0,
2959 doc: /* Return a newly created vector with specified arguments as elements. 2928 doc: /* Return a newly created vector with specified arguments as elements.
2960Any number of arguments, even zero arguments, are allowed. 2929Any number of arguments, even zero arguments, are allowed.
@@ -2974,27 +2943,6 @@ usage: (vector &rest OBJECTS) */)
2974} 2943}
2975 2944
2976 2945
2977DEFUN ("funvec", Ffunvec, Sfunvec, 1, MANY, 0,
2978 doc: /* Return a newly created `function vector' of type KIND.
2979A `function vector', a.k.a. `funvec', is a funcallable vector in Emacs Lisp.
2980KIND indicates the kind of funvec, and determines its behavior when called.
2981The meaning of the remaining arguments depends on KIND. Currently
2982implemented values of KIND, and their meaning, are:
2983
2984 A list -- A byte-compiled function. See `make-byte-code' for the usual
2985 way to create byte-compiled functions.
2986
2987 `curry' -- A curried function. Remaining arguments are a function to
2988 call, and arguments to prepend to user arguments at the
2989 time of the call; see the `curry' function.
2990
2991usage: (funvec KIND &rest PARAMS) */)
2992 (int nargs, Lisp_Object *args)
2993{
2994 return make_funvec (args[0], 0, nargs - 1, args + 1);
2995}
2996
2997
2998DEFUN ("make-byte-code", Fmake_byte_code, Smake_byte_code, 4, MANY, 0, 2946DEFUN ("make-byte-code", Fmake_byte_code, Smake_byte_code, 4, MANY, 0,
2999 doc: /* Create a byte-code object with specified arguments as elements. 2947 doc: /* Create a byte-code object with specified arguments as elements.
3000The arguments should be the arglist, bytecode-string, constant vector, 2948The 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
3008 register int index; 2956 register int index;
3009 register struct Lisp_Vector *p; 2957 register struct Lisp_Vector *p;
3010 2958
3011 /* Make sure the arg-list is really a list, as that's what's used to
3012 distinguish a byte-compiled object from other funvecs. */
3013 CHECK_LIST (args[0]);
3014
3015 XSETFASTINT (len, nargs); 2959 XSETFASTINT (len, nargs);
3016 if (!NILP (Vpurify_flag)) 2960 if (!NILP (Vpurify_flag))
3017 val = make_pure_vector ((EMACS_INT) nargs); 2961 val = make_pure_vector ((EMACS_INT) nargs);
@@ -3033,8 +2977,8 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
3033 args[index] = Fpurecopy (args[index]); 2977 args[index] = Fpurecopy (args[index]);
3034 p->contents[index] = args[index]; 2978 p->contents[index] = args[index];
3035 } 2979 }
3036 XSETPVECTYPE (p, PVEC_FUNVEC); 2980 XSETPVECTYPE (p, PVEC_COMPILED);
3037 XSETFUNVEC (val, p); 2981 XSETCOMPILED (val, p);
3038 return val; 2982 return val;
3039} 2983}
3040 2984
@@ -4817,7 +4761,7 @@ Does not copy symbols. Copies strings without text properties. */)
4817 obj = make_pure_string (SSDATA (obj), SCHARS (obj), 4761 obj = make_pure_string (SSDATA (obj), SCHARS (obj),
4818 SBYTES (obj), 4762 SBYTES (obj),
4819 STRING_MULTIBYTE (obj)); 4763 STRING_MULTIBYTE (obj));
4820 else if (FUNVECP (obj) || VECTORP (obj)) 4764 else if (COMPILEDP (obj) || VECTORP (obj))
4821 { 4765 {
4822 register struct Lisp_Vector *vec; 4766 register struct Lisp_Vector *vec;
4823 register EMACS_INT i; 4767 register EMACS_INT i;
@@ -4829,10 +4773,10 @@ Does not copy symbols. Copies strings without text properties. */)
4829 vec = XVECTOR (make_pure_vector (size)); 4773 vec = XVECTOR (make_pure_vector (size));
4830 for (i = 0; i < size; i++) 4774 for (i = 0; i < size; i++)
4831 vec->contents[i] = Fpurecopy (XVECTOR (obj)->contents[i]); 4775 vec->contents[i] = Fpurecopy (XVECTOR (obj)->contents[i]);
4832 if (FUNVECP (obj)) 4776 if (COMPILEDP (obj))
4833 { 4777 {
4834 XSETPVECTYPE (vec, PVEC_FUNVEC); 4778 XSETPVECTYPE (vec, PVEC_COMPILED);
4835 XSETFUNVEC (obj, vec); 4779 XSETCOMPILED (obj, vec);
4836 } 4780 }
4837 else 4781 else
4838 XSETVECTOR (obj, vec); 4782 XSETVECTOR (obj, vec);
@@ -5418,7 +5362,7 @@ mark_object (Lisp_Object arg)
5418 } 5362 }
5419 else if (SUBRP (obj)) 5363 else if (SUBRP (obj))
5420 break; 5364 break;
5421 else if (FUNVECP (obj) && FUNVEC_COMPILED_P (obj)) 5365 else if (COMPILEDP (obj))
5422 /* We could treat this just like a vector, but it is better to 5366 /* We could treat this just like a vector, but it is better to
5423 save the COMPILED_CONSTANTS element for last and avoid 5367 save the COMPILED_CONSTANTS element for last and avoid
5424 recursion there. */ 5368 recursion there. */
@@ -6320,7 +6264,6 @@ The time is in seconds as a floating point value. */);
6320 defsubr (&Scons); 6264 defsubr (&Scons);
6321 defsubr (&Slist); 6265 defsubr (&Slist);
6322 defsubr (&Svector); 6266 defsubr (&Svector);
6323 defsubr (&Sfunvec);
6324 defsubr (&Smake_byte_code); 6267 defsubr (&Smake_byte_code);
6325 defsubr (&Smake_list); 6268 defsubr (&Smake_list);
6326 defsubr (&Smake_vector); 6269 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:
51 * 51 *
52 * define BYTE_CODE_METER to enable generation of a byte-op usage histogram. 52 * define BYTE_CODE_METER to enable generation of a byte-op usage histogram.
53 */ 53 */
54/* #define BYTE_CODE_SAFE 1 */ 54/* #define BYTE_CODE_SAFE */
55/* #define BYTE_CODE_METER */ 55/* #define BYTE_CODE_METER */
56 56
57 57
@@ -1720,8 +1720,13 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1720 break; 1720 break;
1721#endif 1721#endif
1722 1722
1723 case 0:
1724 /* Actually this is Bstack_ref with offset 0, but we use Bdup
1725 for that instead. */
1726 /* case Bstack_ref: */
1727 abort ();
1728
1723 /* Handy byte-codes for lexical binding. */ 1729 /* Handy byte-codes for lexical binding. */
1724 /* case Bstack_ref: */ /* Use `dup' instead. */
1725 case Bstack_ref+1: 1730 case Bstack_ref+1:
1726 case Bstack_ref+2: 1731 case Bstack_ref+2:
1727 case Bstack_ref+3: 1732 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;
84Lisp_Object Qwindow; 84Lisp_Object Qwindow;
85static Lisp_Object Qfloat, Qwindow_configuration; 85static Lisp_Object Qfloat, Qwindow_configuration;
86Lisp_Object Qprocess; 86Lisp_Object Qprocess;
87static Lisp_Object Qcompiled_function, Qfunction_vector, Qbuffer, Qframe, Qvector; 87static Lisp_Object Qcompiled_function, Qbuffer, Qframe, Qvector;
88static Lisp_Object Qchar_table, Qbool_vector, Qhash_table; 88static Lisp_Object Qchar_table, Qbool_vector, Qhash_table;
89static Lisp_Object Qsubrp, Qmany, Qunevalled; 89static Lisp_Object Qsubrp, Qmany, Qunevalled;
90Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; 90Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
@@ -194,11 +194,8 @@ for example, (type-of 1) returns `integer'. */)
194 return Qwindow; 194 return Qwindow;
195 if (SUBRP (object)) 195 if (SUBRP (object))
196 return Qsubr; 196 return Qsubr;
197 if (FUNVECP (object)) 197 if (COMPILEDP (object))
198 if (FUNVEC_COMPILED_P (object)) 198 return Qcompiled_function;
199 return Qcompiled_function;
200 else
201 return Qfunction_vector;
202 if (BUFFERP (object)) 199 if (BUFFERP (object))
203 return Qbuffer; 200 return Qbuffer;
204 if (CHAR_TABLE_P (object)) 201 if (CHAR_TABLE_P (object))
@@ -397,13 +394,6 @@ DEFUN ("byte-code-function-p", Fbyte_code_function_p, Sbyte_code_function_p,
397 return Qnil; 394 return Qnil;
398} 395}
399 396
400DEFUN ("funvecp", Ffunvecp, Sfunvecp, 1, 1, 0,
401 doc: /* Return t if OBJECT is a `function vector' object. */)
402 (Lisp_Object object)
403{
404 return FUNVECP (object) ? Qt : Qnil;
405}
406
407DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0, 397DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0,
408 doc: /* Return t if OBJECT is a character or a string. */) 398 doc: /* Return t if OBJECT is a character or a string. */)
409 (register Lisp_Object object) 399 (register Lisp_Object object)
@@ -2113,9 +2103,9 @@ or a byte-code object. IDX starts at 0. */)
2113 { 2103 {
2114 int size = 0; 2104 int size = 0;
2115 if (VECTORP (array)) 2105 if (VECTORP (array))
2116 size = ASIZE (array); 2106 size = XVECTOR (array)->size;
2117 else if (FUNVECP (array)) 2107 else if (COMPILEDP (array))
2118 size = FUNVEC_SIZE (array); 2108 size = XVECTOR (array)->size & PSEUDOVECTOR_SIZE_MASK;
2119 else 2109 else
2120 wrong_type_argument (Qarrayp, array); 2110 wrong_type_argument (Qarrayp, array);
2121 2111
@@ -3180,7 +3170,6 @@ syms_of_data (void)
3180 Qwindow = intern_c_string ("window"); 3170 Qwindow = intern_c_string ("window");
3181 /* Qsubr = intern_c_string ("subr"); */ 3171 /* Qsubr = intern_c_string ("subr"); */
3182 Qcompiled_function = intern_c_string ("compiled-function"); 3172 Qcompiled_function = intern_c_string ("compiled-function");
3183 Qfunction_vector = intern_c_string ("function-vector");
3184 Qbuffer = intern_c_string ("buffer"); 3173 Qbuffer = intern_c_string ("buffer");
3185 Qframe = intern_c_string ("frame"); 3174 Qframe = intern_c_string ("frame");
3186 Qvector = intern_c_string ("vector"); 3175 Qvector = intern_c_string ("vector");
@@ -3206,7 +3195,6 @@ syms_of_data (void)
3206 staticpro (&Qwindow); 3195 staticpro (&Qwindow);
3207 /* staticpro (&Qsubr); */ 3196 /* staticpro (&Qsubr); */
3208 staticpro (&Qcompiled_function); 3197 staticpro (&Qcompiled_function);
3209 staticpro (&Qfunction_vector);
3210 staticpro (&Qbuffer); 3198 staticpro (&Qbuffer);
3211 staticpro (&Qframe); 3199 staticpro (&Qframe);
3212 staticpro (&Qvector); 3200 staticpro (&Qvector);
@@ -3243,7 +3231,6 @@ syms_of_data (void)
3243 defsubr (&Smarkerp); 3231 defsubr (&Smarkerp);
3244 defsubr (&Ssubrp); 3232 defsubr (&Ssubrp);
3245 defsubr (&Sbyte_code_function_p); 3233 defsubr (&Sbyte_code_function_p);
3246 defsubr (&Sfunvecp);
3247 defsubr (&Schar_or_string_p); 3234 defsubr (&Schar_or_string_p);
3248 defsubr (&Scar); 3235 defsubr (&Scar);
3249 defsubr (&Scdr); 3236 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'. */)
357 else 357 else
358 return Qnil; 358 return Qnil;
359 } 359 }
360 else if (FUNVECP (fun))
361 {
362 /* Unless otherwise handled, funvecs have no documentation. */
363 return Qnil;
364 }
365 else if (STRINGP (fun) || VECTORP (fun)) 360 else if (STRINGP (fun) || VECTORP (fun))
366 { 361 {
367 return build_string ("Keyboard macro."); 362 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;
60Lisp_Object Qand_rest, Qand_optional; 60Lisp_Object Qand_rest, Qand_optional;
61Lisp_Object Qdebug_on_error; 61Lisp_Object Qdebug_on_error;
62Lisp_Object Qdeclare; 62Lisp_Object Qdeclare;
63Lisp_Object Qcurry;
64Lisp_Object Qinternal_interpreter_environment, Qclosure; 63Lisp_Object Qinternal_interpreter_environment, Qclosure;
65 64
66Lisp_Object Qdebug; 65Lisp_Object Qdebug;
@@ -2405,7 +2404,7 @@ eval_sub (Lisp_Object form)
2405 } 2404 }
2406 } 2405 }
2407 } 2406 }
2408 else if (FUNVECP (fun)) 2407 else if (COMPILEDP (fun))
2409 val = apply_lambda (fun, original_args); 2408 val = apply_lambda (fun, original_args);
2410 else 2409 else
2411 { 2410 {
@@ -2890,7 +2889,7 @@ DEFUN ("functionp", Ffunctionp, Sfunctionp, 1, 1, 0,
2890 2889
2891 if (SUBRP (object)) 2890 if (SUBRP (object))
2892 return (XSUBR (object)->max_args != UNEVALLED) ? Qt : Qnil; 2891 return (XSUBR (object)->max_args != UNEVALLED) ? Qt : Qnil;
2893 else if (FUNVECP (object)) 2892 else if (COMPILEDP (object))
2894 return Qt; 2893 return Qt;
2895 else if (CONSP (object)) 2894 else if (CONSP (object))
2896 { 2895 {
@@ -3034,7 +3033,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
3034 } 3033 }
3035 } 3034 }
3036 } 3035 }
3037 else if (FUNVECP (fun)) 3036 else if (COMPILEDP (fun))
3038 val = funcall_lambda (fun, numargs, args + 1); 3037 val = funcall_lambda (fun, numargs, args + 1);
3039 else 3038 else
3040 { 3039 {
@@ -3107,54 +3106,6 @@ apply_lambda (Lisp_Object fun, Lisp_Object args)
3107 return tem; 3106 return tem;
3108} 3107}
3109 3108
3110
3111/* Call a non-bytecode funvec object FUN, on the argments in ARGS (of
3112 length NARGS). */
3113
3114static Lisp_Object
3115funcall_funvec (Lisp_Object fun, int nargs, Lisp_Object *args)
3116{
3117 int size = FUNVEC_SIZE (fun);
3118 Lisp_Object tag = (size > 0 ? AREF (fun, 0) : Qnil);
3119
3120 if (EQ (tag, Qcurry))
3121 {
3122 /* A curried function is a way to attach arguments to a another
3123 function. The first element of the vector is the identifier
3124 `curry', the second is the wrapped function, and remaining
3125 elements are the attached arguments. */
3126 int num_curried_args = size - 2;
3127 /* Offset of the curried and user args in the final arglist. Curried
3128 args are first in the new arg vector, after the function. User
3129 args follow. */
3130 int curried_args_offs = 1;
3131 int user_args_offs = curried_args_offs + num_curried_args;
3132 /* The curried function and arguments. */
3133 Lisp_Object *curry_params = XVECTOR (fun)->contents + 1;
3134 /* The arguments in the curry vector. */
3135 Lisp_Object *curried_args = curry_params + 1;
3136 /* The number of arguments with which we'll call funcall, and the
3137 arguments themselves. */
3138 int num_funcall_args = 1 + num_curried_args + nargs;
3139 Lisp_Object *funcall_args
3140 = (Lisp_Object *) alloca (num_funcall_args * sizeof (Lisp_Object));
3141
3142 /* First comes the real function. */
3143 funcall_args[0] = curry_params[0];
3144
3145 /* Then the arguments in the appropriate order. */
3146 memcpy (funcall_args + curried_args_offs, curried_args,
3147 num_curried_args * sizeof (Lisp_Object));
3148 memcpy (funcall_args + user_args_offs, args,
3149 nargs * sizeof (Lisp_Object));
3150
3151 return Ffuncall (num_funcall_args, funcall_args);
3152 }
3153 else
3154 xsignal1 (Qinvalid_function, fun);
3155}
3156
3157
3158/* Apply a Lisp function FUN to the NARGS evaluated arguments in ARG_VECTOR 3109/* Apply a Lisp function FUN to the NARGS evaluated arguments in ARG_VECTOR
3159 and return the result of evaluation. 3110 and return the result of evaluation.
3160 FUN must be either a lambda-expression or a compiled-code object. */ 3111 FUN must be either a lambda-expression or a compiled-code object. */
@@ -3167,34 +3118,6 @@ funcall_lambda (Lisp_Object fun, int nargs,
3167 int count = SPECPDL_INDEX (); 3118 int count = SPECPDL_INDEX ();
3168 int i, optional, rest; 3119 int i, optional, rest;
3169 3120
3170 if (COMPILEDP (fun)
3171 && FUNVEC_SIZE (fun) > COMPILED_PUSH_ARGS
3172 && ! NILP (XVECTOR (fun)->contents[COMPILED_PUSH_ARGS]))
3173 /* A byte-code object with a non-nil `push args' slot means we
3174 shouldn't bind any arguments, instead just call the byte-code
3175 interpreter directly; it will push arguments as necessary.
3176
3177 Byte-code objects with either a non-existant, or a nil value for
3178 the `push args' slot (the default), have dynamically-bound
3179 arguments, and use the argument-binding code below instead (as do
3180 all interpreted functions, even lexically bound ones). */
3181 {
3182 /* If we have not actually read the bytecode string
3183 and constants vector yet, fetch them from the file. */
3184 if (CONSP (AREF (fun, COMPILED_BYTECODE)))
3185 Ffetch_bytecode (fun);
3186 return exec_byte_code (AREF (fun, COMPILED_BYTECODE),
3187 AREF (fun, COMPILED_CONSTANTS),
3188 AREF (fun, COMPILED_STACK_DEPTH),
3189 AREF (fun, COMPILED_ARGLIST),
3190 nargs, arg_vector);
3191 }
3192
3193 if (FUNVECP (fun) && !FUNVEC_COMPILED_P (fun))
3194 /* Byte-compiled functions are handled directly below, but we
3195 call other funvec types via funcall_funvec. */
3196 return funcall_funvec (fun, nargs, arg_vector);
3197
3198 if (CONSP (fun)) 3121 if (CONSP (fun))
3199 { 3122 {
3200 if (EQ (XCAR (fun), Qclosure)) 3123 if (EQ (XCAR (fun), Qclosure))
@@ -3213,6 +3136,27 @@ funcall_lambda (Lisp_Object fun, int nargs,
3213 } 3136 }
3214 else if (COMPILEDP (fun)) 3137 else if (COMPILEDP (fun))
3215 { 3138 {
3139 if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_PUSH_ARGS
3140 && ! NILP (XVECTOR (fun)->contents[COMPILED_PUSH_ARGS]))
3141 /* A byte-code object with a non-nil `push args' slot means we
3142 shouldn't bind any arguments, instead just call the byte-code
3143 interpreter directly; it will push arguments as necessary.
3144
3145 Byte-code objects with either a non-existant, or a nil value for
3146 the `push args' slot (the default), have dynamically-bound
3147 arguments, and use the argument-binding code below instead (as do
3148 all interpreted functions, even lexically bound ones). */
3149 {
3150 /* If we have not actually read the bytecode string
3151 and constants vector yet, fetch them from the file. */
3152 if (CONSP (AREF (fun, COMPILED_BYTECODE)))
3153 Ffetch_bytecode (fun);
3154 return exec_byte_code (AREF (fun, COMPILED_BYTECODE),
3155 AREF (fun, COMPILED_CONSTANTS),
3156 AREF (fun, COMPILED_STACK_DEPTH),
3157 AREF (fun, COMPILED_ARGLIST),
3158 nargs, arg_vector);
3159 }
3216 syms_left = AREF (fun, COMPILED_ARGLIST); 3160 syms_left = AREF (fun, COMPILED_ARGLIST);
3217 lexenv = Qnil; 3161 lexenv = Qnil;
3218 } 3162 }
@@ -3248,11 +3192,7 @@ funcall_lambda (Lisp_Object fun, int nargs,
3248 val = Qnil; 3192 val = Qnil;
3249 3193
3250 /* Bind the argument. */ 3194 /* Bind the argument. */
3251 if (!NILP (lexenv) && SYMBOLP (next) 3195 if (!NILP (lexenv) && SYMBOLP (next))
3252 /* FIXME: there's no good reason to allow dynamic-scoping
3253 on function arguments, other than consistency with let. */
3254 && !XSYMBOL (next)->declared_special
3255 && NILP (Fmemq (next, Vinternal_interpreter_environment)))
3256 /* Lexically bind NEXT by adding it to the lexenv alist. */ 3196 /* Lexically bind NEXT by adding it to the lexenv alist. */
3257 lexenv = Fcons (Fcons (next, val), lexenv); 3197 lexenv = Fcons (Fcons (next, val), lexenv);
3258 else 3198 else
@@ -3532,24 +3472,6 @@ context where binding is lexical by default. */)
3532 3472
3533 3473
3534 3474
3535DEFUN ("curry", Fcurry, Scurry, 1, MANY, 0,
3536 doc: /* Return FUN curried with ARGS.
3537The result is a function-like object that will append any arguments it
3538is called with to ARGS, and call FUN with the resulting list of arguments.
3539
3540For instance:
3541 (funcall (curry '+ 3 4 5) 2) is the same as (funcall '+ 3 4 5 2)
3542and:
3543 (mapcar (curry 'concat "The ") '("a" "b" "c"))
3544 => ("The a" "The b" "The c")
3545
3546usage: (curry FUN &rest ARGS) */)
3547 (int nargs, Lisp_Object *args)
3548{
3549 return make_funvec (Qcurry, 0, nargs, args);
3550}
3551
3552
3553DEFUN ("backtrace-debug", Fbacktrace_debug, Sbacktrace_debug, 2, 2, 0, 3475DEFUN ("backtrace-debug", Fbacktrace_debug, Sbacktrace_debug, 2, 2, 0,
3554 doc: /* Set the debug-on-exit flag of eval frame LEVEL levels down to FLAG. 3476 doc: /* Set the debug-on-exit flag of eval frame LEVEL levels down to FLAG.
3555The debugger is entered when that frame exits, if the flag is non-nil. */) 3477The debugger is entered when that frame exits, if the flag is non-nil. */)
@@ -3764,9 +3686,6 @@ before making `inhibit-quit' nil. */);
3764 Qclosure = intern_c_string ("closure"); 3686 Qclosure = intern_c_string ("closure");
3765 staticpro (&Qclosure); 3687 staticpro (&Qclosure);
3766 3688
3767 Qcurry = intern_c_string ("curry");
3768 staticpro (&Qcurry);
3769
3770 Qdebug = intern_c_string ("debug"); 3689 Qdebug = intern_c_string ("debug");
3771 staticpro (&Qdebug); 3690 staticpro (&Qdebug);
3772 3691
@@ -3901,11 +3820,9 @@ alist of active lexical bindings. */);
3901 defsubr (&Srun_hook_with_args_until_success); 3820 defsubr (&Srun_hook_with_args_until_success);
3902 defsubr (&Srun_hook_with_args_until_failure); 3821 defsubr (&Srun_hook_with_args_until_failure);
3903 defsubr (&Sfetch_bytecode); 3822 defsubr (&Sfetch_bytecode);
3904 defsubr (&Scurry);
3905 defsubr (&Sbacktrace_debug); 3823 defsubr (&Sbacktrace_debug);
3906 defsubr (&Sbacktrace); 3824 defsubr (&Sbacktrace);
3907 defsubr (&Sbacktrace_frame); 3825 defsubr (&Sbacktrace_frame);
3908 defsubr (&Scurry);
3909 defsubr (&Sspecial_variable_p); 3826 defsubr (&Sspecial_variable_p);
3910 defsubr (&Sfunctionp); 3827 defsubr (&Sfunctionp);
3911} 3828}
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'. */)
127 XSETFASTINT (val, MAX_CHAR); 127 XSETFASTINT (val, MAX_CHAR);
128 else if (BOOL_VECTOR_P (sequence)) 128 else if (BOOL_VECTOR_P (sequence))
129 XSETFASTINT (val, XBOOL_VECTOR (sequence)->size); 129 XSETFASTINT (val, XBOOL_VECTOR (sequence)->size);
130 else if (FUNVECP (sequence)) 130 else if (COMPILEDP (sequence))
131 XSETFASTINT (val, FUNVEC_SIZE (sequence)); 131 XSETFASTINT (val, ASIZE (sequence) & PSEUDOVECTOR_SIZE_MASK);
132 else if (CONSP (sequence)) 132 else if (CONSP (sequence))
133 { 133 {
134 i = 0; 134 i = 0;
@@ -488,7 +488,7 @@ concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_speci
488 { 488 {
489 this = args[argnum]; 489 this = args[argnum];
490 if (!(CONSP (this) || NILP (this) || VECTORP (this) || STRINGP (this) 490 if (!(CONSP (this) || NILP (this) || VECTORP (this) || STRINGP (this)
491 || FUNVECP (this) || BOOL_VECTOR_P (this))) 491 || COMPILEDP (this) || BOOL_VECTOR_P (this)))
492 wrong_type_argument (Qsequencep, this); 492 wrong_type_argument (Qsequencep, this);
493 } 493 }
494 494
@@ -512,7 +512,7 @@ concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_speci
512 Lisp_Object ch; 512 Lisp_Object ch;
513 EMACS_INT this_len_byte; 513 EMACS_INT this_len_byte;
514 514
515 if (VECTORP (this) || FUNVECP (this)) 515 if (VECTORP (this) || COMPILEDP (this))
516 for (i = 0; i < len; i++) 516 for (i = 0; i < len; i++)
517 { 517 {
518 ch = AREF (this, i); 518 ch = AREF (this, i);
@@ -1311,9 +1311,7 @@ DEFUN ("elt", Felt, Selt, 2, 2, 0,
1311 return Fcar (Fnthcdr (n, sequence)); 1311 return Fcar (Fnthcdr (n, sequence));
1312 1312
1313 /* Faref signals a "not array" error, so check here. */ 1313 /* Faref signals a "not array" error, so check here. */
1314 if (! FUNVECP (sequence)) 1314 CHECK_ARRAY (sequence, Qsequencep);
1315 CHECK_ARRAY (sequence, Qsequencep);
1316
1317 return Faref (sequence, n); 1315 return Faref (sequence, n);
1318} 1316}
1319 1317
@@ -2092,14 +2090,13 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int
2092 if (WINDOW_CONFIGURATIONP (o1)) 2090 if (WINDOW_CONFIGURATIONP (o1))
2093 return compare_window_configurations (o1, o2, 0); 2091 return compare_window_configurations (o1, o2, 0);
2094 2092
2095 /* Aside from them, only true vectors, char-tables, function vectors, 2093 /* Aside from them, only true vectors, char-tables, compiled
2096 and fonts (font-spec, font-entity, font-ojbect) are sensible to 2094 functions, and fonts (font-spec, font-entity, font-ojbect)
2097 compare, so eliminate the others now. */ 2095 are sensible to compare, so eliminate the others now. */
2098 if (size & PSEUDOVECTOR_FLAG) 2096 if (size & PSEUDOVECTOR_FLAG)
2099 { 2097 {
2100 if (!(size & (PVEC_FUNVEC 2098 if (!(size & (PVEC_COMPILED
2101 | PVEC_CHAR_TABLE | PVEC_SUB_CHAR_TABLE 2099 | PVEC_CHAR_TABLE | PVEC_SUB_CHAR_TABLE | PVEC_FONT)))
2102 | PVEC_FONT)))
2103 return 0; 2100 return 0;
2104 size &= PSEUDOVECTOR_SIZE_MASK; 2101 size &= PSEUDOVECTOR_SIZE_MASK;
2105 } 2102 }
@@ -2302,7 +2299,7 @@ mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq)
2302 1) lists are not relocated and 2) the list is marked via `seq' so will not 2299 1) lists are not relocated and 2) the list is marked via `seq' so will not
2303 be freed */ 2300 be freed */
2304 2301
2305 if (VECTORP (seq) || FUNVECP (seq)) 2302 if (VECTORP (seq) || COMPILEDP (seq))
2306 { 2303 {
2307 for (i = 0; i < leni; i++) 2304 for (i = 0; i < leni; i++)
2308 { 2305 {
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,
835 835
836 case IMAGE_FUNCTION_VALUE: 836 case IMAGE_FUNCTION_VALUE:
837 value = indirect_function (value); 837 value = indirect_function (value);
838 /* FIXME: Shouldn't we use Ffunctionp here? */
838 if (SUBRP (value) 839 if (SUBRP (value)
839 || FUNVECP (value) 840 || COMPILEDP (value)
840 || (CONSP (value) && EQ (XCAR (value), Qlambda))) 841 || (CONSP (value) && EQ (XCAR (value), Qlambda)))
841 break; 842 break;
842 return 0; 843 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. */)
10179 return Fexecute_kbd_macro (final, prefixarg, Qnil); 10179 return Fexecute_kbd_macro (final, prefixarg, Qnil);
10180 } 10180 }
10181 10181
10182 if (CONSP (final) || SUBRP (final) || FUNVECP (final)) 10182 if (CONSP (final) || SUBRP (final) || COMPILEDP (final))
10183 /* Don't call Fcall_interactively directly because we want to make 10183 /* Don't call Fcall_interactively directly because we want to make
10184 sure the backtrace has an entry for `call-interactively'. 10184 sure the backtrace has an entry for `call-interactively'.
10185 For the same reason, pass `cmd' rather than `final'. */ 10185 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
349 PVEC_NORMAL_VECTOR = 0, 349 PVEC_NORMAL_VECTOR = 0,
350 PVEC_PROCESS = 0x200, 350 PVEC_PROCESS = 0x200,
351 PVEC_FRAME = 0x400, 351 PVEC_FRAME = 0x400,
352 PVEC_FUNVEC = 0x800, 352 PVEC_COMPILED = 0x800,
353 PVEC_WINDOW = 0x1000, 353 PVEC_WINDOW = 0x1000,
354 PVEC_WINDOW_CONFIGURATION = 0x2000, 354 PVEC_WINDOW_CONFIGURATION = 0x2000,
355 PVEC_SUBR = 0x4000, 355 PVEC_SUBR = 0x4000,
@@ -607,7 +607,7 @@ extern Lisp_Object make_number (EMACS_INT);
607#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW)) 607#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW))
608#define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL)) 608#define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL))
609#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR)) 609#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR))
610#define XSETFUNVEC(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FUNVEC)) 610#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
611#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER)) 611#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
612#define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE)) 612#define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE))
613#define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BOOL_VECTOR)) 613#define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BOOL_VECTOR))
@@ -623,9 +623,6 @@ extern Lisp_Object make_number (EMACS_INT);
623 eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)), \ 623 eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)), \
624 AREF ((ARRAY), (IDX)) = (VAL)) 624 AREF ((ARRAY), (IDX)) = (VAL))
625 625
626/* Return the size of the psuedo-vector object FUNVEC. */
627#define FUNVEC_SIZE(funvec) (ASIZE (funvec) & PSEUDOVECTOR_SIZE_MASK)
628
629/* Convenience macros for dealing with Lisp strings. */ 626/* Convenience macros for dealing with Lisp strings. */
630 627
631#define SDATA(string) (XSTRING (string)->data + 0) 628#define SDATA(string) (XSTRING (string)->data + 0)
@@ -1474,7 +1471,7 @@ struct Lisp_Float
1474typedef unsigned char UCHAR; 1471typedef unsigned char UCHAR;
1475#endif 1472#endif
1476 1473
1477/* Meanings of slots in a byte-compiled function vector: */ 1474/* Meanings of slots in a Lisp_Compiled: */
1478 1475
1479#define COMPILED_ARGLIST 0 1476#define COMPILED_ARGLIST 0
1480#define COMPILED_BYTECODE 1 1477#define COMPILED_BYTECODE 1
@@ -1484,24 +1481,6 @@ typedef unsigned char UCHAR;
1484#define COMPILED_INTERACTIVE 5 1481#define COMPILED_INTERACTIVE 5
1485#define COMPILED_PUSH_ARGS 6 1482#define COMPILED_PUSH_ARGS 6
1486 1483
1487/* Return non-zero if TAG, the first element from a funvec object, refers
1488 to a byte-code object. Byte-code objects are distinguished from other
1489 `funvec' objects by having a (possibly empty) list as their first
1490 element -- other funvec types use a non-nil symbol there. */
1491#define FUNVEC_COMPILED_TAG_P(tag) \
1492 (NILP (tag) || CONSP (tag))
1493
1494/* Return non-zero if FUNVEC, which should be a `funvec' object, is a
1495 byte-compiled function. Byte-compiled function are funvecs with the
1496 arglist as the first element (other funvec types will have a symbol
1497 identifying the type as the first object). */
1498#define FUNVEC_COMPILED_P(funvec) \
1499 (FUNVEC_SIZE (funvec) > 0 && FUNVEC_COMPILED_TAG_P (AREF (funvec, 0)))
1500
1501/* Return non-zero if OBJ is byte-compile function. */
1502#define COMPILEDP(obj) \
1503 (FUNVECP (obj) && FUNVEC_COMPILED_P (obj))
1504
1505/* Flag bits in a character. These also get used in termhooks.h. 1484/* Flag bits in a character. These also get used in termhooks.h.
1506 Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE 1485 Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE
1507 (MUlti-Lingual Emacs) might need 22 bits for the character value 1486 (MUlti-Lingual Emacs) might need 22 bits for the character value
@@ -1657,7 +1636,7 @@ typedef struct {
1657#define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW) 1636#define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW)
1658#define TERMINALP(x) PSEUDOVECTORP (x, PVEC_TERMINAL) 1637#define TERMINALP(x) PSEUDOVECTORP (x, PVEC_TERMINAL)
1659#define SUBRP(x) PSEUDOVECTORP (x, PVEC_SUBR) 1638#define SUBRP(x) PSEUDOVECTORP (x, PVEC_SUBR)
1660#define FUNVECP(x) PSEUDOVECTORP (x, PVEC_FUNVEC) 1639#define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED)
1661#define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER) 1640#define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER)
1662#define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE) 1641#define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE)
1663#define SUB_CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_SUB_CHAR_TABLE) 1642#define SUB_CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_SUB_CHAR_TABLE)
@@ -1851,7 +1830,7 @@ typedef struct {
1851#define FUNCTIONP(OBJ) \ 1830#define FUNCTIONP(OBJ) \
1852 ((CONSP (OBJ) && EQ (XCAR (OBJ), Qlambda)) \ 1831 ((CONSP (OBJ) && EQ (XCAR (OBJ), Qlambda)) \
1853 || (SYMBOLP (OBJ) && !NILP (Ffboundp (OBJ))) \ 1832 || (SYMBOLP (OBJ) && !NILP (Ffboundp (OBJ))) \
1854 || FUNVECP (OBJ) \ 1833 || COMPILEDP (OBJ) \
1855 || SUBRP (OBJ)) 1834 || SUBRP (OBJ))
1856 1835
1857/* defsubr (Sname); 1836/* defsubr (Sname);
@@ -2725,7 +2704,6 @@ EXFUN (Fmake_list, 2);
2725extern Lisp_Object allocate_misc (void); 2704extern Lisp_Object allocate_misc (void);
2726EXFUN (Fmake_vector, 2); 2705EXFUN (Fmake_vector, 2);
2727EXFUN (Fvector, MANY); 2706EXFUN (Fvector, MANY);
2728EXFUN (Ffunvec, MANY);
2729EXFUN (Fmake_symbol, 1); 2707EXFUN (Fmake_symbol, 1);
2730EXFUN (Fmake_marker, 0); 2708EXFUN (Fmake_marker, 0);
2731EXFUN (Fmake_string, 2); 2709EXFUN (Fmake_string, 2);
@@ -2745,7 +2723,6 @@ extern Lisp_Object make_pure_c_string (const char *data);
2745extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object); 2723extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object);
2746extern Lisp_Object make_pure_vector (EMACS_INT); 2724extern Lisp_Object make_pure_vector (EMACS_INT);
2747EXFUN (Fgarbage_collect, 0); 2725EXFUN (Fgarbage_collect, 0);
2748extern Lisp_Object make_funvec (Lisp_Object, int, int, Lisp_Object *);
2749EXFUN (Fmake_byte_code, MANY); 2726EXFUN (Fmake_byte_code, MANY);
2750EXFUN (Fmake_bool_vector, 2); 2727EXFUN (Fmake_bool_vector, 2);
2751extern Lisp_Object Qchar_table_extra_slots; 2728extern 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)
2497 invalid_syntax ("#&...", 5); 2497 invalid_syntax ("#&...", 5);
2498 } 2498 }
2499 if (c == '[') 2499 if (c == '[')
2500 /* `function vector' objects, including byte-compiled functions. */ 2500 {
2501 return read_vector (readcharfun, 1); 2501 /* Accept compiled functions at read-time so that we don't have to
2502 build them using function calls. */
2503 Lisp_Object tmp;
2504 tmp = read_vector (readcharfun, 1);
2505 return Fmake_byte_code (XVECTOR (tmp)->size,
2506 XVECTOR (tmp)->contents);
2507 }
2502 if (c == '(') 2508 if (c == '(')
2503 { 2509 {
2504 Lisp_Object tmp; 2510 Lisp_Object tmp;
@@ -3311,7 +3317,7 @@ isfloat_string (const char *cp, int ignore_trailing)
3311 3317
3312 3318
3313static Lisp_Object 3319static Lisp_Object
3314read_vector (Lisp_Object readcharfun, int read_funvec) 3320read_vector (Lisp_Object readcharfun, int bytecodeflag)
3315{ 3321{
3316 register int i; 3322 register int i;
3317 register int size; 3323 register int size;
@@ -3319,11 +3325,6 @@ read_vector (Lisp_Object readcharfun, int read_funvec)
3319 register Lisp_Object tem, item, vector; 3325 register Lisp_Object tem, item, vector;
3320 register struct Lisp_Cons *otem; 3326 register struct Lisp_Cons *otem;
3321 Lisp_Object len; 3327 Lisp_Object len;
3322 /* If we're reading a funvec object we start out assuming it's also a
3323 byte-code object (a subset of funvecs), so we can do any special
3324 processing needed. If it's just an ordinary funvec object, we'll
3325 realize that as soon as we've read the first element. */
3326 int read_bytecode = read_funvec;
3327 3328
3328 tem = read_list (1, readcharfun); 3329 tem = read_list (1, readcharfun);
3329 len = Flength (tem); 3330 len = Flength (tem);
@@ -3335,18 +3336,11 @@ read_vector (Lisp_Object readcharfun, int read_funvec)
3335 { 3336 {
3336 item = Fcar (tem); 3337 item = Fcar (tem);
3337 3338
3338 /* If READ_BYTECODE is set, check whether this is really a byte-code
3339 object, or just an ordinary `funvec' object -- non-byte-code
3340 funvec objects use the same reader syntax. We can tell from the
3341 first element which one it is. */
3342 if (read_bytecode && i == 0 && ! FUNVEC_COMPILED_TAG_P (item))
3343 read_bytecode = 0; /* Nope. */
3344
3345 /* If `load-force-doc-strings' is t when reading a lazily-loaded 3339 /* If `load-force-doc-strings' is t when reading a lazily-loaded
3346 bytecode object, the docstring containing the bytecode and 3340 bytecode object, the docstring containing the bytecode and
3347 constants values must be treated as unibyte and passed to 3341 constants values must be treated as unibyte and passed to
3348 Fread, to get the actual bytecode string and constants vector. */ 3342 Fread, to get the actual bytecode string and constants vector. */
3349 if (read_bytecode && load_force_doc_strings) 3343 if (bytecodeflag && load_force_doc_strings)
3350 { 3344 {
3351 if (i == COMPILED_BYTECODE) 3345 if (i == COMPILED_BYTECODE)
3352 { 3346 {
@@ -3400,13 +3394,6 @@ read_vector (Lisp_Object readcharfun, int read_funvec)
3400 free_cons (otem); 3394 free_cons (otem);
3401 } 3395 }
3402 3396
3403 if (read_bytecode && size >= 4)
3404 /* Convert this vector to a bytecode object. */
3405 vector = Fmake_byte_code (size, XVECTOR (vector)->contents);
3406 else if (read_funvec && size >= 1)
3407 /* Convert this vector to an ordinary funvec object. */
3408 XSETFUNVEC (vector, XVECTOR (vector));
3409
3410 return vector; 3397 return vector;
3411} 3398}
3412 3399
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)
1155 1155
1156 loop: 1156 loop:
1157 if (STRINGP (obj) || CONSP (obj) || VECTORP (obj) 1157 if (STRINGP (obj) || CONSP (obj) || VECTORP (obj)
1158 || FUNVECP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) 1158 || COMPILEDP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj)
1159 || HASH_TABLE_P (obj) 1159 || HASH_TABLE_P (obj)
1160 || (! NILP (Vprint_gensym) 1160 || (! NILP (Vprint_gensym)
1161 && SYMBOLP (obj) 1161 && SYMBOLP (obj)
@@ -1337,7 +1337,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1337 1337
1338 /* Detect circularities and truncate them. */ 1338 /* Detect circularities and truncate them. */
1339 if (STRINGP (obj) || CONSP (obj) || VECTORP (obj) 1339 if (STRINGP (obj) || CONSP (obj) || VECTORP (obj)
1340 || FUNVECP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) 1340 || COMPILEDP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj)
1341 || HASH_TABLE_P (obj) 1341 || HASH_TABLE_P (obj)
1342 || (! NILP (Vprint_gensym) 1342 || (! NILP (Vprint_gensym)
1343 && SYMBOLP (obj) 1343 && SYMBOLP (obj)
@@ -1960,7 +1960,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1960 else 1960 else
1961 { 1961 {
1962 EMACS_INT size = XVECTOR (obj)->size; 1962 EMACS_INT size = XVECTOR (obj)->size;
1963 if (FUNVECP (obj)) 1963 if (COMPILEDP (obj))
1964 { 1964 {
1965 PRINTCHAR ('#'); 1965 PRINTCHAR ('#');
1966 size &= PSEUDOVECTOR_SIZE_MASK; 1966 size &= PSEUDOVECTOR_SIZE_MASK;