[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 2b6a1c98df: Byte compiler: remove symbol positions from byte-swit
From: |
Alan Mackenzie |
Subject: |
master 2b6a1c98df: Byte compiler: remove symbol positions from byte-switch tables |
Date: |
Mon, 18 Apr 2022 06:23:25 -0400 (EDT) |
branch: master
commit 2b6a1c98dfba09d6922f1074047853366d26e31e
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>
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.
---
lisp/emacs-lisp/bytecomp.el | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index c39d931517..43648fa657 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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 2b6a1c98df: Byte compiler: remove symbol positions from byte-switch tables,
Alan Mackenzie <=