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

42 commits

Author SHA1 Message Date
Andy Wingo
18f8fd0211 frame-call-representation has #:top-frame? as keyword argument
* module/system/vm/frame.scm (frame-call-representation): Change
  top-frame? argument to be a keyword instead of an optional argument.

* module/system/vm/trace.scm (print-application): Adapt caller.
2014-05-04 11:18:54 +02:00
Andy Wingo
ae4d761f7a Fix tracing
* module/system/vm/trace.scm (print-return): Remove frame argument.
  (trace-calls-to-procedure, trace-calls-in-procedure): Adapt callers.
* module/system/vm/traps.scm (trap-in-procedure, trap-frame-finish):
  (trap-calls-to-procedure): Since the pop continuation hook is now
  called after the continuation is popped, we need to check the right
  frame.  Fixes tail-calls in the trace root, and probably other things.
2014-01-28 21:31:17 +01:00
Andy Wingo
a222cbc9d1 No more VM objects visible to Scheme
* libguile/vm.h:
* libguile/vm.c (scm_the_vm): Don't expose to Scheme.
  (scm_vm_p): Remove, as it is not needed.

* module/system/vm/vm.scm: Remove the-vm and vm? exports.

* doc/ref/api-coverage.texi (Code Coverage):
* test-suite/tests/coverage.test:
* module/system/vm/coverage.scm (with-code-coverage): Don't take a VM
  argument.  Adapt documentation and tests.

* module/ice-9/command-line.scm: Remove the-vm autoload.

* module/system/vm/trace.scm (trace-calls-to-procedure):
  (trace-calls-in-procedure):
  (trace-instructions-in-procedure):
  (call-with-trace): Remove #:vm kwarg, and adapt to trap changes.

* module/system/vm/trap-state.scm (the-trap-state): Rework to use a
  parameter underneath instead of a weak key on (the-vm).

* module/system/vm/traps.scm (new-disabled-trap):
  (new-enabled-trap): Remove vm argument.
  (trap-at-procedure-call):
  (trap-in-procedure):
  (trap-instructions-in-procedure):
  (trap-at-procedure-ip-in-range):
  (trap-at-source-location):
  (trap-frame-finish):
  (trap-in-dynamic-extent):
  (trap-calls-in-dynamic-extent):
  (trap-instructions-in-dynamic-extent):
  (trap-calls-to-procedure):
  (trap-matching-instructions): Remove vm keyword arguments.

* test-suite/tests/control.test ("unwind"): Adapt test.

* test-suite/tests/eval.test (test-suite): Remove the-vm import.
2013-11-21 16:45:03 +01:00
Andy Wingo
972275eee5 VM accessors take VM as implicit argument, not explicit argument
* libguile/vm.h:
* libguile/vm.c:
  (scm_vm_apply_hook, scm_vm_push_continuation_hook,
  scm_vm_pop_continuation_hook, scm_vm_abort_continuation_hook,
  scm_vm_restore_continuation_hook, scm_vm_next_hook,
  scm_vm_trace_level, scm_set_vm_trace_level_x, scm_vm_engine,
  scm_set_vm_engine_x, scm_c_set_vm_engine_x): The VM argument is now
  implicit: the VM for the current thread.

* doc/ref/api-debug.texi (VM Hooks): Try to adapt.

* module/ice-9/command-line.scm:
* module/statprof.scm:
* module/system/vm/coverage.scm:
* module/system/vm/trace.scm:
* module/system/vm/trap-state.scm:
* module/system/vm/traps.scm:
* test-suite/tests/control.test:
* test-suite/tests/eval.test: Adapt users that set hooks or ensure that
  we have a debug engine.
2013-11-21 16:10:41 +01:00
Andy Wingo
1b780c134b (system vm instruction) rtl-instruction-list -> (language rtl) instruction-list
* libguile/instructions.c (struct scm_instruction, fetch_instruction_table)
  (scm_instruction_list): Remove rtl_ infix.
* libguile/instructions.h: Adapt.

* module/system/vm/instruction.scm: Remove.

* module/language/rtl.scm: Export instruction-list from here.

* module/Makefile.am:
* module/language/cps/primitives.scm:
* module/system/vm/assembler.scm:
* module/system/vm/disassembler.scm:
* module/system/vm/frame.scm:
* module/system/vm/program.scm:
* module/system/vm/trace.scm:
* module/system/vm/traps.scm: Adapt.
2013-11-19 20:45:57 +01:00
Andy Wingo
b636cdb0f3 Frame pointer points to local 0 instead of local 1
* libguile/frames.h: Change so that fp points at local 0 instead of
  local 1, and clean up a bit.
  (struct scm_vm_frame): Remove program, and rename stack to locals.
  (SCM_FRAME_DATA_ADDRESS): Remove; it was redundant with
  SCM_FRAME_LOWER_ADDRESS.
  (SCM_FRAME_STACK_ADDRESS): Remove; replace with the new
  SCM_FRAME_LOCALS_ADDRESS.
  (SCM_FRAME_UPPER_ADDRESS): Remove; unused.
  (SCM_FRAME_NUM_LOCALS, SCM_FRAME_PREVIOUS_SP): New defines.
  (SCM_FRAME_BYTE_CAST, SCM_FRAME_STACK_CAST): Remove; unused;
  (SCM_FRAME_LOCAL): New define, replaces SCM_FRAME_VARIABLE.
  (SCM_FRAME_PROGRAM): Add cautionary commentary.

* libguile/frames.c: Adapt static asserts.
  (scm_frame_num_locals, scm_frame_local_ref, scm_frame_local_set_x):
  Adapt.  This means that frame-local-ref 0 now returns the procedure.

* libguile/vm-engine.c (ALLOC_FRAME, RESET_FRAME)
  (FRAME_LOCALS_COUNT, LOCAL_REF, LOCAL_SET, RETURN_VALUE_LIST): Adapt
  to change in fp.
  (LOCAL_ADDRESS): New helper.
  (POP_CONTINUATION_HOOK): Reimplement, taking the previous FP as an
  argument.
  (ABORT_CONTINUATION_HOOK): Reimplement, taking no arguments.
  (RETURN_ONE_VALUE): Reimplement.
  (RETURN_VALUE_LIST): Adapt to FP change.
  (halt, return-values, subr-call, foreign-call, prompt)
  (continuation-call, compose-continuation, call/cc, abort): Adapt to FP
  change, mostly via using LOCAL_ADDRESS, etc abstractions instead of
  using the raw frame pointer.

* libguile/control.c (reify_partial_continuation): Update for fp
  change.

* libguile/vm.c (vm_reinstate_partial_continuation): Adapt to removal of
  SCM_FRAME_UPPER_ADDRESS.

* module/system/vm/frame.scm (frame-call-representation): Adapt to
  frame-local-ref change.

* module/system/vm/trace.scm (print-return): Remove unused
  frame-num-locals call.
2013-11-17 22:07:44 +01:00
Andy Wingo
b77a5215c7 Per-instruction tracing doesn't try to disassemble stack VM code
* module/system/vm/trace.scm (trace-instructions-in-procedure): Don't
  try to disassemble the procedure, for now.
2013-11-08 17:32:41 +01:00
Andy Wingo
c850a0ff4d pop-continuation abort-continuation hooks pass return vals directly
* doc/ref/api-debug.texi (VM Hooks): Update documentation.

* libguile/vm.c (vm_dispatch_hook):
* libguile/vm-engine.c:  Rework the hook machinery so that they can
  receive an arbitrary number of arguments.  The return and abort
  hooks will pass the values that they return to their continuations.
  (vm_engine): Adapt to ABORT_CONTINUATION_HOOK change.

* libguile/vm-i-system.c (return, return/values): Adapt to
  POP_CONTINUATION_HOOK change.

* module/system/vm/frame.scm (frame-return-values): Remove.  The
  pop-continuation-hook will pass the values directly.

* module/system/vm/trace.scm (print-return):
  (trace-calls-to-procedure):
  (trace-calls-in-procedure): Update to receive return values
  directly.

* module/system/vm/traps.scm (trap-in-procedure)
  (trap-in-dynamic-extent): Ignore return values.
  (trap-frame-finish, trap-calls-in-dynamic-extent)
  (trap-calls-to-procedure): Pass return values to the handlers.
2013-05-27 07:13:13 +02:00
Andy Wingo
36c210d14e trace: limit length of "| | | "... prefix
* module/system/vm/trace.scm (build-prefix): New helper.
  (print-application, print-return): Use the helper.
  (trace-calls-to-procedure, trace-calls-in-procedure):
  (trace-instructions-in-procedure, call-with-trace): Add #:max-indent
  argument, defaulting to the terminal width less 40 characters.

* doc/ref/scheme-using.texi: Update `trace' docs.

Based on a patch by Nala Ginrut.
2013-01-16 18:11:47 +01:00
Andy Wingo
4388818adb fix tracing of mv returns
* module/system/vm/trace.scm (print-return): Fix multiple-value-return
  printing.
2010-10-08 12:31:56 +02:00
Andy Wingo
e7544f39a4 rename vm-trace to call-with-trace
* module/system/vm/trace.scm (print-application, print-return): Change
  to add more whitespace, as (ice-9 debug) did.
  (call-with-trace): Rename from vm-trace, and make the vm a keyword
  argument.

* module/system/repl/command.scm: Don't autoload (system vm profile).
  (trace): Update for call-with-trace name change.
2010-10-07 12:55:37 +02:00
Andy Wingo
6a4a1ef0f4 (system vm frame): frame-return-values
* module/system/vm/frame.scm (frame-return-values): New exported
  function, gives the return values for a frame.
* module/system/vm/trace.scm: Remove frame-return-values from here.
2010-10-05 21:51:44 +02:00
Andy Wingo
abb4b5cbbd tracepoints print their trap number
* module/system/vm/trace.scm (print-application, print-return): Add a
  prefix before the printout.
  (trace-calls-to-procedure, trace-calls-in-procedure): Add prefix
  keyword args.

* module/system/vm/trap-state.scm (add-trace-at-procedure-call!): Give a
  useful prefix for tracepoint printouts.
2010-09-23 17:17:16 +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
1bc1800ffa tracing in terms of traps
* module/system/vm/traps.scm (trap-frame-finish)
  (trap-in-dynamic-extent, trap-calls-in-dynamic-extent)
  (trap-instructions-in-dynamic-extent): New traps, for implementing
  tracing, and the `finish' command.

* module/system/vm/trace.scm (trace-calls-in-procedure)
  (trace-instructions-in-procedure): New tracing traps.
  (vm-trace): Reimplement in terms of the new traps.

* module/system/vm/trap-state.scm (add-trap!): New helper; not used in
  this commit, though.
2010-09-23 11:56:21 +02:00
Andy Wingo
8d033f4839 instruction tracing tweak
* module/system/vm/trace.scm (vm-trace): No need to output the opcode
  number, and display the ip as a decimal, not a hexidecimal.
2010-09-16 13:04:57 +02:00
Andy Wingo
839eb61cde only trace instructions inside the thunk
* module/system/vm/trace.scm (vm-trace): Only trace instructions when
  we're in the dynamic extent of the thunk.
2010-09-16 12:58:59 +02:00
Andy Wingo
c45d4d775d trim our set of vm hooks
* libguile/vm.h (SCM_VM_PUSH_CONTINUATION_HOOK)
  (SCM_VM_POP_CONTINUATION_HOOK): New hooks, to replace
  enter/exit/return.
  (SCM_VM_BOOT_HOOK, SCM_VM_HALT_HOOK, SCM_VM_BREAK_HOOK): Remove these
  useless hooks.

* libguile/vm.c (scm_vm_push_continuation_hook)
  (scm_vm_pop_continuation_hook): New accessors.

* libguile/vm-i-system.c: Remove boot, halt, break, enter, exit, and
  return hooks. Also remove the break instruction. Instead now when we
  push a new continuation onto the stack we call PUSH_CONTINUATION_HOOK,
  and when we pop via a return we call POP_CONTINUATION_HOOK. APPLY_HOOK
  is now decoupled from continuation pushes and pops.

* libguile/vm-engine.h:
* libguile/vm-engine.c: Adapt for hooks.

* module/system/vm/trace.scm (vm-trace): Adapt for hooks. Also revive
  the #:instructions? #t mode.

* module/system/vm/vm.scm: Adapt exports for new set of hooks.
2010-09-16 12:16:02 +02:00
Andy Wingo
7ea3e4ff28 vm-trace prints return values
* module/system/vm/trace.scm (vm-trace): Add a #:width argument. Print
  return values, as Chez Scheme does.
2010-01-14 00:09:54 +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
9eaa8fef80 (system vm trace) sorta working
* module/system/vm/trace.scm: Update to work with the current VM and its
  tracing infrastructure.
2009-12-21 23:03:43 +01: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
Ludovic Courtès
e1203ea00f Switch remaining GPLv2+ Guile-VM headers to LGPLv3+.
* module/system/base/compile.scm, module/system/base/syntax.scm,
  module/system/repl/common.scm, module/system/repl/describe.scm,
  module/system/vm/instruction.scm, module/system/vm/objcode.scm,
  module/system/vm/profile.scm, module/system/vm/program.scm,
  module/system/vm/trace.scm: Switch header from GPLv2+ to LGPLv3+.
2009-07-15 22:46:54 +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
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
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
77046be3d3 explicitly list exports instead of using define-public
* module/system/base/compile.scm:
* module/system/il/ghil.scm:
* module/system/repl/describe.scm:
* module/system/vm/core.scm:
* module/system/vm/frame.scm:
* module/system/vm/trace.scm: Explicitly list exports in the module
  declaration instead of using define-public.
2008-05-11 22:00:34 +02:00
Keisuke Nishida
a6df585ae7 *** empty log message *** 2001-04-23 06:17:52 +00: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
Keisuke Nishida
8f5cfc810f *** empty log message *** 2001-04-16 03:43:48 +00:00
Keisuke Nishida
75b55db5f8 *** empty log message *** 2001-04-11 21:54:57 +00:00
Keisuke Nishida
41f248a84a *** empty log message *** 2001-04-11 20:57:44 +00:00
Keisuke Nishida
c0a25eccef *** empty log message *** 2001-04-07 11:54:36 +00:00
Keisuke Nishida
731f329c29 *** empty log message *** 2001-04-07 10:16:48 +00:00
Keisuke Nishida
3616e9e963 *** empty log message *** 2001-04-07 09:39:38 +00:00
Keisuke Nishida
499a4c07c7 *** empty log message *** 2001-04-06 05:00:10 +00:00
Keisuke Nishida
bd098a1a93 *** empty log message *** 2001-04-05 11:07:50 +00:00
Keisuke Nishida
46cd9a346f *** empty log message *** 2001-04-05 05:48:59 +00:00
Keisuke Nishida
d4ae3ae6fa Better current module system support. 2001-04-04 19:58:40 +00:00
Keisuke Nishida
17e90c5e25 New VM. 2001-04-01 05:03:41 +00:00