propagate much more source info through compilation
authorAndy Wingo <wingo@pobox.com>
Tue, 10 Feb 2009 10:53:23 +0000 (11:53 +0100)
committerAndy Wingo <wingo@pobox.com>
Tue, 10 Feb 2009 10:53:23 +0000 (11:53 +0100)
commit028e3d06665d4eb50b5d0f0d0101acc039c2ae68
treee101393d98ca1fc67b724822bf0fb2e0d531aaf9
parentdae318a63140ac7b1f396440bc341fea901be9b9
propagate much more source info through compilation

* module/language/ghil/compile-glil.scm (codegen): Record source location
  for offset 0 into a lambda, if we can.

* module/language/scheme/compile-ghil.scm (translate-1)
  (define-scheme-translator): In the retrans procedures, propagate the
  location information from the enclosing expression if the subexpression
  has no location information. Gives source information to many more
  expressions.
  (location): Just propagate the source properties as they are, the
  glil->assembly compiler will interpret them.

* module/language/glil.scm (<glil>): Change glil-source to take "props"
  and not "loc", as it's the source properties that we're interested in.

* module/language/glil/compile-assembly.scm (limn-sources): New function,
  takes a list of addr-source property pairs and "compresses" them for
  serialization to disk.
  (glil->assembly): Limn the sources before writing them to disk. Avoid
  non-tail recursion when determining total byte length of code.

* module/system/vm/program.scm (source:file, source:line, source:column):
  Update for new source representation.
  (program-source): Export.
  (write-program): Nicer pretty-printing of anonymous procedures.

* libguile/backtrace.c (display_backtrace_get_file_line): Update for the
  new VM source representation.

* libguile/programs.h:
* libguile/programs.c (scm_program_sources): Update for the new
  serialized source representation, where the filename is not in the
  stream unless it changes.
  (scm_program_source): New exported function, looks up the source for a
  given ip offset.
  (scm_c_program_source): Update to return the last source information
  that was <= the given IP, because we only serialize source info when it
  changes.
libguile/backtrace.c
libguile/programs.c
libguile/programs.h
module/language/ghil/compile-glil.scm
module/language/glil.scm
module/language/glil/compile-assembly.scm
module/language/scheme/compile-ghil.scm
module/system/vm/program.scm