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

114 commits

Author SHA1 Message Date
Andy Wingo
542f975e60 add ,registers
* libguile/frames.h:
* libguile/frames.c (scm_frame_stack_pointer): New function.

* module/system/repl/debug.scm (print-registers): New function, prints
  out registers.

* module/system/repl/command.scm (registers): New debugging
  meta-command.
  (inspect): Not a stack-command, a normal meta-command.
2010-09-30 21:29:20 +02:00
Andy Wingo
3e2c5f1ef3 fix ,traps REPL command
* module/system/repl/command.scm (traps): Fix this REPL meta-command.
2010-09-24 17:33:17 +02:00
Andy Wingo
fb5c4dc523 add ,break-at-source
* module/system/vm/trap-state.scm (add-trap-at-source-location!): New
  proc.
* module/system/repl/command.scm (break-at-source): New repl
  meta-command. Doesn't work as well as it could now because it doesn't
  know about nested functions, but that's coming.
2010-09-23 17:49:55 +02:00
Andy Wingo
665196884f list-traps just returns trap identifiers, not names
* module/system/vm/trap-state.scm (list-traps): Just return the integers
  identifying the traps; people can use trap-name to get the names.

* module/system/repl/command.scm (traps): Adapt.
2010-09-23 17:26:12 +02:00
Andy Wingo
957205339a more uniform break / tracepoint printing in repl
* module/system/repl/command.scm (break, tracepoint): In the message,
  use the trap-name.
2010-09-23 17:20:57 +02:00
Andy Wingo
25361a80fe add repl ,tracepoint command
* module/system/vm/trace.scm (print-return, print-application)
  (frame-return-values): Factored out of other things.
  (trace-calls-to-procedure): New proc, installs a trap tracing only
  calls to the given proc.
  (trace-calls-in-procedure): Refactor a bit.

* module/system/vm/trap-state.scm (add-trace-at-procedure-call!): New
  proc.

* module/system/repl/command.scm (tracepoint): New command, installs a
  tracepoint on a procedure.
2010-09-23 13:47:03 +02:00
Andy Wingo
d8e2ba23fc (system repl command) cleanups
* module/system/repl/command.scm (profile, trace, inspect)
  (pretty-print): Use repl-prepare-eval-thunk instead of the lower-level
  compile and make-program.
2010-09-21 21:48:09 +02:00
Andy Wingo
589520bc59 add ,traps ,delete ,disable ,enable
* module/system/repl/command.scm (traps, delete, disable, enable): New
  meta-commands.
2010-09-19 11:32:47 +02:00
Andy Wingo
b9badc35ab implement breakpoints in the repl
* module/system/vm/trap-state.scm: New file, tracks a VM-specific set of
  traps.
* module/Makefile.am: Add trap-state.scm.

* module/system/repl/error-handling.scm: While in a with-error-handling
  block, bind a default trap handler that invokes a recursive prompt.

* module/system/repl/command.scm: Add a `break' repl meta-command.
2010-09-19 11:32:11 +02:00
Jose A. Ortega Ruiz
54d9a994b1 Add new debug meta-command ,error-message
* module/system/repl/error-handling.scm: use the error string to
  construct the <debug> instance.

* module/system/repl/command.scm: new debug command `error-message'
  that extracts the new <debug> field, available to stack commands as
  `message'.

* doc/ref/scheme-using.texi: documentation for new command.

* module/system/repl/debug.scm: <debug> stores the error string in a
  new field.
2010-08-31 13:47:56 +02:00
Andy Wingo
019fdc97d9 updates to system repl command
* module/system/repl/command.scm (help): Update docs on how to get help
  on a particular command.
  (load): Remove #:f flag.
2010-07-16 17:35:43 +02:00
Andy Wingo
c27d140ab4 validating repl options; value-history on by default
* module/system/repl/common.scm: Use (ice-9 history). Turns on value
  history by default.
  (repl-default-options): Expand the format of options to include an
  optional value transformer, run when setting a value. Add prompt and
  value-history options.
  (repl-prepare-eval-thunk): Use repl-option-ref.
  (repl-option-ref): Error if the option is unknown.
  (repl-option-set!, repl-default-option-set!): Error if the option is
  unknown. Pass the val through the transformer procedure.
  (repl-default-prompt-set!): Just use repl-default-option-set!.

* module/system/repl/command.scm (option): Update for the new options
  format.
2010-07-10 11:19:19 +02:00
Andy Wingo
0ddbd88321 fix up a repl command docstring
* module/system/repl/command.scm (procedure): Fix up docstring.
2010-07-09 18:39:15 +02:00
Andy Wingo
3ae78d95e6 tweaks to new repl
* module/system/repl/command.scm (read-command): Remove a pk.
* module/system/repl/repl.scm (run-repl): Export. Use % and abort to
  implement the prompt.
2010-07-09 18:22:08 +02:00
Andy Wingo
33df2ec719 integrate the debugger into the repl
* module/system/repl/debug.scm: New file, defines a data type to hold
  state for a debugger stack, and some helper procedures to print the
  stack or print a frame. Most pieces are from (system vm debug).

* module/system/repl/error-handling.scm: New file, implements
  call-with-error-handling and with-error-handling, and instead of going
  into a debugger, we go into a recursive repl that happens to have
  debugging information. Will be removing the old debugger from (system
  vm debug) shortly.

* module/Makefile.am (SYSTEM_SOURCES): Add error-handling and debug scm
  files.

* module/system/repl/repl.scm (prompting-meta-read): Better error
  handling -- we don't want to go into a debugger when reading a
  command.
  (start-repl): Add #:debug keyword argument, and just dispatch to
  run-repl.
  (run-repl): New function, with the guts of the old start-repl. Added a
  prompt, to which a throw to 'quit will abort.

* module/system/repl/common.scm (repl-prepare-eval-thunk): New
  helper. In the future we will use this to not enter the debugger on
  errors that happen at compile time.
  (repl-eval): Use repl-prepare-eval-thunk.
  (repl-print): Run the before-print-hook when printing a value.

* module/system/repl/command.scm (*command-table*): Move `option' to the
  `system' group. Move `trace' to the `profile' group. Add `debug' and
  `inspect' groups.
  (command-abbrevs): Rename from command-abbrev, and allow multiple
  abbreviations.
  (display-group): Fix the case where abbrev? was #f.
  (display-summary): Fix alignment of the command and
  abbreviations. Allow multiple abbreviations.
  (read-command): Rename from read-datum, and have better error
  handling.
  (meta-command): Better error handling.
  (define-meta-command): Better error handling.
  (help, show, import, compile, disassemble, time, profile, trace): Fix
  docstrings and error messages.
  (define-stack-command): New helper, for commands that operate on a
  saved stack.
  (backtrace, up, down, frame, procedure, locals): New debugger
  commands, in the REPL now.
  (inspect, pretty-print): New "inspect" commands.
2010-07-09 17:05:25 +02:00
Andy Wingo
5b27d9d25e add repl inport and outport fields and accessors
* module/system/repl/common.scm (<repl>): Add inport and outport fields
  and accessors.
  (make-repl): Add optional "debug" argument. Bind inport and outport to
  the current inport and output ports at the time of repl creation.
  (repl-read): Read from the repl inport.
  (repl-print): Write to the repl outport.

* module/system/repl/command.scm (read-datum, read-line, meta-command):
  Respect repl-inport, and bind the outport of meta-commands to the repl
  outport.
2010-06-26 21:55:13 +02:00
Andy Wingo
fda1dd3860 allow kwargs to repl metacommands
* module/system/repl/command.scm (define-meta-command): Allow repl
  meta-commands to have optional or keyword arguments.
2010-06-26 21:46:42 +02:00
Andy Wingo
35d70eccac repl compiles with warnings by default
* module/system/repl/command.scm (compile): Remove the bitrotten
  options.

* module/system/repl/common.scm (repl-default-options): Add
  'compile-options option.
  (repl-compile-options): Accessor for compile-options.
  (repl-compile): Use repl-compile-options.
  (repl-eval): Adapt to repl-compile interface change.
2010-06-19 20:21:22 +02:00
Andy Wingo
4d75554d0a very important fix to (system repl command)
* module/system/repl/command.scm (language): s/Have fun/Happy hacking/.
  Heh.
2010-04-07 00:09:53 +02:00
Andy Wingo
dca9a4d685 make guile's welcome more gnu-conventional; also warranty and copying info
* module/system/repl/command.scm: Add support for ,show with topics
  "warranty", "copying", and "version".
  (language): Don't re-print the welcome; print sometime more terse.
* module/system/repl/common.scm (*version*, *warranty*, *copying*): New
  public globals.
  (repl-welcome): Display *version*.
2010-03-23 00:18:48 +01:00
Andy Wingo
01c0082fae remove repl-vm; repl evaluation does not cause recursive vm invocation
* module/system/repl/common.scm (<repl>): Remove "vm" field and repl-vm
  accessor. I think the correct model is to just use the-vm. This change
  was prompted by the need to have the REPL itself not cause a recursive
  VM invocation, so that captured prompts at the REPL are rewindable.
  (make-repl): Remove treatment of #:vm.
  (repl-eval): Load a compiled expression as a simple thunk, avoiding a
  recursive VM call.

* module/system/repl/command.scm (profile, trace): Remove repl-vm
  treatment.
  (backtrace, debugger, step): Remove, as they were not implemented.
2010-03-12 12:10:23 +01:00
Andy Wingo
e1138ba199 fix call counting in statprof, enhance repl support
* module/statprof.scm: Use VM modules, instead of using @ hacks.
  (statprof): New public export, a functional interface to the profiler.
  (profile-signal-handler, count-call, statprof-start, statprof-stop):
  Fix call counting with the VM.
  (statprof-call-data->stats): Hack around a case in which a call could
  be sampled but not counted, if you get my drift.
  (procedure=?): Update for current API.
  (with-statprof): Use `statprof'.

* module/system/repl/command.scm (profile): Use the `statprof'
  procedural interface.
2010-01-14 22:52:07 +01:00
Andy Wingo
7e9f96021a vm-trace only traces execution of its thunk
* module/system/vm/trace.scm (vm-trace): Change to just export the one
  procedure, vm-trace. This way it's threadsafe and more robust. Also
  refactor to not print any of Guile's internal bits. Hopefully Neil
  will be happier :)

* module/system/repl/command.scm (option): Adapt to removal of
  vm-trace-on! and vm-trace-off!, as those are unlikely to DTRT.
2010-01-13 22:49:14 +01:00
Andy Wingo
6f3b0cc29e tc7 tags for vm-related data
* libguile/tags.h (scm_tc7_frame, scm_tc7_objcode, scm_tc7_vm)
  (scm_tc7_vm_cont): Take more tc7s for VM-related data structures.

* libguile/evalext.c (scm_self_evaluating_p):
* libguile/gc.c (scm_i_tag_name):
* libguile/goops.c (scm_class_of, create_standard_classes):
* libguile/print.c (iprin1): Add cases for the new tc7s.

* libguile/frames.c:
* libguile/frames.h:
* libguile/objcodes.c:
* libguile/objcodes.h:
* libguile/vm.c:
* libguile/vm.h: Desmobify.

* libguile/vm.c (scm_vm_apply): Export to Scheme, because VM objects are
  no longer applicable.

* module/system/repl/command.scm (profile):
* module/system/vm/trace.scm (vm-trace):
* module/system/vm/vm.scm (vm-load): Call vm-apply to run a program in a
  VM instead of treating the VM as applicable.
2010-01-07 23:42:41 +01:00
Andy Wingo
737caee88d tracing at repl
* module/system/repl/command.scm (option, trace): Integrate tracing (via
  ,trace or ,tr).
2009-12-21 23:13:05 +01:00
Andy Wingo
a6dc56a71e poor man's statprof integration with the repl: ,pr
* module/system/repl/command.scm (profile): Add a very poor integration
  of statprof with the repl.
2009-12-21 00:08:18 +01:00
Andy Wingo
6c20a0b34b vm no longer measures bogoclock or times, relies on os for that
* libguile/vm.h (struct scm_vm): Remove "time" and "clock" members. The
  time was bogusly measured, and the "clock" measured instructions
  retired, which is not a very useful measurement, and it was causing
  lots of memory accesses. Not that I have done a proper profile,
  though...
  (scm_vm_stats): Remove this procedure, which provided access to "time"
  and "clock".

* libguile/vm.c:
* libguile/vm-engine.h:
* libguile/vm-engine.c:
* libguile/vm-i-system.c: Adapt to scm_vm changes and scm_vm_stats
  removal.

* module/system/repl/command.scm:
* module/system/vm/vm.scm: Adapt to vm-stats removal by removing
  vm-stats from <repl>.
2009-12-11 12:39:02 +01:00
Ludovic Courtès
84012ef4b1 Fix typos leading to unbound variable references.
* module/ice-9/session.scm (help): Fix unbound reference to `env'.

* module/system/vm/program.scm (program-property): Fix typo.

* module/system/vm/frame.scm: Add missing `#:use-module (system vm
  objcode)'.

* module/system/repl/command.scm (guile:load): New.
  (load): Use either `primitive-load' or `load'.

* module/srfi/srfi-18.scm (thread-sleep!): Fix typo.

* module/srfi/srfi-19.scm: Use `(ice-9 rdelim)'.
  (date->broken-down-time, priv:year-day, priv:char->int): Fix typo.
  (time-*->time-*, time-*->time-*!): Fix reference to unbound variable
  `caller'.

* module/oop/goops.scm (bound-check-get): Fix typo.

* module/language/glil/compile-assembly.scm (glil->assembly): Fix typo.

* module/language/glil.scm (parse-glil): Fix typo.

* module/language/ecmascript/base.scm (object->value/string,
  object->value/number, ->number): Fix typos.

* module/language/assembly/disassemble.scm (disassemble-free-vars): Fix
  typo.
2009-10-22 22:57:25 +02:00
Andy Wingo
4b2afc6258 language-readers receive environment as an arg
* module/language/assembly/spec.scm:
* module/language/brainfuck/spec.scm:
* module/language/bytecode/spec.scm:
* module/language/ecmascript/spec.scm:
* module/language/glil/spec.scm:
* module/language/scheme/spec.scm:
* module/language/tree-il/spec.scm: Language-readers now take two
  arguments: the port and the environment. This should allow for
  compile-environment-specific reader behavior.

* module/system/base/compile.scm (read-and-compile):
* module/system/repl/common.scm (repl-read): Pass the environment to the
  language-reader.

* module/system/repl/repl.scm (meta-reader, prompting-meta-read):
* module/system/repl/command.scm (define-meta-command): Use the second
  argument to repl-reader, so we avoid frobbing current-reader.
2009-10-16 13:39:24 +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
476e357281 remove all mentions of "external" from the compiler and related code
With this, GHIL is effectively bitrotten. I need to port the ECMAScript
compiler to tree-il, then I'll remove it.

* module/language/assembly.scm (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):
  (disassemble-free-vars, code-annotation):
* module/language/glil.scm (<glil-program>, <glil-local>)
  (<glil-exteral>, parse-glil, unparse-glil):
* module/language/glil/compile-assembly.scm (make-meta):
  (compile-assembly, glil->assembly):
* module/language/glil/decompile-assembly.scm (decompile-toplevel):
  (decompile-load-program):
* module/language/objcode/spec.scm (decompile-value):
* module/language/tree-il/compile-glil.scm (flatten-lambda):
* module/system/vm/frame.scm (frame-binding-ref):
  (frame-binding-set!):
* module/system/vm/program.scm (binding:boxed?):
* module/system/vm/trace.scm (trace-next):
* test-suite/tests/asm-to-bytecode.test ("compiler"):
* test-suite/tests/tree-il.test: Remove all mentions of "external", and
  of <glil-local>. Docs updates will come soon.
2009-07-23 17:15:17 +02:00
Andy Wingo
eb72179985 meta-commands read off their own arguments
* module/system/repl/command.scm: Update copyright.
  (meta-command): Rework so that it's the various meta-commands that do
  the reading for their arguments. This way you can compile forms that
  span more than one line, and forms that need to be read with another
  language's reader.
  (define-meta-command): New helper macro. Update commands to use it.
  (help): Allow ,help on commands too.

* module/system/repl/repl.scm: Update copyright.
  (start-repl): Adjust to give meta-command what it wants.
2009-06-22 20:45:01 +02:00
Ludovic Courtès
81e002fcb9 Fix the REPL's `,compile' command.
* module/system/repl/command.scm (compile): Use `guile:disassemble'
  instead of the former `disassemble-objcode'.
2009-06-19 02:14:22 +02:00
Andy Wingo
8239263f86 fix erroneous #:use-syntax clausen
* module/system/repl/command.scm:
* module/system/repl/common.scm:
* module/system/repl/repl.scm:
* module/system/vm/debug.scm:
* module/system/vm/trace.scm: Change #:use-syntax to #:use-module, as
  that's really what we want to do.
2009-04-22 22:27:50 +02:00
Andy Wingo
9bb8012dd6 remove conv.scm, disasm.scm; objcode->bytecode rename
* module/system/vm/Makefile.am:
* module/system/vm/conv.scm:
* module/system/vm/disasm.scm: Remove these modules, as their
  functionality is now in (language ...).

* libguile/objcodes.h:
* libguile/objcodes.c:
* module/system/vm/objcode.scm: Rename objcode->u8vector to
  objcode->bytecode.

* module/system/vm/frame.scm:
* module/language/bytecode/spec.scm: Fix for objcode->bytecode.

* scripts/disassemble:
* testsuite/run-vm-tests.scm: Fix for (system vm disasm) removal.

* module/system/repl/command.scm: Use the right disassembler.
2009-01-30 14:36:49 +01:00
Andy Wingo
b0b180d522 nifty generic compiler infrastructure -- no more hardcoded passes
* module/system/base/language.scm (<language>): Rework so that instead of
  hardcoding passes in the language, we define compilers that translate
  from one language to another. Add `parser' to the language fields, a
  bit of a hack but useful for languages with s-expression external
  representations but with record internal representations.
  (define-language, *compilation-cache*, invalidate-compilation-cache!)
  (compute-compilation-order, lookup-compilation-order): Add an algorithm
  that does a depth-first search for a translation path from a source
  language to a target language, caching the result in a lookup table.

* module/language/scheme/spec.scm:
* module/language/ghil/spec.scm: Update to the new language format.

* module/language/glil/spec.scm: Add a language specification for GLIL,
  with a compiler to objcode. Also there are parsers and printers, for
  repl usage, but for some reason this doesn't work yet.

* module/language/objcode/spec.scm: Define a language specification for
  object code. There is some sleight of hand here, in the "compiler" to
  values; but there is method behind the madness, because this way we
  higher levels can pass environments (a module + externals pair) to
  objcode->program.

* module/language/value/spec.scm: Define a language specification for
  values. There is something intellectually dishonest about this, but it
  does serve its purpose as a foundation for the language hierarchy.

* configure.in:
* module/language/Makefile.am
* module/language/ghil/Makefile.am
* module/language/glil/Makefile.am
* module/language/objcode/Makefile.am
* module/language/value/Makefile.am:
  Autotomfoolery for the ghil, glil, objcode, and value languages.

* module/language/scheme/translate.scm (translate): Import the bits that
  understand `compile-time-environment' here, and pass on the relevant
  portions of the environment to the next compiler pass.

* module/system/base/compile.scm (current-language): New procedure, refs
  the current language fluid, or lazily sets it to scheme.
  (call-once, call-with-output-file/atomic): Refactor these bits to use
  with-throw-handler. No functional change.
  (compile-file, compile-and-load, compile-passes, compile-fold)
  (compile): Refactor the public interface of the compiler to be generic
  and simple. Uses `lookup-compilation-order' to find a path from the
  source language to the target language.

* module/system/base/syntax.scm (define-type): Adapt to changes in
  define-record.
  (define-record): Instead of expecting all slots in the first form,
  expect them in the body, and let the first form hold the options.

* module/system/il/compile.scm (compile): Adapt to the compilation pass
  API (three in and two out).

* module/system/il/ghil.scm (<ghil-var>, <ghil-env>)
  (<ghil-toplevel-env>): Adapt to define-record changes.

* module/system/il/glil.scm (<glil-vars>): Adapt to define-record
  changes.
  (<glil>, print-glil): Add a GLIL record printer that uses unparse.
  (parse-glil, unparse-glil): Update unparse (formerly known as pprint),
  and write a parse function.

* module/system/repl/common.scm (<repl>): Adapt to define-record changes.
  (repl-parse): New function, parses the read form using the current
  language. Something of a hack.
  (repl-compile): Adapt to changes in `compile'.
  (repl-eval): Fix up the does-the-language-have-a-compiler check for
  changes in <language>.

* module/system/repl/repl.scm (start-repl): Parse the form before eval.

* module/system/repl/command.scm (describe): Parse.
  (compile): Be more generic.
  (compile-file): Adapt to changes in compile-file.
  (disassemble, time, profile, trace): Parse.

* module/system/vm/debug.scm:
* module/system/vm/assemble.scm: Adapt to define-record changes.

* module/language/scheme/translate.scm (receive): Fix an important bug
  that gave `receive' letrec semantics instead of let semantics. Whoops!
2008-11-14 22:42:31 +01:00
Andy Wingo
1a1a10d3a5 use #:keywords in module/*.scm, not :keywords
* module/system/base/syntax.scm (keywords): Don't enable :keywords, it
  breaks code that may assume that ':foo is a symbol, like boot-9.

* module/*.scm: Don't use :keywords, use #:keywords. The user can decide
  if she wants #:keywords in their .guile, and :keywords might make us
  compile modules differently.
2008-09-09 06:58:25 +02:00
Andy Wingo
b9d8ed0502 make ,stats work
* module/system/repl/command.scm (display-time-stat, display-mips-stat):
  Always convert to float.

* module/system/vm/frame.scm (print-frame): Write the args, don't display them.

* module/system/repl/command.scm (statistics): gc-sweep-time is no more.
2008-08-11 19:51:33 +02:00
Andy Wingo
482015afec ease-of-use improvement to ,m; catch read errors at the repl
* module/system/repl/command.scm (module): Accept e.g. `,m ice-9 popen'
  in addition to `,m (ice-9 popen)'.

* module/system/repl/repl.scm (start-repl): Call read with a backtrace
  handler too.
2008-08-11 19:27:23 +02:00
Andy Wingo
17d1b4bffd fix stack corruption on vm-save-stack; more robust with nonlocal exits
* module/system/repl/command.scm: Coerce rationals to floats.

* module/system/vm/program.scm (program-documentation): Fix a typo, doh!

* src/vm.c (vm_reset_stack, struct vm_unwind_data): Add unwind handler to
  reset vp->sp, vp->fp, and vp->this_frame when performing a nonlocal
  exit from a vm_run.
  (vm_heapify_frames_1): Don't repack the stack, it causes stack
  corruption. I think we need spaghetti stacks to handle continuations,
  not separate heap frames. I don't think call/cc is working now.
  (vm-save-stack): Don't call heapify_frames, that modifies the stack
  that we're copying. Instead call its helper, heapify_1.

* src/vm_engine.c (vm_run): Set up the vm_reset_stack unwind handler.

* src/vm_engine.h (IP_REG, SP_REG, FP_REG): If we got through all of the
  checks without having these macros defined, define them as empty.
  Happens on x86-64.

* src/vm_system.c (halt): End the dynwind before we return from the VM.

* src/vm_scheme.c (REL): Sync the regs before calling scm_lt_p et al,
  cause they can do a nonlocal exit.
2008-08-07 19:04:25 +02:00
Andy Wingo
07e56b27a1 big reorg of scheme modules -- e.g. programs.c -> (system vm program)
This reorganization kills the ugly module-export-all hacks in
bootstrap.scm and core.scm. In fact, it gets rid of core.scm entirely,
breaking out its functionality into separate files.

* module/system/vm/trace.scm:
* module/system/vm/profile.scm:
* module/system/vm/disasm.scm:
* module/system/vm/debug.scm:
* module/system/vm/conv.scm:
* module/system/vm/assemble.scm:
* module/system/repl/repl.scm:
* module/system/repl/common.scm:
* module/system/base/compile.scm:
* module/system/repl/command.scm: Update for changes, and fix a bug in
  procedure-documentation.

* module/system/vm/bootstrap.scm: Just call scm_bootstrap_vm, which
  handles setting load-compiled for us.

* module/system/vm/core.scm: Removed, functionality folded into other
  modules.

* module/system/vm/frame.scm: Export the C frame procedures here; also
  move scheme functions from core.scm here.

* module/system/vm/instruction.scm: New file, exports procedures from
  instructions.c.

* module/system/vm/objcode.scm: New file, exports procedures from
  objcodes.c.

* module/system/vm/program.scm: New file, exports procedures from
  programs.c, and some scheme functions originally from core.scm.

* module/system/vm/vm.scm: New file, from vm.c and core.scm.

* src/Makefile.am (libguile_vm_la_SOURCES): Add bootstrap.h.

* src/bootstrap.h: New file, prototypes scm_bootstrap_vm (), which the
  scm_init_* functions call.

* src/frames.h:
* src/frames.c (scm_init_frames):
* src/frames.c (scm_bootstrap_frames):

* src/vm.h:
* src/instructions.h:
* src/instructions.c (scm_init_instructions):
* src/instructions.c (scm_bootstrap_instructions):
* src/objcodes.h:
* src/objcodes.c (scm_bootstrap_objcodes):
* src/objcodes.c (scm_init_objcodes):
* src/programs.h:
* src/programs.c (scm_bootstrap_programs):
* src/programs.c (scm_init_programs):
* src/vm.c (scm_bootstrap_vm):
* src/vm.c (scm_init_vm): Call scm_bootstrap_vm() before doing anything
  in an init function. Bootstrap_vm will call bootstrap_instructions(),
  etc to initialize types, then set load-compiled to point to
  load-compiled/vm.

* src/vm.c (scm_load_compiled_with_vm): Code to load .go files, if
  they're present.
2008-08-07 13:11:27 +02:00
Andy Wingo
659b4611b6 re-enable computed goto; fix ,help in the repl; subr dispatch optimizations
* m4/labels-as-values.m4: New file, checks for computed goto.

* configure.in: Use AC_C_LABELS_AS_VALUES.

* module/system/repl/command.scm (procedure-documentation): Extend the
  core's procedure-documentation in an ad-hoc way, so that ,help works.

* module/system/vm/core.scm (program-properties): New function.
  (program-documentation): New function.

* src/vm_engine.h (DROP, DROPN): Decrement sp before checking for
  underflow.

* src/vm_system.c (call, tail-call): Add some optimized dispatch for some
  C functions, so that we can avoid consing and the interpreter if
  possible. However currently it seems that I'm always getting the
  scm_call_* trampolines back.
2008-08-05 01:03:17 +02:00
Andy Wingo
9246a48606 fix immediate linkage, some other fixes to allow vm/ to compile
* module/language/scheme/translate.scm (lookup-transformer): Allow for
  undefined variables when doing the transformation -- it's possible that
  they come from a module definition's forward declaration.

* module/system/repl/command.scm (import): Make into legal Scheme, caught
  by the compiler :-)

* module/system/vm/assemble.scm (<vlink-now>): Remove the module field.
  Immediate bindings will now always be relative to the current module.
  Fixes some mess about process-define-module not being defined when
  loading modules, probably because we destructively modified the
  ghil-env.
  (codegen, dump-object!): Don't dump a module name.

* src/vm_loader.c (link-now): Just use scm_lookup.
2008-05-19 21:29:18 +02:00
Andy Wingo
db917b4152 replace cenv with things in <repl> and fluids; remove the `use' meta-command
* module/system/base/compile.scm (<cenv>): No more cenv, it was a useless
  data structure.

* module/system/repl/command.scm (*command-table*): Remove `use', it's
  the same as `import'. Otherwise in this file, adapt to the repl having
  direct pointers to the vm and the language, and to the module being in
  the current-module fluid.

* module/system/repl/repl.scm (prompting-meta-read):
* module/system/repl/common.scm (<repl>): The repl now has a direct
  pointer to the vm and language. Adapt accordingly.
2008-05-12 22:26:31 +02:00
Andy Wingo
b79f118f8e multiple-values help for the repl; exports cleanups
* module/system/repl/command.scm (system): Declare exports in the module
  declaration.

* module/system/repl/repl.scm (start-repl): If the evaluation returns
  multiple values, print them separately.
2008-05-09 12:08:06 +02:00
Andy Wingo
ce0925e14e more dedottification, almost done
* module/system/repl/common.scm:
* module/system/base/compile.scm: Export some more things.

* module/system/repl/command.scm: Dedottify.
2008-05-04 16:12:36 +02:00
Andy Wingo
e429de1e5f more pmatchification
* module/system/il/ghil.scm: No need for a match

* module/system/repl/command.scm: Pmatchify

* module/system/vm/disasm.scm: Pmatchify.
2008-05-03 19:39:41 +02:00
Andy Wingo
063fd30bbe clean up some syntax imports and exports
* module/system/base/syntax.scm (system): Don't re-export receive or
  and-let*; modules should explicitly import these if they want to. Don't
  export an empty stack-catch definition!

* module/system/repl/command.scm (system): Pull in and-let*.

* module/system/vm/disasm.scm (system): Don't import and-let*.
2008-05-02 18:59:04 +02:00
Keisuke Nishida
af988bbf9c *** empty log message *** 2001-04-23 04:28:13 +00:00
Keisuke Nishida
ac99cb0cb1 *** empty log message *** 2001-04-22 02:13:48 +00:00