summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2022-04-18 10:19:54 +0000
committerAlan Mackenzie <acm@muc.de>2022-04-18 10:19:54 +0000
commit2b6a1c98dfba09d6922f1074047853366d26e31e (patch)
treee9b2c93625499c186801c629cd084c963de90d8b /lisp/emacs-lisp
parentd5f2305187fa96c5eb427e685f68b90da394e09b (diff)
downloademacs-2b6a1c98dfba09d6922f1074047853366d26e31e.tar.gz
emacs-2b6a1c98dfba09d6922f1074047853366d26e31e.tar.bz2
emacs-2b6a1c98dfba09d6922f1074047853366d26e31e.zip
Byte compiler: remove symbol positions from byte-switch tables
This fixes bug #54990. * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Remove positions from symbols with positions in byte-switch tables, by temporarily removing the entries from the table, and reinserting them amended.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el23
1 files changed, 16 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index c39d931517e..43648fa657b 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1009,13 +1009,22 @@ CONST2 may be evaluated multiple times."
;; Similarly, replace TAGs in all jump tables with the correct PC index.
(dolist (hash-table byte-compile-jump-tables)
- (maphash #'(lambda (value tag)
- (setq pc (cadr tag))
- ;; We don't need to split PC here, as it is stored as a lisp
- ;; object in the hash table (whereas other goto-* ops store
- ;; it within 2 bytes in the byte string).
- (puthash value pc hash-table))
- hash-table))
+ (let (alist)
+ (maphash #'(lambda (value tag)
+ (setq pc (cadr tag))
+ ;; We don't need to split PC here, as it is stored as a
+ ;; lisp object in the hash table (whereas other goto-*
+ ;; ops store it within 2 bytes in the byte string).
+ ;; De-position any symbols with position in `value'.
+ ;; Since this may change the hash table key, we remove
+ ;; the entry from the table and reinsert it outside the
+ ;; scope of the `maphash'.
+ (setq value (byte-run-strip-symbol-positions value))
+ (push (cons value pc) alist)
+ (remhash value hash-table))
+ hash-table)
+ (dolist (elt alist)
+ (puthash (car elt) (cdr elt) hash-table))))
(let ((bytecode (apply 'unibyte-string (nreverse bytes))))
(when byte-native-compiling
;; Spill LAP for the native compiler here.