aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2011-02-17 16:19:13 -0500
committerStefan Monnier2011-02-17 16:19:13 -0500
commitb38b1ec071ee9752da53f2485902165fe728e8fa (patch)
tree318ca7399de648f910626f666a1d6e62d71e081c /src
parentce5b520a3758e22c6516e0d864d8c1a3512bf457 (diff)
downloademacs-b38b1ec071ee9752da53f2485902165fe728e8fa.tar.gz
emacs-b38b1ec071ee9752da53f2485902165fe728e8fa.zip
Various compiler bug-fixes. MPC seems to run correctly now.
* lisp/files.el (lexical-binding): Add a safe-local-variable property. * lisp/emacs-lisp/byte-opt.el (byte-inline-lapcode): Check how many elements are added to the stack. (byte-compile-splice-in-already-compiled-code): Don't touch lexical nor byte-compile-depth now that byte-inline-lapcode does it for us. (byte-compile-inline-expand): Don't inline dynbind byte code into lexbind code, since it has to be done differently. * lisp/emacs-lisp/bytecomp.el (byte-compile-arglist-warn): Correctly extract arglist from `closure's. (byte-compile-cl-warn): Compiler-macros are run earlier now. (byte-compile-top-level): Bind byte-compile-lexical-environment to nil, except for lambdas. (byte-compile-form): Don't run the compiler-macro expander here. (byte-compile-let): Merge with byte-compile-let*. Don't preserve-body-value if the body's value was discarded. * lisp/emacs-lisp/cconv.el (cconv--set-diff, cconv--set-diff-map) (cconv--map-diff, cconv--map-diff-elem, cconv--map-diff-set): New funs. (cconv--env-var): New constant. (cconv-closure-convert-rec): Use it and use them. Fix a typo that ended up forgetting to remove entries from lmenvs in `let'. For `lambda' use the outer `fvrs' when building the closure and don't forget to remove `vars' from the `emvrs' and `lmenvs' of the body. * lisp/emacs-lisp/cl-macs.el (cl-byte-compile-block): Disable optimization in lexbind, because it needs a different implementation. * src/bytecode.c (exec_byte_code): Fix handling of &rest. * src/eval.c (Vinternal_interpreter_environment): Remove. (syms_of_eval): Do declare Vinternal_interpreter_environment as a global lisp var, but unintern it to hide it. (Fcommandp): * src/data.c (Finteractive_form): Understand `closure's.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/bytecode.c4
-rw-r--r--src/data.c2
-rw-r--r--src/eval.c34
-rw-r--r--src/lisp.h2
5 files changed, 34 insertions, 18 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6674fb31ca5..0b2ee8550ca 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12011-02-17 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * eval.c (Vinternal_interpreter_environment): Remove.
4 (syms_of_eval): Do declare Vinternal_interpreter_environment as
5 a global lisp var, but unintern it to hide it.
6 (Fcommandp):
7 * data.c (Finteractive_form): Understand `closure's.
8
9 * bytecode.c (exec_byte_code): Fix handling of &rest.
10
12011-02-12 Stefan Monnier <monnier@iro.umontreal.ca> 112011-02-12 Stefan Monnier <monnier@iro.umontreal.ca>
2 12
3 * bytecode.c (Bvec_ref, Bvec_set): Remove. 13 * bytecode.c (Bvec_ref, Bvec_set): Remove.
diff --git a/src/bytecode.c b/src/bytecode.c
index 9bf6ae45ce9..1ad01aaf8f7 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -500,7 +500,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
500 optional = 1; 500 optional = 1;
501 else if (EQ (XCAR (at), Qand_rest)) 501 else if (EQ (XCAR (at), Qand_rest))
502 { 502 {
503 PUSH (Flist (nargs, args)); 503 PUSH (pushed < nargs
504 ? Flist (nargs - pushed, args)
505 : Qnil);
504 pushed = nargs; 506 pushed = nargs;
505 at = Qnil; 507 at = Qnil;
506 break; 508 break;
diff --git a/src/data.c b/src/data.c
index 83da3e103cb..2f17edd3fdc 100644
--- a/src/data.c
+++ b/src/data.c
@@ -755,6 +755,8 @@ Value, if non-nil, is a list \(interactive SPEC). */)
755 else if (CONSP (fun)) 755 else if (CONSP (fun))
756 { 756 {
757 Lisp_Object funcar = XCAR (fun); 757 Lisp_Object funcar = XCAR (fun);
758 if (EQ (funcar, Qclosure))
759 fun = Fcdr (XCDR (fun)), funcar = Fcar (fun);
758 if (EQ (funcar, Qlambda)) 760 if (EQ (funcar, Qlambda))
759 return Fassq (Qinteractive, Fcdr (XCDR (fun))); 761 return Fassq (Qinteractive, Fcdr (XCDR (fun)));
760 else if (EQ (funcar, Qautoload)) 762 else if (EQ (funcar, Qautoload))
diff --git a/src/eval.c b/src/eval.c
index 9adfc983ced..63484d40e1b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -78,16 +78,6 @@ Lisp_Object Vrun_hooks;
78 78
79Lisp_Object Vautoload_queue; 79Lisp_Object Vautoload_queue;
80 80
81/* When lexical binding is being used, this is non-nil, and contains an
82 alist of lexically-bound variable, or (t), indicating an empty
83 environment. The lisp name of this variable is
84 `internal-interpreter-environment'. Every element of this list
85 can be either a cons (VAR . VAL) specifying a lexical binding,
86 or a single symbol VAR indicating that this variable should use
87 dynamic scoping. */
88
89Lisp_Object Vinternal_interpreter_environment;
90
91/* Current number of specbindings allocated in specpdl. */ 81/* Current number of specbindings allocated in specpdl. */
92 82
93EMACS_INT specpdl_size; 83EMACS_INT specpdl_size;
@@ -2092,9 +2082,11 @@ then strings and vectors are not accepted. */)
2092 if (!CONSP (fun)) 2082 if (!CONSP (fun))
2093 return Qnil; 2083 return Qnil;
2094 funcar = XCAR (fun); 2084 funcar = XCAR (fun);
2085 if (EQ (funcar, Qclosure))
2086 fun = Fcdr (XCDR (fun)), funcar = Fcar (fun);
2095 if (EQ (funcar, Qlambda)) 2087 if (EQ (funcar, Qlambda))
2096 return !NILP (Fassq (Qinteractive, Fcdr (XCDR (fun)))) ? Qt : if_prop; 2088 return !NILP (Fassq (Qinteractive, Fcdr (XCDR (fun)))) ? Qt : if_prop;
2097 if (EQ (funcar, Qautoload)) 2089 else if (EQ (funcar, Qautoload))
2098 return !NILP (Fcar (Fcdr (Fcdr (XCDR (fun))))) ? Qt : if_prop; 2090 return !NILP (Fcar (Fcdr (Fcdr (XCDR (fun))))) ? Qt : if_prop;
2099 else 2091 else
2100 return Qnil; 2092 return Qnil;
@@ -3695,6 +3687,8 @@ mark_backtrace (void)
3695 } 3687 }
3696} 3688}
3697 3689
3690EXFUN (Funintern, 2);
3691
3698void 3692void
3699syms_of_eval (void) 3693syms_of_eval (void)
3700{ 3694{
@@ -3840,19 +3834,27 @@ DECL is a list `(declare ...)' containing the declarations.
3840The value the function returns is not used. */); 3834The value the function returns is not used. */);
3841 Vmacro_declaration_function = Qnil; 3835 Vmacro_declaration_function = Qnil;
3842 3836
3837 /* When lexical binding is being used,
3838 vinternal_interpreter_environment is non-nil, and contains an alist
3839 of lexically-bound variable, or (t), indicating an empty
3840 environment. The lisp name of this variable would be
3841 `internal-interpreter-environment' if it weren't hidden.
3842 Every element of this list can be either a cons (VAR . VAL)
3843 specifying a lexical binding, or a single symbol VAR indicating
3844 that this variable should use dynamic scoping. */
3843 Qinternal_interpreter_environment 3845 Qinternal_interpreter_environment
3844 = intern_c_string ("internal-interpreter-environment"); 3846 = intern_c_string ("internal-interpreter-environment");
3845 staticpro (&Qinternal_interpreter_environment); 3847 staticpro (&Qinternal_interpreter_environment);
3846#if 0 /* Don't export this variable to Elisp, so noone can mess with it 3848 DEFVAR_LISP ("internal-interpreter-environment",
3847 (Just imagine if someone makes it buffer-local). */ 3849 Vinternal_interpreter_environment,
3848 DEFVAR__LISP ("internal-interpreter-environment",
3849 Vinternal_interpreter_environment,
3850 doc: /* If non-nil, the current lexical environment of the lisp interpreter. 3850 doc: /* If non-nil, the current lexical environment of the lisp interpreter.
3851When lexical binding is not being used, this variable is nil. 3851When lexical binding is not being used, this variable is nil.
3852A value of `(t)' indicates an empty environment, otherwise it is an 3852A value of `(t)' indicates an empty environment, otherwise it is an
3853alist of active lexical bindings. */); 3853alist of active lexical bindings. */);
3854#endif
3855 Vinternal_interpreter_environment = Qnil; 3854 Vinternal_interpreter_environment = Qnil;
3855 /* Don't export this variable to Elisp, so noone can mess with it
3856 (Just imagine if someone makes it buffer-local). */
3857 Funintern (Qinternal_interpreter_environment, Qnil);
3856 3858
3857 Vrun_hooks = intern_c_string ("run-hooks"); 3859 Vrun_hooks = intern_c_string ("run-hooks");
3858 staticpro (&Vrun_hooks); 3860 staticpro (&Vrun_hooks);
diff --git a/src/lisp.h b/src/lisp.h
index 906736bacad..0e7eeebc9da 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2855,7 +2855,7 @@ extern void syms_of_lread (void);
2855 2855
2856/* Defined in eval.c */ 2856/* Defined in eval.c */
2857extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro; 2857extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
2858extern Lisp_Object Qinhibit_quit; 2858extern Lisp_Object Qinhibit_quit, Qclosure;
2859extern Lisp_Object Vautoload_queue; 2859extern Lisp_Object Vautoload_queue;
2860extern Lisp_Object Vsignaling_function; 2860extern Lisp_Object Vsignaling_function;
2861extern int handling_signal; 2861extern int handling_signal;