diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2020-02-21 12:16:20 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2020-02-25 16:40:11 +0100 |
commit | 03c07c88d90b5747456b9d286bace2dd4a713aac (patch) | |
tree | bc5df98ed38273b010731c2c380b69758b237b56 /lisp/emacs-lisp/bytecomp.el | |
parent | 64af3c94a6197cd0c6a283880c900eeb5bf12961 (diff) | |
download | emacs-03c07c88d90b5747456b9d286bace2dd4a713aac.tar.gz emacs-03c07c88d90b5747456b9d286bace2dd4a713aac.tar.bz2 emacs-03c07c88d90b5747456b9d286bace2dd4a713aac.zip |
Generate 'substring' byte op (bug#39709)
The 'substring' byte op was not emitted, apparently by mistake. Fix.
Suggested by Mark Oteiza <mvoteiza@udel.edu>.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add '1-3' clause.
(byte-compile-one-to-three-args): New.
* lisp/emacs-lisp/byte-opt.el (byte-compile-side-effect-free-ops):
Add 'byte-substring'.
* test/lisp/emacs-lisp/bytecomp-tests.el
(byte-opt-testsuite-arith-data): Test 'substring'.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 24a36393b2e..63348456a15 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3487,7 +3487,7 @@ the opcode to be used. If function is a list, the first element is the function and the second element is the bytecode-symbol. The second element may be nil, meaning there is no opcode. COMPILE-HANDLER is the function to use to compile this byte-op, or -may be the abbreviations 0, 1, 2, 3, 0-1, or 1-2. +may be the abbreviations 0, 1, 2, 2-and, 3, 0-1, 1-2, 1-3, or 2-3. If it is nil, then the handler is \"byte-compile-SYMBOL.\"" (let (opcode) (if (symbolp function) @@ -3506,6 +3506,7 @@ If it is nil, then the handler is \"byte-compile-SYMBOL.\"" (0-1 . byte-compile-zero-or-one-arg) (1-2 . byte-compile-one-or-two-args) (2-3 . byte-compile-two-or-three-args) + (1-3 . byte-compile-one-to-three-args) ))) compile-handler (intern (concat "byte-compile-" @@ -3690,6 +3691,13 @@ These implicitly `and' together a bunch of two-arg bytecodes." ((= len 4) (byte-compile-three-args form)) (t (byte-compile-subr-wrong-args form "2-3"))))) +(defun byte-compile-one-to-three-args (form) + (let ((len (length form))) + (cond ((= len 2) (byte-compile-three-args (append form '(nil nil)))) + ((= len 3) (byte-compile-three-args (append form '(nil)))) + ((= len 4) (byte-compile-three-args form)) + (t (byte-compile-subr-wrong-args form "1-3"))))) + (defun byte-compile-noop (_form) (byte-compile-constant nil)) |