[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt 2542f24813 285/323: Tweak, rework, speed up m
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt 2542f24813 285/323: Tweak, rework, speed up main algorithm again |
Date: |
Thu, 9 Mar 2023 10:58:42 -0500 (EST) |
branch: externals/beardbolt
commit 2542f248132c8f94b7fb863bf1fdb4fe85a31a0b
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Tweak, rework, speed up main algorithm again
* beardbolt.el (bb--process-asm): Rework.
(bb--sweeping): Simplify.
(bb-set-directive): Delete.
---
beardbolt.el | 117 ++++++++++++++++++++++++++---------------------------------
1 file changed, 52 insertions(+), 65 deletions(-)
diff --git a/beardbolt.el b/beardbolt.el
index 4278ba8e73..b0b1c3f702 100644
--- a/beardbolt.el
+++ b/beardbolt.el
@@ -164,12 +164,6 @@ Useful if you have multiple objdumpers and want to select
between them")
(defvar bb-label-reference (rx (any ".a-zA-Z_")
(0+
(any "a-zA-Z0-9$_."))))
-(defvar bb-set-directive (rx bol (0+ space) ".set" (1+ space)
- (group (any ".a-zA-Z_")
- (0+ (any "a-zA-Z0-9$_.")))
- (0+ space) "," (0+ space)
- (group (any ".a-zA-Z_")
- (0+ (any "a-zA-Z0-9$_.")))))
(defvar bb-has-opcode (rx bol (1+ space)
(1+ (any "a-zA-Z"))))
@@ -326,14 +320,6 @@ Returns a list (SPEC ...) where SPEC looks like (WHAT FN
CMD)."
(cl-macrolet ((match (&rest res)
`(cl-loop for re in ,(cons 'list res)
thereis (re-search-forward re ,',lep t)))
- (match-label (re)
- `(and (not (eq (char-after) ?\t))
- (re-search-forward ,re ,',lep t)))
- (match-nolabel (&rest res)
- `(and
- (eq (char-after) ?\t)
- (cl-loop for re in ,(cons 'list res)
- thereis (re-search-forward re ,',lep t))))
(update-lep () `(setq ,',lep (line-end-position)))
(asm-linum () ',linum)
(preserve () `(progn
@@ -376,7 +362,6 @@ Returns a list (SPEC ...) where SPEC looks like (WHAT FN
CMD)."
(defun bb--process-asm ()
(let ((used-labels (obarray-make))
- (synonyms (make-hash-table :test #'equal))
(src-file-name "<stdin>")
(source-file-map (make-hash-table :test #'eq))
source-linum
@@ -385,56 +370,58 @@ Returns a list (SPEC ...) where SPEC looks like (WHAT FN
CMD)."
(preserve-comments (buffer-local-value 'bb-preserve-comments
bb--source-buffer))
(preserve-labels (buffer-local-value 'bb-preserve-labels
bb--source-buffer))
(_preserve-weak-symbols (buffer-local-value 'bb-preserve-weak-symbols
bb--source-buffer)))
- (bb--sweeping
- ((match-label bb-label-start)
- (when (intern-soft (match-string 1) used-labels)
- (setq global-label (match-string 1)))
- :preserve)
- ((match-nolabel bb-has-opcode)
- (when global-label
- (while (match bb-label-reference)
- (intern (match-string 0) used-labels)))
- :preserve)
- ((and (not preserve-comments) (match-nolabel bb-comment-only)) :kill)
- ((match-nolabel bb-defines-global bb-defines-function-or-object)
- (intern (match-string 1) used-labels))
- ((match-nolabel bb-source-file-hint)
- (puthash (string-to-number (match-string 1))
- (or (match-string 3) (match-string 2))
- source-file-map))
- ((match-nolabel bb-endblock) (setq global-label nil)
- :preserve)
- ((match-nolabel bb-set-directive)
- (puthash (match-string 2) (match-string 1) synonyms))
- (t :preserve))
- ;; second pass
- (bb--sweeping
- ((and (match-nolabel bb-data-defn) reachable-label)
- :preserve)
- ((and (match-nolabel bb-has-opcode) reachable-label)
- (when source-linum (bb--register-mapping source-linum (asm-linum)))
- :preserve)
- ((match-label bb-label-start)
- (cond
- ((intern-soft (match-string 1) used-labels)
- (setq reachable-label (match-string 1))
- :preserve)
- (t
- (if preserve-labels :preserve :kill))))
- ((match-nolabel bb-source-tag)
- (setq source-linum
- (and (equal src-file-name
- (gethash
- (string-to-number (match-string 1))
- source-file-map))
- (string-to-number (match-string 2)))))
- ((match-nolabel bb-source-stab)
- (pcase (string-to-number (match-string 1))
- ;; http://www.math.utah.edu/docs/info/stabs_11.html
- (68 (setq source-linum (match-string 2)))
- ((or 100 132) (setq source-linum nil))))
- ((match-nolabel bb-endblock)
- (setq reachable-label nil)))))
+ (bb--sweeping ; first pass
+ ((not (eq (char-after) ?\t))
+ (cond ((match bb-label-start)
+ (when (intern-soft (match-string 1) used-labels)
+ (setq global-label (match-string 1)))
+ :preserve)
+ (t :kill)))
+ (t
+ (cond ((match bb-has-opcode)
+ (when global-label
+ (while (match bb-label-reference)
+ (intern (match-string 0) used-labels)))
+ :preserve)
+ ((and (not preserve-comments) (match bb-comment-only)) :kill)
+ ((match bb-defines-global bb-defines-function-or-object)
+ (intern (match-string 1) used-labels))
+ ((match bb-source-file-hint)
+ (puthash (string-to-number (match-string 1))
+ (or (match-string 3) (match-string 2))
+ source-file-map))
+ ((match bb-endblock) (setq global-label nil)
+ :preserve)
+ (t :preserve))))
+ (bb--sweeping ; second pass
+ ((not (eq (char-after) ?\t))
+ (when (match bb-label-start)
+ (cond
+ ((intern-soft (match-string 1) used-labels)
+ (setq reachable-label (match-string 1))
+ :preserve)
+ (t
+ (if preserve-labels :preserve :kill)))))
+ (t
+ (cond ((and (match bb-data-defn) reachable-label)
+ :preserve)
+ ((and (match bb-has-opcode) reachable-label)
+ (when source-linum (bb--register-mapping source-linum
(asm-linum)))
+ :preserve)
+ ((match bb-source-tag)
+ (setq source-linum
+ (and (equal src-file-name
+ (gethash
+ (string-to-number (match-string 1))
+ source-file-map))
+ (string-to-number (match-string 2)))))
+ ((match bb-source-stab)
+ (pcase (string-to-number (match-string 1))
+ ;; http://www.math.utah.edu/docs/info/stabs_11.html
+ (68 (setq source-linum (match-string 2)))
+ ((or 100 132) (setq source-linum nil))))
+ ((match bb-endblock)
+ (setq reachable-label nil)))))))
(cl-defun bb--rainbowize (src-buffer)
(bb--delete-rainbow-overlays)
- [elpa] externals/beardbolt 4f4a7f85ac 223/323: Simplify visibility check logic, (continued)
- [elpa] externals/beardbolt 4f4a7f85ac 223/323: Simplify visibility check logic, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3a1e068bb8 228/323: Don't update overlays if the src buffer is no longer current, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt b56d3b6cdb 245/323: Merge branch 'improve-starters' into 'master', ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 16f887917b 252/323: Improve rainbow color selection algorithm, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 9bc7e8aeb8 236/323: Remove `rmsbolt--post-command-hook` when mode is deactivated, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 660739681c 254/323: Rename every rms* file to beard*, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f846655a35 250/323: Rework rmsbolt-rainbowize to reuse more code, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 78eed53af1 260/323: Don't hang a "[Compiling]" forever in the mode-line, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt b71d1bd763 265/323: * beardbolt.el (bb-compile): Fix handling of bb-asm-format., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 4cbe58f834 279/323: Add -g1 instead of -g to speed it up massively, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2542f24813 285/323: Tweak, rework, speed up main algorithm again,
ELPA Syncer <=
- [elpa] externals/beardbolt 85bc714336 295/323: Simplify source file tracking, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt c5086ea624 294/323: bb--output-mode now a major mode, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 298a5fe6a2 296/323: Fix starter/beardbolt.cpp, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 067096f3b9 299/323: Friendlier beardbolt--output-mode, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 0ae21a302a 302/323: Simplify window management in preparation of beardbolt-execute-program, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 842b2159da 305/323: More simplification, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 60d189b0a6 310/323: Advertise beardbolt-execute and a few other things, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt c374b17f5c 314/323: Don't require file to be saved, but do take advantage if it is, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 4a050afaaa 315/323: Attempt to fix more window management bugs, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 0d61c2edac 311/323: Add support for rustc, ELPA Syncer, 2023/03/09