1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 16:50:21 +02:00

psyntax: Pass source vectors to tree-il constructors.

Avoiding systematic conversion from source vectors to property alists
saves 20% on the final heap size of a process doing:

  (compile-file FILE #:optimization-level 1)

where FILE is large.

* module/language/tree-il.scm (tree-il-src/ensure-alist): New procedure
with setter.  Export as 'tree-il-src'.
* module/ice-9/psyntax.scm (build-void, build-call)
(build-conditional, build-lexical-reference, build-lexical-assignment)
(build-global-reference, build-global-assignment)
(build-global-definition, build-simple-lambda, build-case-lambda)
(build-lambda-case, build-primcall, build-primref)
(build-data, build-sequence, build-let, build-named-let)
(build-letrec, expand-body): Remove (sourcev->alist src) calls.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/language/tree-il/analyze.scm (shadowed-toplevel-analysis): Use
'tree-il-src' instead of accessing the 'src' slot directly.
* module/system/vm/assembler.scm (link-debug): Adjust so PC can be
followed by a vector or an alist.
This commit is contained in:
Ludovic Courtès 2022-02-06 17:44:51 +01:00
parent 032acdeac9
commit 2aed3c117c
5 changed files with 105 additions and 116 deletions

View file

@ -2821,10 +2821,16 @@ procedure with label @var{rw-init}. @var{rw-init} may be false. If
(let lp ((sources (asm-sources asm)) (out '()))
(match sources
(((pc . s) . sources)
(let ((file (assq-ref s 'filename))
(line (assq-ref s 'line))
(col (assq-ref s 'column)))
(((pc . location) . sources)
(let-values (((file line col)
;; Usually CPS records contain a "source
;; vector" coming from tree-il, but some might
;; contain a source property alist.
(match location
(#(file line col) (values file line col))
(lst (values (assq-ref lst 'filename)
(assq-ref lst 'line)
(assq-ref lst 'column))))))
(lp sources
;; Guile line and column numbers are 0-indexed, but
;; they are 1-indexed for DWARF.