Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix O(n^2) length calls in compact-ir lowering step #50756

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -4980,6 +4980,7 @@ f(x) = yt(x)
(let ((code '(block))
(locs '(list))
(linetable '(list))
(linetablelen 0)
(labltable (table))
(ssavtable (table))
(current-loc 0)
Expand All @@ -4992,6 +4993,7 @@ f(x) = yt(x)
(if (and (null? (cdr linetable))
(not (and (pair? e) (eq? (car e) 'meta))))
(begin (set! linetable (cons (make-lineinfo name file line) linetable))
(set! linetablelen (+ linetablelen 1))
(set! current-loc 1)))
(set! code (cons e code))
(set! i (+ i 1))
Expand All @@ -5013,13 +5015,15 @@ f(x) = yt(x)
(make-lineinfo name current-file current-line)
(make-lineinfo name current-file current-line (caar locstack)))
linetable))
(set! current-loc (- (length linetable) 1)))))
(set! linetablelen (+ linetablelen 1))
(set! current-loc linetablelen))))
((and (length> e 2) (eq? (car e) 'meta) (eq? (cadr e) 'push_loc))
(set! locstack (cons (list current-loc current-line current-file) locstack))
(set! current-file (caddr e))
(set! current-line 0)
(set! linetable (cons (make-lineinfo name current-file current-line current-loc) linetable))
(set! current-loc (- (length linetable) 1)))
(set! linetablelen (+ linetablelen 1))
(set! current-loc linetablelen))
((and (length= e 2) (eq? (car e) 'meta) (eq? (cadr e) 'pop_loc))
(let ((l (car locstack)))
(set! locstack (cdr locstack))
Expand Down