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

89 commits

Author SHA1 Message Date
Andy Wingo
f897efa9f1 bitvector-flip-all-bits! replaces bit-invert!
* NEWS: Add entry.
* doc/ref/api-data.texi (Bit Vectors): Update.
* libguile/bitvectors.h:
* libguile/bitvectors.c (scm_c_bitvector_flip_all_bits_x): New function.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_bit_invert_x): Deprecate.
* module/ice-9/sandbox.scm (mutable-bitvector-bindings): Replace
  bit-invert! with bitvector-flip-all-bits!.
* module/system/vm/frame.scm (available-bindings): Use the new
  interface.
* test-suite/tests/bitvectors.test: Update.
2020-04-18 22:16:31 +02:00
Andy Wingo
d7fea13453 bitvector-set-all-bits! / bitvector-clear-all-bits! replace bitvector-fill!
* NEWS: Add entry.
* doc/ref/api-data.texi (Bit Vectors): Update.
* libguile/bitvectors.h:
* libguile/bitvectors.c (scm_c_bitvector_set_all_bits_x)
  (scm_c_bitvector_clear_all_bits_x): New functions.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_bitvector_fill_x): Deprecate.
* module/ice-9/sandbox.scm (mutable-bitvector-bindings): Replace
  bitvector-fill! with bitvector-set-all-bits! /
  bitvector-clear-all-bits!.
* module/system/vm/disassembler.scm (static-opcode-set): Use
  bitvector-set-bit!.
* module/system/vm/frame.scm (available-bindings): Use the new
  interfaces.
* test-suite/tests/bitvectors.test: Update.
2020-04-15 22:14:25 +02:00
Andy Wingo
8110061e64 bitvector-set-bit! / bitvector-clear-bit! replace bitvector-set!
* NEWS: Add entry.
* doc/ref/api-data.texi (Bit Vectors): Update.
* libguile/array-handle.h (bitvector_set_x, scm_array_get_handle): Adapt
  to bitvector changes.
* libguile/bitvectors.h:
* libguile/bitvectors.c (scm_c_bitvector_set_bit_x)
  (scm_c_bitvector_clear_bit_x): New functions.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_bitvector_set_x): Deprecate.
* module/ice-9/sandbox.scm (mutable-bitvector-bindings): Replace
  bitvector-set! with bitvector-set-bit! / bitvector-clear-bit!.
* module/system/vm/disassembler.scm (static-opcode-set): Use
  bitvector-set-bit!.
* module/system/vm/frame.scm (compute-defs-by-slot, available-bindings):
  Use bitvector-set-bit!.
* test-suite/tests/bitvectors.test: Update.
2020-04-14 22:40:43 +02:00
Andy Wingo
ff9979b6bc Replace bit-set*! with bitvector-set-bits! / bitvector-clear-bits!
The old name was wonky and hard to read: you almost always pass a
literal as the value to set, so better to make separate functions.

* NEWS: Add entry.
* doc/ref/api-data.texi (Bit Vectors): Update.
* libguile/bitvectors.h:
* libguile/bitvectors.c (scm_bitvector_set_bits_x)
  (scm_bitvector_clear_bits_x): New functions.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_bit_set_star_x): Deprecate.
* module/ice-9/sandbox.scm (mutable-bitvector-bindings): Replace
  bit-set*! with bitvector-set-bits! / bitvector-clear-bits!.
* module/system/vm/frame.scm (available-bindings, compute-killv): Use
  bitvector-set-bits! and bitvector-clear-bits!.
* test-suite/tests/bitvectors.test: Update.
2020-04-13 22:06:56 +02:00
Andy Wingo
06709d77b9 Replace bit-position with bitvector-position
The old name was wonky and had bad argument order.

* NEWS: Add entry.
* doc/ref/api-data.texi (Bit Vectors): Update.
* libguile/bitvectors.h:
* libguile/bitvectors.c (scm_bitvector_position): New function.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_bit_position): Deprecate.
* module/ice-9/sandbox.scm (bitvector-bindings): Replace bit-position
  with bitvector-position.
* module/language/cps/intset.scm (bitvector->intset): Use
  bitvector-position.
* module/system/vm/frame.scm (available-bindings): Use
  bitvector-position.
* test-suite/tests/bitvectors.test ("bitvector-position"): Add test.
2020-04-12 22:39:55 +02:00
Andy Wingo
cae74359de Replace bit-count with bitvector-count
The old name was wonky and had bad argument order.

* NEWS: Add entry.
* doc/ref/api-data.texi (Bit Vectors): Update.
* libguile/bitvectors.h:
* libguile/bitvectors.c (VALIDATE_BITVECTOR): New helper.
  (scm_bitvector_count): New function.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_bit_count): Deprecate.
* module/ice-9/sandbox.scm (bitvector-bindings): Replace bit-count with
  bitvector-count.
* module/srfi/srfi-60.scm: No need to #:replace bit-count.
* module/system/vm/frame.scm (available-bindings): Use bitvector-count.
* test-suite/tests/bitvectors.test ("bitvector-count"): Add test.
2020-04-12 22:17:22 +02:00
Andy Wingo
7190905109 Fix frame-call-representation for callees without closures
* module/system/vm/assembler.scm (<arity>): Add new "has-closure?"
  flag.
  (begin-kw-arity, pack-arity-flags, write-arities): Write
  "elided-closure?" flag into binary.  A negative flag for compat
  reasons.
* module/system/vm/debug.scm (elided-closure?, arity-has-closure?): Add
  arity-has-closure? accessor.
* module/system/vm/frame.scm (frame-call-representation): Count from 0
  for callees with elided closures.
2019-11-27 15:04:55 +01:00
Andy Wingo
f4c50447dd Remove push continuation hook; return hook runs before FP pop
* libguile/frames.c (scm_frame_return_values): New function, for use
  when a frame is at "return-values".
  (scm_init_frames_builtins): Register frame-return-values.
* libguile/vm-engine.c (RETURN_HOOK): Rename from POP_CONTINUATION_HOOK.
  (call, call-label): Remove PUSH_CONTINUATION_HOOK; it's unneeded, as
  you can always check the FP from an apply hook.
  (return-values): Run return hook before popping frame.
* libguile/vm.c (vm_dispatch_return_hook): Rename from
  vm_dispatch_pop_continuation_hook.  Remove push continuation hook.
  (scm_vm_return_hook):
* libguile/vm.h (SCM_VM_PUSH_CONTINUATION_HOOK): Remove.
  (SCM_VM_RETURN_HOOK): Rename from SCM_VM_POP_CONTINUATION_HOOK.
* module/system/vm/frame.scm (frame-return-values): Export.
* module/system/vm/trace.scm (print-return, trace-calls-to-procedure)
  (trace-calls-in-procedure): Adapt to not receiving values as
  arguments.
* module/system/vm/traps.scm (trap-in-procedure, trap-frame-finish):
  Adapt to return hook coming from returning frame.
  (program-sources-by-line): Update to use match instead of pmatch.
* module/system/vm/traps.scm (trap-in-dynamic-extent)
  (trap-calls-to-procedure): Adapt to return hook not receiving values.
* module/system/vm/vm.scm: Remove push continuation hook and rename
  return hook.
2018-08-06 17:00:45 +02:00
Andy Wingo
d145b57baf Minor updates for Scheme runtime (statprof, backtraces)
* module/system/vm/frame.scm: Add a comment about a case that we need to
  handle in the future.
* module/statprof.scm (statprof-proc-call-data): Always use the program
  code as the key, even for primitives.
2018-08-06 13:34:48 +02:00
Andy Wingo
b8a9a666f1 Rewrite subr implementation
* libguile/gsubr.c: Reimplement to store subr names and procedures in a
  side table, and to allocate fresh vcode for each subr.  This allows
  JIT of subrs, moves to a uniform all-code-starts-with-instrument-entry
  regime, and also allows statprof to distinguish between subrs based on
  IP.
* libguile/gsubr.h (SCM_SUBRF, SCM_SUBR_NAME): Call out to functions,
  now that these are in a side table.
  (scm_subr_function, scm_subr_name): New exports.
  (scm_i_primitive_name): New internal function, for looking up a
  primitive name based on IP.
  (scm_apply_subr): Take the subr index.
* libguile/vm-engine.c (subr-call):
* libguile/jit.c (compile_subr_call): Adapt to take index as arg.
* module/statprof.scm (sample-stack-procs, count-call):
  (stack-samples->procedure-data): Update to always record IP in stack
  samples and call counts.
* module/system/vm/frame.scm (frame-procedure-name): Simplify.
  (frame-instruction-pointer-or-primitive-procedure-name): Removed.
* libguile/programs.h:
* libguile/programs.c (scm_primitive_code_name): New function.
* module/system/vm/program.scm (primitive-code-name): New export.
2018-07-29 15:47:07 +02:00
Andy Wingo
a5dfbf5d0a Fix stack effect/clobber parsing for calls
* module/system/vm/disassembler.scm (define-stack-effect-parser)
  (define-clobber-parser):
* module/system/vm/frame.scm (compute-frame-sizes, compute-killv):
  Fix bug introduced in dd8bf6a98c whereby
  a call would clobber all locals, leaving the backtrace much less
  useful than it should be.
2017-12-27 15:46:25 +01:00
Andy Wingo
dd8bf6a98c Re-mark "throw" et al as not having fallthrough
* module/system/vm/disassembler.scm (instruction-has-fallthrough?):
  Re-add throw, etc.
* module/system/vm/frame.scm (compute-frame-sizes, compute-killv): Allow
  for unreachable code.
2017-12-06 11:13:31 +01:00
Andy Wingo
4dcc97288d Fix compute-frame-sizes for case-lambda jumps
* module/system/vm/frame.scm (compute-frame-sizes): Fix for jumps to the
  next arity.
2017-02-22 22:22:27 +01:00
Andy Wingo
486b322fd5 Fix frame-call-representation for change to <binding>.
* module/system/vm/frame.scm (frame-call-representation): Fix for change
  to <binding>.
2016-02-02 11:09:00 +01:00
Andy Wingo
cd0b61a04e Frame <binding> objects capture frame, can ref value directly
* module/system/repl/debug.scm (print-locals): Adapt to
  frame-binding-ref change.

* module/system/vm/frame.scm (<binding>): Add `frame' field.
  (available-bindings): Capture the frame.
  (binding-ref, binding-set!): New functions, accessing a local variable
  value directly from a frame.
  (frame-binding-ref, frame-binding-set!): Remove.  As these are very
  low-level debugging interfaces introduced in 2.0, never documented,
  and quite tied to the VM, we feel comfortable making this change.
  (frame-call-representation): Adapt to available-bindings change.
  (frame-environment, frame-object-binding): Adapt to binding-ref
  interface change.

* doc/ref/vm.texi (Stack Layout): Mention that slots can be re-used.
  Update disassembly in example.

* doc/ref/api-debug.texi (Frames): Remove documentation for
  frame-local-ref, frame-local-set!, and frame-num-locals.  Replace with
  documentation for frame-bindings, binding accessors, and binding-ref /
  binding-set!.
2016-01-31 11:15:58 +01:00
Andy Wingo
67e8aa85e8 Remove frame-local-ref, frame-local-set!
* libguile/frames.h (scm_frame_num_locals, scm_frame_local_ref)
  (scm_frame_local_set_x): Remove.  As long as we are changing the
  interface in a backward-incompatible way, we might as well remove
  these.
* libguile/frames.c (scm_frame_num_locals, scm_frame_local_ref)
  (scm_frame_local_set_x, scm_init_frames_builtins, scm_init_frames):
  Arrange to make frame-local-ref et al private to frames.scm.

* module/system/vm/frame.scm: Load scm_init_frames_builtins extensions.
  (frame-instruction-pointer-or-primitive-procedure-name): New public
  function.
  (frame-binding-ref, frame-binding-set!): Allow binding objects as
  vars.

* module/system/repl/debug.scm (print-locals): Pass binding directly to
  frame-binding-ref.

* module/statprof.scm (sample-stack-procs, count-call): Use new
  frame-instruction-pointer-or-primitive-procedure-name function.
2016-01-31 10:45:02 +01:00
Andy Wingo
c960c76fe0 Better frame-call-representation printing of GC clobbers
* module/system/vm/frame.scm (frame-call-representation): Assume that
  unspecified values are GC clobbers rather than actual arguments, and
  print as _.
2015-12-01 11:30:54 +01:00
Andy Wingo
029af6f68a frame-call-representation avoids frame-procedure.
* module/system/vm/frame.scm (frame-call-representation): Never use
  frame-procedure, as we don't know that slot 0 is a SCM value and even
  if it were, we don't know that it corresponds to the procedure being
  applied, except in the case of primcalls.  Print _ as the procedure
  name if we don't know it, instead of #f.
2015-12-01 11:30:54 +01:00
Andy Wingo
39090e677e Add frame-procedure-name
* libguile/frames.c (frame_procedure_name_var): New static definition.
  (init_frame_procedure_name_var): New helper.
  (scm_frame_procedure_name): New function that returns the name of the
  frame's procedure, as frame-procedure is to be deprecated.

* libguile/frames.h (scm_frame_procedure_name): Export.

* module/ice-9/boot-9.scm (exception-printers): Use frame-procedure-name
  instead of procedure-name on frame-procedure.

* module/system/vm/frame.scm (frame-procedure-name): New private
  function, implementing scm_frame_procedure_name.
  (frame-call-representation): Use frame-procedure-name to get the
  procedure name to print.
2015-12-01 11:30:54 +01:00
Andy Wingo
8af3423efe Remove primitive?, add primitive-code?
We need to be able to identify frames that are primitive applications
without assuming that slot 0 in a frame is an SCM value and without
assuming that value is the procedure being applied.

* libguile/gsubr.c (scm_i_primitive_code_p): New helper.
  (scm_i_primitive_arity): Use the new helper.
* libguile/gsubr.h: Declare the new helper.

* libguile/programs.h:
* libguile/programs.c (scm_program_code_p): New function, replacing
  scm_primitive_p.
  (scm_primitive_call_ip): Fix FUNC_NAME definition.

* module/statprof.scm (sample-stack-procs, count-call): Identify
  primitive frames from the IP, not the frame-procedure.  Avoids the
  assumption that slot 0 in a frame is a SCM value.
  (statprof-proc-call-data): Adapt to primitive-code? change.

* module/system/vm/frame.scm (frame-call-representation): Identify
  primitive frames from the IP, not the closure.  Still more work to do
  here to avoid assuming slot 0 is a procedure.

* module/system/vm/program.scm: Export primitive-code? instead of
  primitive?.
  (program-arguments-alist, program-arguments-alists): Identify
  primitives from the code instead of the flags on the program.  Not
  sure this is a great change, but it does avoid having to define a
  primitive? predicate in Scheme.
2015-12-01 11:30:54 +01:00
Andy Wingo
e5d7c0f13b All arities serialize a "closure" binding
* module/language/cps/compile-bytecode.scm (compile-function): Always
  define a 'closure binding in slot 0.
* module/system/vm/frame.scm (available-bindings): No need to futz
  around not having a closure binding.
* module/system/vm/debug.scm (arity-arguments-alist): Expect a closure
  binding.
* test-suite/tests/rtl.test: Emit definitions for the closure.
2015-12-01 10:57:20 +01:00
Andy Wingo
e3cc0eeb3a Reflection support for unboxed f64 slots
* module/system/vm/assembler.scm (emit-definition): Add representation
  field.
  (write-arities): Emit representations into the arities section.

* module/system/vm/debug.scm (arity-definitions): Read representations.

* module/system/vm/frame.scm (<binding>): Add representation field and
  binding-representation getter.
  (available-bindings): Pass representation to make-binding.
  (frame-binding-set!, frame-binding-ref, frame-call-representation):
  Pass representation to frame-local-ref / frame-local-set!.

* test-suite/tests/rtl.test: Update definition instructions.

* module/language/cps/slot-allocation.scm ($allocation): Add
  representations field.
  (lookup-representation): New public function.
  (allocate-slots): Pass representations to make-$allocation.

* module/language/cps/compile-bytecode.scm (compile-function): Adapt to
  emit-definition change.

* libguile/frames.h:
* libguile/frames.c (scm_frame_local_ref, scm_frame_local_set_x): Take
  representation argument.
  (scm_to_stack_item_representation): New internal helper.
2015-10-28 17:43:55 +00:00
Andy Wingo
f03960412e Add stack size computation to disassembler
* module/system/vm/disassembler.scm (define-stack-effect-parser)
  (stack-effect-parsers, instruction-stack-size-after): New stack size
  facility.
  (define-clobber-parser, clobber-parsers, instruction-slot-clobbers):
  Take incoming and outgoing stack sizes as arguments to interpret
  SP-relative clobbers.

* module/system/vm/frame.scm (compute-frame-sizes): New helper that
  computes frame sizes for each position in a function.
  (compute-killv): Adapt to compute the clobbered set given the computed
  frame sizes.
2015-10-21 15:02:28 +02:00
Andy Wingo
08cf30f2a0 Fix error printing some wrong-num-args backtraces
* module/system/repl/debug.scm (print-frame): Pass #:top-frame? #t for
  the top frame.

* module/system/vm/frame.scm (available-bindings): Be permissive and
  allow #:top-frame? #f even when the IP is at the start of the
  function.
2015-07-20 16:24:49 +02:00
Andy Wingo
5062a56df0 Fix compute-predecessors bug in frame.scm
* module/system/vm/frame.scm (compute-predecessors): Fix bug in
  resolving targets of backwards branches.
2014-05-31 21:15:05 -04:00
Andy Wingo
7af8115675 Fix frame-call-representation for frames from apply-hook
* module/system/vm/frame.scm (frame-call-representation): Fix when
  called on frames that are created from the apply hook.
2014-05-04 22:51:34 +02:00
Andy Wingo
423164efa6 Program printing tweaks
* module/system/vm/program.scm (print-program): New public interface --
  the guts of write-program, but refactored to be able to work when only
  given an addr.
  (write-program): Use print-program.

* module/system/vm/frame.scm (frame-call-representation): Remove attempt
  to abbreviate procedure representations; was confusing because the
  result would write as a string, quotes and all.
2014-05-04 22:41:48 +02:00
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
6eae3141bf Fix a frame-call-representation bug
* module/system/vm/frame.scm (frame-call-representation): Fix logic for
  displaying names of non-procedures and procedures out of arities.
2014-04-16 17:16:10 +02:00
Andy Wingo
d856931d8d frame-call-representation checks available-bindings, as appropriate
* module/system/vm/frame.scm (available-bindings): Map indexes in such a
  way that the first argument is index 1.
  (frame-call-representation): Update to search the bindings for live
  bindings.
2014-04-16 14:19:18 +02:00
Andy Wingo
1a2711a848 Update frame-bindings interface
* module/system/repl/debug.scm (print-locals): Update to work with new
  interface.
  (frame->module): Update.  Still doesn't work due to lack of
  `program-module', though.

* module/system/vm/program.scm (make-binding, binding:name)
  (binding:definition-offset, program-arity-bindings-for-ip): Remove
  these.

* module/system/vm/frame.scm (<binding>): New type.
  (available-bindings): Return a list of <binding> instances.
  (frame-lookup-binding, frame-binding-set!, frame-binding-ref):
  (frame-environment, frame-object-name): Adapt.
2014-04-16 13:58:17 +02:00
Andy Wingo
c4c9bfffd7 Implement frame-bindings
* module/system/vm/frame.scm (parse-code, compute-predecessors):
  (compute-genv, compute-defs-by-slot, compute-killv, available-bindings):
  (frame-bindings): Add a bunch of hairy code to compute the set of
  bindings that are live in a frame.
2014-04-16 13:56:08 +02:00
Andy Wingo
c271065e54 Fix frame-call-representation for primitive applications
* module/system/vm/frame.scm (frame-call-representation): Fix to work
  for primitives.

* test-suite/tests/eval.test ("stacks"): Update expected result for
  substring.
2014-04-15 21:47:46 +02:00
Andy Wingo
bec786c1fe Better backtraces for optimized closures
* module/system/vm/debug.scm (arity-keyword-args, find-program-arity):
  New exports.

* module/system/vm/frame.scm (frame-call-representation): Prefer to use
  the frame IP to get the procedure.
2014-04-15 11:18:50 +02: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
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
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
1c33be992e Remove stack programs, objcode, and the old VM.
* libguile/Makefile.am:
* libguile/vm-i-loader.c:
* libguile/vm-i-scheme.c:
* libguile/vm-i-system.c: Remove the old VM files, and the rules to
  build the .i files.

* libguile/vm-engine.c:
* libguile/vm.c: Remove the old VM.  Woot!

* libguile/_scm.h (SCM_OBJCODE_COOKIE, SCM_OBJCODE_ENDIANNESS_OFFSET)
  (SCM_OBJCODE_WORD_SIZE_OFFSET): Remove.

* libguile/evalext.c (scm_self_evaluating_p): Remove objcode and program
  cases.

* libguile/frames.c (scm_frame_num_locals, scm_frame_previous): Remove
  program cases.

* libguile/gc.c (scm_i_tag_name): Remove objcode case.
* libguile/goops.c (scm_class_of, create_standard_classes): Remove
  objcode and program cases.

* libguile/instructions.h:
* libguile/instructions.c (scm_instruction_list, scm_instruction_p)
  (scm_instruction_length, scm_instruction_pops, scm_instruction_pushes)
  (scm_instruction_to_opcode, scm_opcode_to_instruction): Remove old VM
  code.

* libguile/objcodes.h:
* libguile/objcodes.c: Remove the objcode data type, and handling for
  objcode files.

* libguile/print.c: Remove objcode and program printers.

* libguile/procprop.c: Remove program cases.
* libguile/procs.c:

* libguile/programs.h:
* libguile/programs.c: Remove old program code.

* libguile/smob.c: Remove objcodes include.

* libguile/snarf.h: Remove static program defines.

* libguile/stacks.c: Remove program case.

* libguile/tags.h: Remove program and objcode tc7s.

* module/ice-9/session.scm (procedure-arguments)
* module/language/tree-il/analyze.scm (validate-arity)
* module/statprof.scm (get-call-data, procedure=?)
* module/system/vm/frame.scm (frame-bindings)
  (frame-call-representation): Remove old program cases.

* module/system/repl/debug.scm (frame->module): Add a FIXME.

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

* module/system/vm/program.scm: Remove old program code.
2013-11-08 18:28:24 +01:00
Andy Wingo
84680d2382 Miscellaneous fixups related to objcode removal.
* module/scripts/compile.scm: Fix --help message.

* module/system/repl/command.scm (disassemble): Fix error message.

* module/system/vm/frame.scm: Remove objcode import.

* module/system/vm/objcode.scm: Remove some exports related to the
  objcode type.
2013-11-08 17:42:54 +01:00
Andy Wingo
e15aa02284 Program sources are always pre-retire now
* module/system/repl/debug.scm (<debug>): Remove for-trap?.  Backtraces
  with RTL will always happen pre-retire on the top frame, source info
  is pre-retire, and continuations will always have a source-marked
  receive or receive-values or whatever with the right source marking,
  so we can remove this complication.
  (print-frame): Use frame-source.
  (print-frames): Remove for-trap? kw.

* module/system/repl/command.scm (define-stack-command, backtrace)
  (up, down, frame): Remove for-trap? introduced local, and its uses.
  (repl-pop-continuation-resumer): Adapt to make-debug change.

* module/system/repl/error-handling.scm (call-with-error-handling):
  Adapt to make-debug change.

* module/system/vm/frame.scm (frame-next-source): Remove.  RTL sources
  are pre-retire.

* module/system/vm/trap-state.scm (add-ephemeral-stepping-trap!): Adapt
  to use frame-source.  Still some work to do here.
2013-11-07 18:00:40 +01:00
Andy Wingo
f8fb13ef8c better RTL debugging
* libguile/frames.c (scm_frame_source, scm_frame_instruction_pointer):
  Fix to work with RTL programs.

* module/system/vm/debug.scm (find-debug-context): Allow for the
  possibility of there being no ELF image.
  (find-program-debug-info, find-program-arities)
  (program-minimum-arity, find-program-docstring)
  (find-program-properties, find-source-for-addr)
  (find-program-die, find-program-sources): Don't bail if we couldn't
  get the debug context.

* module/system/vm/frame.scm (frame-next-source)
  (frame-call-representation): Allow RTL programs.

* module/system/vm/program.scm (program-arguments-alist): Placeholder
  implementation for RTL programs.
  (program-arguments-alists): Don't bail if we couldn't get the
  arities.
2013-10-04 19:55:12 +02: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
da874e5415 fix more assumptions that the frame-procedure is a procedure
* libguile/frames.c (scm_frame_source, scm_frame_previous):
* libguile/stacks.c (scm_make_stack):
* module/ice-9/boot-9.scm (exception-printers):
* module/system/vm/frame.scm (frame-call-representation): Fix more
  assumptions that frame-procedure is a program, or even a procedure.
2012-05-11 14:30:43 +02:00
Andy Wingo
67b699cc77 refactor vm application of non-programs; boot continuation refactor
* libguile/frames.c (scm_frame_instruction_pointer):
* module/system/vm/frame.scm (frame-bindings):
  (frame-next-source, frame-call-representation): Fix a few locations
  that thought that the frame-procedure will always be a VM
  procedure.  This will not not be the case when traversing the stack of
  an application of a non-procedure.

* libguile/vm-i-system.c (call, tail-call, mv-call): Instead of
  special-casing structs and smobs at these call sites, just set up the
  stack, and jump to a generic apply loop if the proc is not a program.

* libguile/vm-engine.c: The generic apply loop is here.  Also, the boot
  program is now simply a boot continuation, and can handle any number
  of arguments.

* libguile/vm.c (make_boot_program): Update the code that makes the boot
  continuation.
2012-05-10 12:59:45 +02:00
Andy Wingo
423fca76e6 frame-source available in default environment
* libguile/frames.c (scm_frame_source): Don't call out to (system vm
  frames), as this routine is used when printing exceptions.  Make
  available in the default environment (ugh).

* module/system/vm/frame.scm: Remove frame-source definition and
  export.
2011-02-11 12:43:05 +01:00
Andy Wingo
b262b74b51 add program-sources-pre-retire to core and define frame-next-source
* libguile/programs.h:
* libguile/programs.c (scm_program_source): Add an optional arg, the
  sources table to traverse. Defaults to the result of
  scm_program_sources.

* module/system/vm/program.scm (program-sources-pre-retire): Move
  definition here from (system vm traps), and export.

* module/system/vm/traps.scm: Adapt.

* module/system/vm/frame.scm (frame-next-source): New exported binding,
  returns the source line corresponding to the next instruction instead
  of the previous instruction.
2010-10-08 12:31:56 +02:00
Andy Wingo
d608db1d59 fix error in frame-return-values
* module/system/vm/frame.scm (frame-return-values): Fix off-by-one
  error.
2010-10-08 12:31:56 +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
Ludovic Courtès
ea975f72cf Remove unneeded #:use-module.
* module/system/vm/frame.scm: Remove use of (srfi srfi-1).
2010-08-27 18:59:42 +02:00
Andy Wingo
8470b3f45b fix texinfo reflection for procedures
* module/system/vm/program.scm (program-arguments-alist): Rename from
  program-arguments, a name shadowed by features.c
  (arglist->arguments-alist, arity->arguments-alist)
  (arguments-alist->lambda-list, program-lambda-list, write-program):
  Adapt callers.

* module/system/vm/frame.scm (frame-lookup-binding): Return #f if the
  binding is not found, not an error.
  (frame-binding-set!, frame-binding-ref): Adapt to error appropriately.
  (frame-arguments): Dispatch to frame-call-representation.
  (frame-call-representation): Refactor a bit.

* module/ice-9/session.scm (procedure-arguments): Adapt to
  program-arguments name change.

* module/texinfo/reflection.scm (get-proc-args): Refactor to actually
  work with VM procedures.
2010-01-12 22:50:10 +01:00