diff options
| author | Stefan Monnier | 2011-02-24 22:27:45 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2011-02-24 22:27:45 -0500 |
| commit | 876c194cbac17a6220dbf406b0a602325978011c (patch) | |
| tree | f76a686c53e547a24039d9de2deaf68598e75518 /src/alloc.c | |
| parent | cb9336bd977d3345b86234c36d45228f7fb27eec (diff) | |
| download | emacs-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/alloc.c')
| -rw-r--r-- | src/alloc.c | 71 |
1 files changed, 7 insertions, 64 deletions
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 | |||
| 2937 | Lisp_Object | ||
| 2938 | make_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 | |||
| 2958 | DEFUN ("vector", Fvector, Svector, 0, MANY, 0, | 2927 | DEFUN ("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. |
| 2960 | Any number of arguments, even zero arguments, are allowed. | 2929 | Any number of arguments, even zero arguments, are allowed. |
| @@ -2974,27 +2943,6 @@ usage: (vector &rest OBJECTS) */) | |||
| 2974 | } | 2943 | } |
| 2975 | 2944 | ||
| 2976 | 2945 | ||
| 2977 | DEFUN ("funvec", Ffunvec, Sfunvec, 1, MANY, 0, | ||
| 2978 | doc: /* Return a newly created `function vector' of type KIND. | ||
| 2979 | A `function vector', a.k.a. `funvec', is a funcallable vector in Emacs Lisp. | ||
| 2980 | KIND indicates the kind of funvec, and determines its behavior when called. | ||
| 2981 | The meaning of the remaining arguments depends on KIND. Currently | ||
| 2982 | implemented 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 | |||
| 2991 | usage: (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 | |||
| 2998 | DEFUN ("make-byte-code", Fmake_byte_code, Smake_byte_code, 4, MANY, 0, | 2946 | DEFUN ("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. |
| 3000 | The arguments should be the arglist, bytecode-string, constant vector, | 2948 | 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 | |||
| 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); |