diff options
| author | Stefan Monnier | 2011-02-21 15:12:44 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2011-02-21 15:12:44 -0500 |
| commit | 3e21b6a72b87787e2327513a44623b250054f77d (patch) | |
| tree | 26831a9b700810d4f9cebe90afe2a090ae865604 /src/bytecode.c | |
| parent | e0f57e65692ed73a86926f737388b60faec92767 (diff) | |
| download | emacs-3e21b6a72b87787e2327513a44623b250054f77d.tar.gz emacs-3e21b6a72b87787e2327513a44623b250054f77d.zip | |
Use offsets relative to top rather than bottom for stack refs
* lisp/emacs-lisp/byte-opt.el (byte-compile-side-effect-and-error-free-ops):
Remove interactive-p.
(byte-optimize-lapcode): Update optimizations now that stack-refs are
relative to the top rather than to the bottom.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode):
Turn stack-ref-0 into dup.
(byte-compile-form): Don't indirect-function since it can signal
errors.
(byte-compile-stack-ref, byte-compile-stack-set): Adjust to stack-refs
being relative to top rather than to bottom in the byte-code.
(with-output-to-temp-buffer): Remove.
(byte-compile-with-output-to-temp-buffer): Remove.
* lisp/emacs-lisp/cconv.el: Use lexical-binding.
(cconv--lookup-let): Rename from cconv-lookup-let.
(cconv-closure-convert-rec): Fix handling of captured+mutated
arguments in defun/defmacro.
* lisp/emacs-lisp/eieio-comp.el (eieio-byte-compile-file-form-defmethod):
Rename from byte-compile-file-form-defmethod.
Don't byte-compile-lambda.
(eieio-byte-compile-defmethod-param-convert): Rename from
byte-compile-defmethod-param-convert.
* lisp/emacs-lisp/eieio.el (eieio-defgeneric-form-primary-only-one):
Call byte-compile rather than byte-compile-lambda.
* src/alloc.c (Fgarbage_collect): Don't mark the byte-stack redundantly.
* src/bytecode.c (exec_byte_code): Change stack_ref and stack_set to use
offsets relative to top rather than to bottom.
* lisp/subr.el (with-output-to-temp-buffer): New macro.
* lisp/simple.el (count-words-region): Don't use interactive-p.
Diffstat (limited to 'src/bytecode.c')
| -rw-r--r-- | src/bytecode.c | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/src/bytecode.c b/src/bytecode.c index ad2f7d18ade..b2e9e3c5b56 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 */ | 54 | #define BYTE_CODE_SAFE |
| 55 | /* #define BYTE_CODE_METER */ | 55 | /* #define BYTE_CODE_METER */ |
| 56 | 56 | ||
| 57 | 57 | ||
| @@ -88,7 +88,7 @@ extern Lisp_Object Qand_optional, Qand_rest; | |||
| 88 | 88 | ||
| 89 | /* Byte codes: */ | 89 | /* Byte codes: */ |
| 90 | 90 | ||
| 91 | #define Bstack_ref 0 | 91 | #define Bstack_ref 0 /* Actually, Bstack_ref+0 is not implemented: use dup. */ |
| 92 | #define Bvarref 010 | 92 | #define Bvarref 010 |
| 93 | #define Bvarset 020 | 93 | #define Bvarset 020 |
| 94 | #define Bvarbind 030 | 94 | #define Bvarbind 030 |
| @@ -189,8 +189,8 @@ extern Lisp_Object Qand_optional, Qand_rest; | |||
| 189 | 189 | ||
| 190 | #define Bunwind_protect 0216 | 190 | #define Bunwind_protect 0216 |
| 191 | #define Bcondition_case 0217 | 191 | #define Bcondition_case 0217 |
| 192 | #define Btemp_output_buffer_setup 0220 | 192 | #define Btemp_output_buffer_setup 0220 /* Obsolete. */ |
| 193 | #define Btemp_output_buffer_show 0221 | 193 | #define Btemp_output_buffer_show 0221 /* Obsolete. */ |
| 194 | 194 | ||
| 195 | #define Bunbind_all 0222 /* Obsolete. */ | 195 | #define Bunbind_all 0222 /* Obsolete. */ |
| 196 | 196 | ||
| @@ -898,9 +898,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 898 | 898 | ||
| 899 | case Bsave_window_excursion: /* Obsolete. */ | 899 | case Bsave_window_excursion: /* Obsolete. */ |
| 900 | { | 900 | { |
| 901 | register Lisp_Object val; | ||
| 902 | register int count = SPECPDL_INDEX (); | 901 | register int count = SPECPDL_INDEX (); |
| 903 | |||
| 904 | record_unwind_protect (Fset_window_configuration, | 902 | record_unwind_protect (Fset_window_configuration, |
| 905 | Fcurrent_window_configuration (Qnil)); | 903 | Fcurrent_window_configuration (Qnil)); |
| 906 | BEFORE_POTENTIAL_GC (); | 904 | BEFORE_POTENTIAL_GC (); |
| @@ -940,7 +938,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 940 | break; | 938 | break; |
| 941 | } | 939 | } |
| 942 | 940 | ||
| 943 | case Btemp_output_buffer_setup: | 941 | case Btemp_output_buffer_setup: /* Obsolete. */ |
| 944 | BEFORE_POTENTIAL_GC (); | 942 | BEFORE_POTENTIAL_GC (); |
| 945 | CHECK_STRING (TOP); | 943 | CHECK_STRING (TOP); |
| 946 | temp_output_buffer_setup (SSDATA (TOP)); | 944 | temp_output_buffer_setup (SSDATA (TOP)); |
| @@ -948,7 +946,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 948 | TOP = Vstandard_output; | 946 | TOP = Vstandard_output; |
| 949 | break; | 947 | break; |
| 950 | 948 | ||
| 951 | case Btemp_output_buffer_show: | 949 | case Btemp_output_buffer_show: /* Obsolete. */ |
| 952 | { | 950 | { |
| 953 | Lisp_Object v1; | 951 | Lisp_Object v1; |
| 954 | BEFORE_POTENTIAL_GC (); | 952 | BEFORE_POTENTIAL_GC (); |
| @@ -1710,26 +1708,42 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 1710 | #endif | 1708 | #endif |
| 1711 | 1709 | ||
| 1712 | /* Handy byte-codes for lexical binding. */ | 1710 | /* Handy byte-codes for lexical binding. */ |
| 1713 | case Bstack_ref: | 1711 | /* case Bstack_ref: */ /* Use `dup' instead. */ |
| 1714 | case Bstack_ref+1: | 1712 | case Bstack_ref+1: |
| 1715 | case Bstack_ref+2: | 1713 | case Bstack_ref+2: |
| 1716 | case Bstack_ref+3: | 1714 | case Bstack_ref+3: |
| 1717 | case Bstack_ref+4: | 1715 | case Bstack_ref+4: |
| 1718 | case Bstack_ref+5: | 1716 | case Bstack_ref+5: |
| 1719 | PUSH (stack.bottom[op - Bstack_ref]); | 1717 | { |
| 1720 | break; | 1718 | Lisp_Object *ptr = top - (op - Bstack_ref); |
| 1719 | PUSH (*ptr); | ||
| 1720 | break; | ||
| 1721 | } | ||
| 1721 | case Bstack_ref+6: | 1722 | case Bstack_ref+6: |
| 1722 | PUSH (stack.bottom[FETCH]); | 1723 | { |
| 1723 | break; | 1724 | Lisp_Object *ptr = top - (FETCH); |
| 1725 | PUSH (*ptr); | ||
| 1726 | break; | ||
| 1727 | } | ||
| 1724 | case Bstack_ref+7: | 1728 | case Bstack_ref+7: |
| 1725 | PUSH (stack.bottom[FETCH2]); | 1729 | { |
| 1726 | break; | 1730 | Lisp_Object *ptr = top - (FETCH2); |
| 1731 | PUSH (*ptr); | ||
| 1732 | break; | ||
| 1733 | } | ||
| 1734 | /* stack-set-0 = discard; stack-set-1 = discard-1-preserve-tos. */ | ||
| 1727 | case Bstack_set: | 1735 | case Bstack_set: |
| 1728 | stack.bottom[FETCH] = POP; | 1736 | { |
| 1729 | break; | 1737 | Lisp_Object *ptr = top - (FETCH); |
| 1738 | *ptr = POP; | ||
| 1739 | break; | ||
| 1740 | } | ||
| 1730 | case Bstack_set2: | 1741 | case Bstack_set2: |
| 1731 | stack.bottom[FETCH2] = POP; | 1742 | { |
| 1732 | break; | 1743 | Lisp_Object *ptr = top - (FETCH2); |
| 1744 | *ptr = POP; | ||
| 1745 | break; | ||
| 1746 | } | ||
| 1733 | case BdiscardN: | 1747 | case BdiscardN: |
| 1734 | op = FETCH; | 1748 | op = FETCH; |
| 1735 | if (op & 0x80) | 1749 | if (op & 0x80) |