1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00
Commit graph

19 commits

Author SHA1 Message Date
Andy Wingo
0bd1e9c6a0 rtl-program? -> program?
* libguile/programs.c (scm_program_p): Rename from scm_rtl_program_p.
  Changes name also from rtl-program? to program?.

* libguile/programs.h:
* module/ice-9/session.scm:
* module/language/tree-il/analyze.scm:
* module/statprof.scm:
* module/system/repl/command.scm:
* module/system/repl/debug.scm:
* module/system/vm/coverage.scm:
* module/system/vm/disassembler.scm:
* module/system/vm/frame.scm:
* module/system/vm/program.scm:
* module/system/vm/traps.scm:
* module/system/xref.scm: Adapt.
2013-11-19 19:11:40 +01:00
Andy Wingo
147f9978ba Rewrite (system xref) to work with RTL programs
* module/system/xref.scm (nested-procedures): New helper.
  (program-callee-rev-vars): Rewrite using fold-program-code and
  nested-procedures.
  (add-sources, forget-sources): Use match instead of pmatch.  Use
  nested-procedures.
2013-11-08 16:31:29 +01:00
Andy Wingo
342370bd56 minimal RTL program support in (system xref)
* module/system/xref.scm (procedure-sources*): Work with RTL programs.
2013-10-17 23:20:32 +02:00
Andy Wingo
783eeee657 system xref maintains source mapping for nested procedures too
* module/system/xref.scm (*closure-sources-db*): New global, like
  *sources-db* but for nested procedures. It's a separate map because
  these procs need to be treated differently in trap handlers -- you
  match on the bytecode, not on the program object.
  (add-source, forget-source): Take the db as an argument (the normal db
  or the closures db).
  (add-sources, forget-sources): Record sources for nested procedures to
  in *closures-db*.
  (untaint-sources, ensure-sources-db): Adapt for new closures db.
  (lookup-source-procedures): Factored out.
  (source-closures): New exported procedure, returns closures at the
  given source location.
2010-09-24 13:24:48 +02:00
Andy Wingo
664a8b0d66 new procedure: source-procedures
* module/system/xref.scm (source-procedures): New public procedure,
  gives the procedures defined at a given source location.
2010-09-10 13:29:56 +02:00
Andy Wingo
348fb7040f (system xref) uses module-submodules
* module/system/xref.scm (ensure-callers-db): Fix up to use
  module-submodules.
2010-09-10 12:55:09 +02:00
Andy Wingo
9b023f3c63 use nested-ref-module in (system xref)
* module/system/xref.scm (program-callee-rev-vars): Use
  nested-ref-module instead of nested-ref.
2010-04-24 17:42:00 +02:00
Andy Wingo
56164a5a6c de-nargs struct scm_objcode; procedure-property refactor
* libguile/objcodes.h (struct scm_objcode): Remove nargs, nrest, and
  nlocs, as they are no longer needed. Also obviates the need for a
  padding word.

* libguile/procs.c (scm_thunk_p): Use scm_i_program_arity for programs.

* libguile/procprop.c (scm_i_procedure_arity): Use scm_i_program_arity
  for programs.
  (scm_procedure_properties, scm_set_procedure_properties_x)
  (scm_procedure_property, scm_set_procedure_property_x): Rework so that
  non-closure properties are stored directly in a weak hash, instead of
  needing a weak hash of "stand-in" closures to hold the properties. Fix
  docstrings also.

* libguile/root.h (scm_stand_in_procs): Remove from the scm_sys_protects
  set. Actually with libGC, we should be able to store the elements of
  scm_sys_protects directly as global variables.
* libguile/gc.c (scm_init_storage): Remove scm_stand_in_procs
  initialization.

* libguile/programs.c (scm_i_program_arity): New private accessor, tries
  to determine the "minimum arity" of a program.

* libguile/vm.c (really_make_boot_program): Adapt to changes in
  struct scm_objcode.

* module/language/assembly.scm (*program-header-len*, byte-length):
* module/language/assembly/compile-bytecode.scm (write-bytecode):
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
* module/language/assembly/disassemble.scm (disassemble-load-program):
  Adapt to changes in objcode.

* module/system/xref.scm (program-callee-rev-vars): Adapt to changes in
  assembly.

* module/language/glil.scm: Remove nargs, nrest, and nlocs from
  glil-program.

* module/language/glil/compile-assembly.scm (make-meta, glil->assembly):
* module/language/glil/decompile-assembly.scm (decompile-toplevel):
  (decompile-load-program): Adapt to changes in GLIL and assembly.

* module/language/tree-il/compile-glil.scm (flatten-lambda): Adapt to
  changes in GLIL.

* test-suite/tests/asm-to-bytecode.test: Adapt to assembly and bytecode
  changes.
* test-suite/tests/tree-il.test: Adapt to GLIL changes.
2009-10-23 14:51:19 +02:00
Ludovic Courtès
d773ba231c Partially revert e5f5113c21.
The intent is to maintain the readability of `pmatch' invocations.

* module/language/assembly/disassemble.scm (disassemble-load-program):
  Don't use wildcards in `pmatch' invocations, even when the matched
  elements are unused.

* module/language/glil/decompile-assembly.scm (decompile-toplevel,
  decompile-load-program): Likewise.

* module/system/xref.scm (program-callee-rev-vars): Likewise.

* module/language/assembly.scm (byte-length): Likewise.

* module/language/tree-il/compile-glil.scm (flatten): Likewise.
2009-09-24 00:06:54 +02:00
Ludovic Courtès
e5f5113c21 Remove unused variables in system/language.
* module/language/assembly.scm (byte-length): Don't match unused
  record slots.

* module/language/tree-il.scm (tree-il->scheme, post-order!,
  pre-order!): Likewise.

* module/language/tree-il/analyze.scm (analyze-lexicals): Likewise.

* module/language/tree-il/compile-glil.scm (flatten): Likewise.

* module/language/assembly/disassemble.scm (disassemble-load-program):
  Don't match unused list elements.

* module/language/glil/decompile-assembly.scm (decompile-toplevel,
  decompile-load-program): Likewise.

* module/system/xref.scm (program-callee-rev-vars): Likewise.

* module/language/assembly/compile-bytecode.scm
  (write-bytecode)[write-sized-loader]: Remove.

* module/language/assembly/decompile-bytecode.scm (decode-load-program):
  Factorize `pad' variables.

* module/language/ecmascript/base.scm (object->value/string,
  object->value/number)[v]: Remove.

* module/language/ecmascript/tokenize.scm (read-slash)[c0]: Remove.

* module/language/objcode/spec.scm (decompile-value)[nargs]: Remove.

* module/system/repl/command.scm (time)[vms-start, vms-end]: Remove.

* module/system/repl/repl.scm (prompting-meta-read): Use `prompt'.
2009-09-21 00:36:31 +02:00
Andy Wingo
94ff26b96b rework the vm support for wide strings
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.

* libguile/vm-engine.c (vm_error_bad_wide_string_length): New error
  case.

* libguile/vm-i-loader.c (load-unsigned-integer, load-integer)
  (load-keyword): Remove these instructions. The former two are
  obsoleted by make-int64/make-uint64, the latter via make-keyword.
  (load-string): Only handle narrow strings.
  (load-symbol): Only handle narrow symbols. The wide case is handled
  via make-symbol.
  (load-wide-string): New instruction, for wide strings.

* libguile/vm-i-system.c (define): Move here from loaders.c, as now it
  just takes a sym on the stack.
  (make-keyword, make-symbol): New instructions.

* module/language/assembly.scm: Remove removed instructions. No more
  width byte in load-string etc.

* module/language/assembly/compile-bytecode.scm (write-bytecode): Adapt
  to change in instruction set.

* module/language/glil/compile-assembly.scm (glil->assembly): Compile
  define by pushing the sym then emitting (define).
  (dump-object): Dump narrow and wide strings differently. Use
  make-keyword and make-symbol as appropriate.

* module/language/tree-il/compile-glil.scm (flatten): When compiling a
  ref to a primitive (not a call), first see if the primitive is
  actually bound in the root module. (That's not the case with e.g.
  bytevector-u8-ref).

* module/system/xref.scm (program-callee-rev-vars): Don't parse out
  "nexts".

* test-suite/tests/asm-to-bytecode.test ("compiler"): Adapt to bytecode
  format change.
2009-08-12 16:34:05 +02:00
Jose A. Ortega Ruiz
aa49787b5e Improved handling of callers cache in (system xref).
* We cache callees in each module, and keep a list of modified
    ('tainted') modules, which is used to reconstruct the callers
    database incrementally.
  * `procedure-callers' now returns an a-list, keyed by module name.
2009-04-04 11:55:50 -07:00
Andy Wingo
6ecae97fb8 fix duplicates in procedure-callers
* module/system/xref.scm (ensure-callers-db): OK! Since we can see the
  same variable twice, e.g. in different modules, keep a unified hash of
  seen vars and modules. Prevents duplicates in procedure-callers.
2009-03-28 22:21:00 -07:00
Andy Wingo
154a611669 fix spurious duplicates in procedure-callees and callers
* module/system/xref.scm (program-callee-rev-vars): It's possible to get
  duplicates when combining callees of inner procedures, so ignore dups.
  Quadratic, boo.
2009-03-28 21:57:47 -07:00
Andy Wingo
e0a3ad670b rework procedure-callers to stay correct as callees are redefined
* module/system/xref.scm (procedure-callers): Rework to calculate the
  callers of a *variable*, not of a value. This is because the
  module-observers only get fired when the module changes, not with the
  variables change values. Also accept either a variable, a symbol
  (resolved in the current module), or a modname . symname pair.
2009-03-18 01:49:28 +01:00
Andy Wingo
7eba9c99c2 doubly-weak callers db
* module/system/xref.scm (ensure-callers-db): Store the callers db as a
  doubly-weak hash table.
2009-03-18 00:46:16 +01:00
Andy Wingo
b190790255 implement procedure-callers
* module/system/xref.scm: Implement procedure-callers, as the inverse of
  procedure-callees, with a cache invalidated by changes in modules.

* module/ice-9/boot-9.scm (module-use!): Don't poke module observers when
  module-use! is called for an already-used module.
2009-03-18 00:44:26 +01:00
Andy Wingo
4f96d42b2d add xref stub for interpreted procedures
* module/system/xref.scm (hacky-procedure-callees): Add a
  procedure-callees implementation for procedures with source, that
  currently does nothing. Not sure what to do, going into the future.
2009-03-17 23:16:35 +01:00
Andy Wingo
e04894e1ac add xref.scm
* module/system/xref.scm: New module, will provide callers/callees info.

* module/Makefile.am (SOURCES): Add xref.scm.
2009-03-17 23:11:56 +01:00