diff options
| author | Stefan Monnier | 2011-04-01 13:19:52 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2011-04-01 13:19:52 -0400 |
| commit | 034086489cff2a23cb4d9f8c536e18456be617ef (patch) | |
| tree | 93fa6987e56af7b5fd452f7f909ea0653c5b47de /src/bytecode.c | |
| parent | 1c412c000a5d61d1be7f6fa7e632a517b89de95b (diff) | |
| parent | 7200d79c65c65686495dd95e9f6dd436cf6db55e (diff) | |
| download | emacs-034086489cff2a23cb4d9f8c536e18456be617ef.tar.gz emacs-034086489cff2a23cb4d9f8c536e18456be617ef.zip | |
Merge from lexical-binding branch.
* doc/lispref/eval.texi (Eval): Discourage the use of `eval'.
Document its new `lexical' argument.
* doc/lispref/variables.texi (Defining Variables): Mention the new meaning of `defvar'.
(Lexical Binding): New sub-section.
* lisp/Makefile.in (BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS):
New variables.
(compile-onefile, .el.elc, compile-calc, recompile): Use them.
(COMPILE_FIRST): Add macroexp and cconv.
* lisp/makefile.w32-in: Mirror changes in Makefile.in.
* lisp/vc/cvs-status.el:
* lisp/vc/diff-mode.el:
* lisp/vc/log-edit.el:
* lisp/vc/log-view.el:
* lisp/vc/smerge-mode.el:
* lisp/textmodes/bibtex-style.el:
* textmodes/css.el:
* lisp/startup.el:
* lisp/uniquify.el:
* lisp/minibuffer.el:
* lisp/newcomment.el:
* lisp/reveal.el:
* lisp/server.el:
* lisp/mpc.el:
* lisp/emacs-lisp/smie.el:
* lisp/doc-view.el:
* lisp/dired.el:
* lisp/abbrev.el: Use lexical binding.
* lisp/custom.el (custom-initialize-default, custom-declare-variable):
Use `defvar'.
* lisp/files.el (lexical-binding): Declare safe.
* lisp/help-fns.el (help-split-fundoc): Return nil if there's nothing else
than the arglist.
(help-add-fundoc-usage): Don't add `Not documented'.
(help-function-arglist): Handle closures, subroutines, and new
byte-code-functions.
(help-make-usage): Remove leading underscores.
(describe-function-1): Handle closures.
(describe-variable): Use special-variable-p for completion.
* lisp/simple.el (with-wrapper-hook, apply-partially): Move to subr.el.
* lisp/subr.el (apply-partially): Use new closures rather than CL.
(--dolist-tail--, --dotimes-limit--): Don't declare dynamic.
(dolist, dotimes): Use slightly different expansion for lexical code.
(functionp): Move to C.
(letrec): New macro.
(with-wrapper-hook): Use it and apply-partially instead of CL.
(eval-after-load): Preserve lexical-binding.
(save-window-excursion, with-output-to-temp-buffer): Turn them
into macros.
* lisp/emacs-lisp/advice.el (ad-arglist): Use help-function-arglist.
* lisp/emacs-lisp/autoload.el (make-autoload): Don't burp on trivial macros.
* lisp/emacs-lisp/byte-opt.el: Use lexical binding.
(byte-inline-lapcode): Remove (to bytecomp).
(byte-compile-inline-expand): Pay attention to inlining to/from
lexically bound code.
(byte-compile-unfold-lambda): Don't handle byte-code-functions
any more.
(byte-optimize-form-code-walker): Don't handle save-window-excursion
any more and don't call compiler-macros.
(byte-compile-splice-in-already-compiled-code): Remove.
(byte-code): Don't inline any more.
(disassemble-offset): Receive `bytes' as argument rather than via
dynamic scoping.
(byte-compile-tag-number): Declare before first use.
(byte-decompile-bytecode-1): Handle new byte-codes, don't change
`return' even if make-spliceable.
(byte-compile-side-effect-and-error-free-ops): Add stack-ref, remove
obsolete interactive-p.
(byte-optimize-lapcode): Optimize new lap-codes.
Don't trip up on new form of `byte-constant' lap code.
* lisp/emacs-lisp/byte-run.el (make-obsolete): Don't set the `byte-compile'
handler any more.
* lisp/emacs-lisp/bytecomp.el: Use lexical binding instead of
a "bytecomp-" prefix. Macroexpand everything as a separate phase.
(byte-compile-initial-macro-environment):
Handle declare-function here.
(byte-compile--lexical-environment): New var.
(byte-stack-ref, byte-stack-set, byte-discardN)
(byte-discardN-preserve-tos): New lap codes.
(byte-interactive-p): Don't use any more.
(byte-compile-push-bytecodes, byte-compile-push-bytecode-const2):
New macros.
(byte-compile-lapcode): Use them and handle new lap codes.
(byte-compile-obsolete): Remove.
(byte-compile-arglist-signature): Handle new byte-code arg"lists".
(byte-compile-arglist-warn): Check late def of inlinable funs.
(byte-compile-cl-warn): Don't silence warnings for compiler-macros
since they should have been expanded by now.
(byte-compile--outbuffer): Rename from bytecomp-outbuffer.
(byte-compile-from-buffer): Remove unused second arg.
(byte-compile-preprocess): New function.
(byte-compile-toplevel-file-form): New function to distinguish
file-form calls from outside from file-form calls from hunk-handlers.
(byte-compile-file-form): Simplify.
(byte-compile-file-form-defsubst): Remove.
(byte-compile-file-form-defmumble): Simplify now that
byte-compile-lambda always returns a byte-code-function.
(byte-compile): Preprocess.
(byte-compile-byte-code-maker, byte-compile-byte-code-unmake):
Remove, not used any more.
(byte-compile-arglist-vars, byte-compile-make-lambda-lexenv)
(byte-compile-make-args-desc): New funs.
(byte-compile-lambda): Handle lexical functions. Always return
a byte-code-function.
(byte-compile-reserved-constants): New var, to make up room for
closed-over variables.
(byte-compile-constants-vector): Obey it.
(byte-compile-top-level): New args `lexenv' and `reserved-csts'.
(byte-compile-macroexpand-declare-function): New function.
(byte-compile-form): Call byte-compile-unfold-bcf to inline immediate
byte-code-functions.
(byte-compile-form): Check obsolescence here.
(byte-compile-inline-lapcode, byte-compile-unfold-bcf): New functions.
(byte-compile-variable-ref): Remove.
(byte-compile-dynamic-variable-op): New fun.
(byte-compile-dynamic-variable-bind, byte-compile-variable-ref)
(byte-compile-variable-set): New funs.
(byte-compile-discard): Add 2 args.
(byte-compile-stack-ref, byte-compile-stack-set)
(byte-compile-make-closure, byte-compile-get-closed-var): New funs.
(byte-compile-funarg, byte-compile-funarg-2): Remove, handled in
macroexpand-all instead.
(byte-compile-quote-form): Remove.
(byte-compile-push-binding-init, byte-compile-not-lexical-var-p)
(byte-compile-bind, byte-compile-unbind): New funs.
(byte-compile-let): Handle let* and lexical binding.
(byte-compile-let*): Remove.
(byte-compile-catch, byte-compile-unwind-protect)
(byte-compile-track-mouse, byte-compile-condition-case):
Handle a new :fun-body form, used for lexical scoping.
(byte-compile-save-window-excursion)
(byte-compile-with-output-to-temp-buffer): Remove.
(byte-compile-defun): Simplify.
(byte-compile-stack-adjustment): New fun.
(byte-compile-out): Use it.
(byte-compile-refresh-preloaded): Don't reload byte-compiler files.
* lisp/emacs-lisp/cconv.el: New file.
* lisp/emacs-lisp/cl-extra.el (cl-macroexpand-all): Properly quote CL
closures.
* lisp/emacs-lisp/cl-macs.el (cl-byte-compile-block)
(cl-byte-compile-throw): Remove.
(cl-block-wrapper, cl-block-throw): Use compiler-macros instead.
* lisp/emacs-lisp/cl.el (pushnew): Silence warning.
* lisp/emacs-lisp/disass.el (disassemble-internal): Handle new
`closure' objects.
(disassemble-1): Handle new byte codes.
* lisp/emacs-lisp/edebug.el (edebug-eval-defun)
(edebug-eval-top-level-form): Use eval-sexp-add-defvars.
(edebug-toggle): Avoid `eval'.
* lisp/emacs-lisp/eieio-comp.el: Remove.
* lisp/emacs-lisp/eieio.el (byte-compile-file-form-defmethod):
Don't autoload.
(eieio-defgeneric-form-primary-only-one): Use `byte-compile' rather
than the internal `byte-compile-lambda'.
(defmethod): Don't hide code under quotes.
(eieio-defmethod): New `code' argument.
* lisp/emacs-lisp/float-sup.el (pi): Don't declare as dynamically bound.
* lisp/emacs-lisp/lisp-mode.el (eval-last-sexp-1):
Use eval-sexp-add-defvars.
(eval-sexp-add-defvars): New fun.
* lisp/emacs-lisp/macroexp.el: Use lexical binding.
(macroexpand-all-1): Check obsolete macros. Expand compiler-macros.
Don't convert ' to #' without checking that it's indeed quoting
a lambda.
* lisp/emacs-lisp/pcase.el: Don't use destructuring-bind.
(pcase--memoize): Rename from pcase-memoize. Change weakness.
(pcase): Add `let' pattern.
Change memoization so it actually works.
(pcase-mutually-exclusive-predicates): Add byte-code-function-p.
(pcase--u1) <guard, pred>: Fix possible shadowing problem.
<let>: New case.
* src/alloc.c (Fmake_symbol): Init new `declared_special' field.
* src/buffer.c (defvar_per_buffer): Set new `declared_special' field.
* src/bytecode.c (Bstack_ref, Bstack_set, Bstack_set2, BdiscardN):
New byte-codes.
(exec_byte_code): New function extracted from Fbyte_code to handle new
calling convention for byte-code-functions. Add new byte-codes.
* src/callint.c (Fcall_interactively): Preserve lexical-binding mode for
interactive spec.
* src/doc.c (Fdocumentation, store_function_docstring):
* src/data.c (Finteractive_form): Handle closures.
* src/eval.c (Fsetq): Handle lexical vars.
(Fdefun, Fdefmacro, Ffunction): Make closures when needed.
(Fdefconst, Fdefvaralias, Fdefvar): Mark as dynamic.
(FletX, Flet): Obey lexical binding.
(Fcommandp): Handle closures.
(Feval): New `lexical' arg.
(eval_sub): New function extracted from Feval. Use it almost
everywhere where Feval was used. Look up vars in lexical env.
Handle closures.
(Ffunctionp): Move from subr.el.
(Ffuncall): Handle closures.
(apply_lambda): Remove `eval_flags'.
(funcall_lambda): Handle closures and new byte-code-functions.
(Fspecial_variable_p): New function.
(syms_of_eval): Initialize the Vinternal_interpreter_environment var,
but without exporting it to Lisp.
* src/fns.c (concat, mapcar1): Accept byte-code-functions.
* src/image.c (parse_image_spec): Use Ffunctionp.
* src/keyboard.c (eval_dyn): New fun.
(menu_item_eval_property): Use it.
* src/lisp.h (struct Lisp_Symbol): New field `declared_special'.
* src/lread.c (lisp_file_lexically_bound_p): New function.
(Fload): Bind Qlexical_binding.
(readevalloop): Remove `evalfun' arg.
Bind Qinternal_interpreter_environment.
(Feval_buffer): Bind Qlexical_binding.
(defvar_int, defvar_bool, defvar_lisp_nopro, defvar_kboard):
Mark as dynamic.
(syms_of_lread): Declare `lexical-binding'.
* src/window.c (Ftemp_output_buffer_show): New fun.
(Fsave_window_excursion):
* src/print.c (Fwith_output_to_temp_buffer): Move to subr.el.
Diffstat (limited to 'src/bytecode.c')
| -rw-r--r-- | src/bytecode.c | 163 |
1 files changed, 143 insertions, 20 deletions
diff --git a/src/bytecode.c b/src/bytecode.c index a7be8e26f27..5d94cb0fb39 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -80,9 +80,11 @@ Lisp_Object Qbyte_code_meter; | |||
| 80 | 80 | ||
| 81 | 81 | ||
| 82 | Lisp_Object Qbytecode; | 82 | Lisp_Object Qbytecode; |
| 83 | extern Lisp_Object Qand_optional, Qand_rest; | ||
| 83 | 84 | ||
| 84 | /* Byte codes: */ | 85 | /* Byte codes: */ |
| 85 | 86 | ||
| 87 | #define Bstack_ref 0 /* Actually, Bstack_ref+0 is not implemented: use dup. */ | ||
| 86 | #define Bvarref 010 | 88 | #define Bvarref 010 |
| 87 | #define Bvarset 020 | 89 | #define Bvarset 020 |
| 88 | #define Bvarbind 030 | 90 | #define Bvarbind 030 |
| @@ -132,7 +134,7 @@ Lisp_Object Qbytecode; | |||
| 132 | 134 | ||
| 133 | #define Bpoint 0140 | 135 | #define Bpoint 0140 |
| 134 | /* Was Bmark in v17. */ | 136 | /* Was Bmark in v17. */ |
| 135 | #define Bsave_current_buffer 0141 | 137 | #define Bsave_current_buffer 0141 /* Obsolete. */ |
| 136 | #define Bgoto_char 0142 | 138 | #define Bgoto_char 0142 |
| 137 | #define Binsert 0143 | 139 | #define Binsert 0143 |
| 138 | #define Bpoint_max 0144 | 140 | #define Bpoint_max 0144 |
| @@ -158,7 +160,7 @@ Lisp_Object Qbytecode; | |||
| 158 | #ifdef BYTE_CODE_SAFE | 160 | #ifdef BYTE_CODE_SAFE |
| 159 | #define Bset_mark 0163 /* this loser is no longer generated as of v18 */ | 161 | #define Bset_mark 0163 /* this loser is no longer generated as of v18 */ |
| 160 | #endif | 162 | #endif |
| 161 | #define Binteractive_p 0164 /* Needed since interactive-p takes unevalled args */ | 163 | #define Binteractive_p 0164 /* Obsolete since Emacs-24.1. */ |
| 162 | 164 | ||
| 163 | #define Bforward_char 0165 | 165 | #define Bforward_char 0165 |
| 164 | #define Bforward_word 0166 | 166 | #define Bforward_word 0166 |
| @@ -183,16 +185,16 @@ Lisp_Object Qbytecode; | |||
| 183 | #define Bdup 0211 | 185 | #define Bdup 0211 |
| 184 | 186 | ||
| 185 | #define Bsave_excursion 0212 | 187 | #define Bsave_excursion 0212 |
| 186 | #define Bsave_window_excursion 0213 | 188 | #define Bsave_window_excursion 0213 /* Obsolete since Emacs-24.1. */ |
| 187 | #define Bsave_restriction 0214 | 189 | #define Bsave_restriction 0214 |
| 188 | #define Bcatch 0215 | 190 | #define Bcatch 0215 |
| 189 | 191 | ||
| 190 | #define Bunwind_protect 0216 | 192 | #define Bunwind_protect 0216 |
| 191 | #define Bcondition_case 0217 | 193 | #define Bcondition_case 0217 |
| 192 | #define Btemp_output_buffer_setup 0220 | 194 | #define Btemp_output_buffer_setup 0220 /* Obsolete since Emacs-24.1. */ |
| 193 | #define Btemp_output_buffer_show 0221 | 195 | #define Btemp_output_buffer_show 0221 /* Obsolete since Emacs-24.1. */ |
| 194 | 196 | ||
| 195 | #define Bunbind_all 0222 | 197 | #define Bunbind_all 0222 /* Obsolete. Never used. */ |
| 196 | 198 | ||
| 197 | #define Bset_marker 0223 | 199 | #define Bset_marker 0223 |
| 198 | #define Bmatch_beginning 0224 | 200 | #define Bmatch_beginning 0224 |
| @@ -228,6 +230,11 @@ Lisp_Object Qbytecode; | |||
| 228 | #define BconcatN 0260 | 230 | #define BconcatN 0260 |
| 229 | #define BinsertN 0261 | 231 | #define BinsertN 0261 |
| 230 | 232 | ||
| 233 | /* Bstack_ref is code 0. */ | ||
| 234 | #define Bstack_set 0262 | ||
| 235 | #define Bstack_set2 0263 | ||
| 236 | #define BdiscardN 0266 | ||
| 237 | |||
| 231 | #define Bconstant 0300 | 238 | #define Bconstant 0300 |
| 232 | 239 | ||
| 233 | /* Whether to maintain a `top' and `bottom' field in the stack frame. */ | 240 | /* Whether to maintain a `top' and `bottom' field in the stack frame. */ |
| @@ -414,6 +421,21 @@ the third, MAXDEPTH, the maximum stack depth used in this function. | |||
| 414 | If the third argument is incorrect, Emacs may crash. */) | 421 | If the third argument is incorrect, Emacs may crash. */) |
| 415 | (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth) | 422 | (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth) |
| 416 | { | 423 | { |
| 424 | return exec_byte_code (bytestr, vector, maxdepth, Qnil, 0, NULL); | ||
| 425 | } | ||
| 426 | |||
| 427 | /* Execute the byte-code in BYTESTR. VECTOR is the constant vector, and | ||
| 428 | MAXDEPTH is the maximum stack depth used (if MAXDEPTH is incorrect, | ||
| 429 | emacs may crash!). If ARGS_TEMPLATE is non-nil, it should be a lisp | ||
| 430 | argument list (including &rest, &optional, etc.), and ARGS, of size | ||
| 431 | NARGS, should be a vector of the actual arguments. The arguments in | ||
| 432 | ARGS are pushed on the stack according to ARGS_TEMPLATE before | ||
| 433 | executing BYTESTR. */ | ||
| 434 | |||
| 435 | Lisp_Object | ||
| 436 | exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | ||
| 437 | Lisp_Object args_template, int nargs, Lisp_Object *args) | ||
| 438 | { | ||
| 417 | int count = SPECPDL_INDEX (); | 439 | int count = SPECPDL_INDEX (); |
| 418 | #ifdef BYTE_CODE_METER | 440 | #ifdef BYTE_CODE_METER |
| 419 | int this_op = 0; | 441 | int this_op = 0; |
| @@ -473,6 +495,52 @@ If the third argument is incorrect, Emacs may crash. */) | |||
| 473 | stacke = stack.bottom - 1 + XFASTINT (maxdepth); | 495 | stacke = stack.bottom - 1 + XFASTINT (maxdepth); |
| 474 | #endif | 496 | #endif |
| 475 | 497 | ||
| 498 | if (INTEGERP (args_template)) | ||
| 499 | { | ||
| 500 | int at = XINT (args_template); | ||
| 501 | int rest = at & 128; | ||
| 502 | int mandatory = at & 127; | ||
| 503 | int nonrest = at >> 8; | ||
| 504 | eassert (mandatory <= nonrest); | ||
| 505 | if (nargs <= nonrest) | ||
| 506 | { | ||
| 507 | int i; | ||
| 508 | for (i = 0 ; i < nargs; i++, args++) | ||
| 509 | PUSH (*args); | ||
| 510 | if (nargs < mandatory) | ||
| 511 | /* Too few arguments. */ | ||
| 512 | Fsignal (Qwrong_number_of_arguments, | ||
| 513 | Fcons (Fcons (make_number (mandatory), | ||
| 514 | rest ? Qand_rest : make_number (nonrest)), | ||
| 515 | Fcons (make_number (nargs), Qnil))); | ||
| 516 | else | ||
| 517 | { | ||
| 518 | for (; i < nonrest; i++) | ||
| 519 | PUSH (Qnil); | ||
| 520 | if (rest) | ||
| 521 | PUSH (Qnil); | ||
| 522 | } | ||
| 523 | } | ||
| 524 | else if (rest) | ||
| 525 | { | ||
| 526 | int i; | ||
| 527 | for (i = 0 ; i < nonrest; i++, args++) | ||
| 528 | PUSH (*args); | ||
| 529 | PUSH (Flist (nargs - nonrest, args)); | ||
| 530 | } | ||
| 531 | else | ||
| 532 | /* Too many arguments. */ | ||
| 533 | Fsignal (Qwrong_number_of_arguments, | ||
| 534 | Fcons (Fcons (make_number (mandatory), | ||
| 535 | make_number (nonrest)), | ||
| 536 | Fcons (make_number (nargs), Qnil))); | ||
| 537 | } | ||
| 538 | else if (! NILP (args_template)) | ||
| 539 | /* We should push some arguments on the stack. */ | ||
| 540 | { | ||
| 541 | error ("Unknown args template!"); | ||
| 542 | } | ||
| 543 | |||
| 476 | while (1) | 544 | while (1) |
| 477 | { | 545 | { |
| 478 | #ifdef BYTE_CODE_SAFE | 546 | #ifdef BYTE_CODE_SAFE |
| @@ -733,7 +801,7 @@ If the third argument is incorrect, Emacs may crash. */) | |||
| 733 | AFTER_POTENTIAL_GC (); | 801 | AFTER_POTENTIAL_GC (); |
| 734 | break; | 802 | break; |
| 735 | 803 | ||
| 736 | case Bunbind_all: | 804 | case Bunbind_all: /* Obsolete. Never used. */ |
| 737 | /* To unbind back to the beginning of this frame. Not used yet, | 805 | /* To unbind back to the beginning of this frame. Not used yet, |
| 738 | but will be needed for tail-recursion elimination. */ | 806 | but will be needed for tail-recursion elimination. */ |
| 739 | BEFORE_POTENTIAL_GC (); | 807 | BEFORE_POTENTIAL_GC (); |
| @@ -861,37 +929,43 @@ If the third argument is incorrect, Emacs may crash. */) | |||
| 861 | save_excursion_save ()); | 929 | save_excursion_save ()); |
| 862 | break; | 930 | break; |
| 863 | 931 | ||
| 864 | case Bsave_current_buffer: | 932 | case Bsave_current_buffer: /* Obsolete since ??. */ |
| 865 | case Bsave_current_buffer_1: | 933 | case Bsave_current_buffer_1: |
| 866 | record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); | 934 | record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); |
| 867 | break; | 935 | break; |
| 868 | 936 | ||
| 869 | case Bsave_window_excursion: | 937 | case Bsave_window_excursion: /* Obsolete since 24.1. */ |
| 870 | BEFORE_POTENTIAL_GC (); | 938 | { |
| 871 | TOP = Fsave_window_excursion (TOP); | 939 | register int count = SPECPDL_INDEX (); |
| 872 | AFTER_POTENTIAL_GC (); | 940 | record_unwind_protect (Fset_window_configuration, |
| 873 | break; | 941 | Fcurrent_window_configuration (Qnil)); |
| 942 | BEFORE_POTENTIAL_GC (); | ||
| 943 | TOP = Fprogn (TOP); | ||
| 944 | unbind_to (count, TOP); | ||
| 945 | AFTER_POTENTIAL_GC (); | ||
| 946 | break; | ||
| 947 | } | ||
| 874 | 948 | ||
| 875 | case Bsave_restriction: | 949 | case Bsave_restriction: |
| 876 | record_unwind_protect (save_restriction_restore, | 950 | record_unwind_protect (save_restriction_restore, |
| 877 | save_restriction_save ()); | 951 | save_restriction_save ()); |
| 878 | break; | 952 | break; |
| 879 | 953 | ||
| 880 | case Bcatch: | 954 | case Bcatch: /* FIXME: ill-suited for lexbind */ |
| 881 | { | 955 | { |
| 882 | Lisp_Object v1; | 956 | Lisp_Object v1; |
| 883 | BEFORE_POTENTIAL_GC (); | 957 | BEFORE_POTENTIAL_GC (); |
| 884 | v1 = POP; | 958 | v1 = POP; |
| 885 | TOP = internal_catch (TOP, Feval, v1); | 959 | TOP = internal_catch (TOP, eval_sub, v1); |
| 886 | AFTER_POTENTIAL_GC (); | 960 | AFTER_POTENTIAL_GC (); |
| 887 | break; | 961 | break; |
| 888 | } | 962 | } |
| 889 | 963 | ||
| 890 | case Bunwind_protect: | 964 | case Bunwind_protect: /* FIXME: avoid closure for lexbind */ |
| 891 | record_unwind_protect (Fprogn, POP); | 965 | record_unwind_protect (Fprogn, POP); |
| 892 | break; | 966 | break; |
| 893 | 967 | ||
| 894 | case Bcondition_case: | 968 | case Bcondition_case: /* FIXME: ill-suited for lexbind */ |
| 895 | { | 969 | { |
| 896 | Lisp_Object handlers, body; | 970 | Lisp_Object handlers, body; |
| 897 | handlers = POP; | 971 | handlers = POP; |
| @@ -902,7 +976,7 @@ If the third argument is incorrect, Emacs may crash. */) | |||
| 902 | break; | 976 | break; |
| 903 | } | 977 | } |
| 904 | 978 | ||
| 905 | case Btemp_output_buffer_setup: | 979 | case Btemp_output_buffer_setup: /* Obsolete since 24.1. */ |
| 906 | BEFORE_POTENTIAL_GC (); | 980 | BEFORE_POTENTIAL_GC (); |
| 907 | CHECK_STRING (TOP); | 981 | CHECK_STRING (TOP); |
| 908 | temp_output_buffer_setup (SSDATA (TOP)); | 982 | temp_output_buffer_setup (SSDATA (TOP)); |
| @@ -910,7 +984,7 @@ If the third argument is incorrect, Emacs may crash. */) | |||
| 910 | TOP = Vstandard_output; | 984 | TOP = Vstandard_output; |
| 911 | break; | 985 | break; |
| 912 | 986 | ||
| 913 | case Btemp_output_buffer_show: | 987 | case Btemp_output_buffer_show: /* Obsolete since 24.1. */ |
| 914 | { | 988 | { |
| 915 | Lisp_Object v1; | 989 | Lisp_Object v1; |
| 916 | BEFORE_POTENTIAL_GC (); | 990 | BEFORE_POTENTIAL_GC (); |
| @@ -1382,7 +1456,7 @@ If the third argument is incorrect, Emacs may crash. */) | |||
| 1382 | AFTER_POTENTIAL_GC (); | 1456 | AFTER_POTENTIAL_GC (); |
| 1383 | break; | 1457 | break; |
| 1384 | 1458 | ||
| 1385 | case Binteractive_p: | 1459 | case Binteractive_p: /* Obsolete since 24.1. */ |
| 1386 | PUSH (Finteractive_p ()); | 1460 | PUSH (Finteractive_p ()); |
| 1387 | break; | 1461 | break; |
| 1388 | 1462 | ||
| @@ -1672,8 +1746,57 @@ If the third argument is incorrect, Emacs may crash. */) | |||
| 1672 | #endif | 1746 | #endif |
| 1673 | 1747 | ||
| 1674 | case 0: | 1748 | case 0: |
| 1749 | /* Actually this is Bstack_ref with offset 0, but we use Bdup | ||
| 1750 | for that instead. */ | ||
| 1751 | /* case Bstack_ref: */ | ||
| 1675 | abort (); | 1752 | abort (); |
| 1676 | 1753 | ||
| 1754 | /* Handy byte-codes for lexical binding. */ | ||
| 1755 | case Bstack_ref+1: | ||
| 1756 | case Bstack_ref+2: | ||
| 1757 | case Bstack_ref+3: | ||
| 1758 | case Bstack_ref+4: | ||
| 1759 | case Bstack_ref+5: | ||
| 1760 | { | ||
| 1761 | Lisp_Object *ptr = top - (op - Bstack_ref); | ||
| 1762 | PUSH (*ptr); | ||
| 1763 | break; | ||
| 1764 | } | ||
| 1765 | case Bstack_ref+6: | ||
| 1766 | { | ||
| 1767 | Lisp_Object *ptr = top - (FETCH); | ||
| 1768 | PUSH (*ptr); | ||
| 1769 | break; | ||
| 1770 | } | ||
| 1771 | case Bstack_ref+7: | ||
| 1772 | { | ||
| 1773 | Lisp_Object *ptr = top - (FETCH2); | ||
| 1774 | PUSH (*ptr); | ||
| 1775 | break; | ||
| 1776 | } | ||
| 1777 | /* stack-set-0 = discard; stack-set-1 = discard-1-preserve-tos. */ | ||
| 1778 | case Bstack_set: | ||
| 1779 | { | ||
| 1780 | Lisp_Object *ptr = top - (FETCH); | ||
| 1781 | *ptr = POP; | ||
| 1782 | break; | ||
| 1783 | } | ||
| 1784 | case Bstack_set2: | ||
| 1785 | { | ||
| 1786 | Lisp_Object *ptr = top - (FETCH2); | ||
| 1787 | *ptr = POP; | ||
| 1788 | break; | ||
| 1789 | } | ||
| 1790 | case BdiscardN: | ||
| 1791 | op = FETCH; | ||
| 1792 | if (op & 0x80) | ||
| 1793 | { | ||
| 1794 | op &= 0x7F; | ||
| 1795 | top[-op] = TOP; | ||
| 1796 | } | ||
| 1797 | DISCARD (op); | ||
| 1798 | break; | ||
| 1799 | |||
| 1677 | case 255: | 1800 | case 255: |
| 1678 | default: | 1801 | default: |
| 1679 | #ifdef BYTE_CODE_SAFE | 1802 | #ifdef BYTE_CODE_SAFE |