bpt/guile.git
10 years agoUse version 2.2 in manual examples
Andy Wingo [Thu, 28 Nov 2013 09:57:42 +0000 (10:57 +0100)]
Use version 2.2 in manual examples

* doc/ref/api-evaluation.texi (Load Paths):
* doc/ref/api-options.texi (Build Config):
* doc/ref/guile-invoke.texi (Environment Variables):
* doc/ref/libguile-parallel.texi (Parallel Installations): Use 2.2 in
  examples, rather than 2.0.

10 years agoFix some references to objcode in the manual
Andy Wingo [Thu, 28 Nov 2013 09:56:55 +0000 (10:56 +0100)]
Fix some references to objcode in the manual

* doc/ref/api-evaluation.texi (Compilation): Update references from
  "objcode" to "rtl".

10 years agoRemove nonfunctional gdb interface
Andy Wingo [Wed, 27 Nov 2013 21:30:15 +0000 (22:30 +0100)]
Remove nonfunctional gdb interface

* libguile/gdb_interface.h:
* libguile/gdbint.c:
* libguile/gdbint.h: Remove.  These were last modified significantly in
  1997 and I think they are unused.

* libguile/guile.c: Remove use.
* libguile.h: Remove inclusion.
* libguile/Makefile.am: Remove reference.
* libguile/init.c: Remove use.

10 years agoRemove the restore-continuation-hook.
Andy Wingo [Wed, 27 Nov 2013 21:03:58 +0000 (22:03 +0100)]
Remove the restore-continuation-hook.

* libguile/vm.h:
* libguile/vm.c:
* libguile/vm-engine.c:
* module/system/vm/traps.scm:
* module/system/vm/vm.scm: Remove the unused and redundant
  restore-continuation-hook.

10 years agoDeclare r6rs-ports functions
Andy Wingo [Wed, 27 Nov 2013 20:13:20 +0000 (21:13 +0100)]
Declare r6rs-ports functions

* libguile/r6rs-ports.h:
* libguile/r6rs-ports.c: Declare scm_unget_bytevector and
  scm_i_make_transcoded_port.

10 years agoFix uninitialized variable error in some peek-char error cases
Andy Wingo [Wed, 27 Nov 2013 18:50:13 +0000 (19:50 +0100)]
Fix uninitialized variable error in some peek-char error cases

* libguile/ports.c (scm_peek_char): Don't require error cases to
  set *len.  Fixes a bug caught by GCC whereby an EOF while reading a
  multibyte character with iconv would leave len uninitialized.

10 years agoDeclare scm_i_open_file to silence a warning
Andy Wingo [Wed, 27 Nov 2013 18:36:46 +0000 (19:36 +0100)]
Declare scm_i_open_file to silence a warning

* libguile/fports.c (scm_i_open_file): Declare.

10 years agoRemove generalized vector interface; deprecated in 2.0 already.
Andy Wingo [Wed, 27 Nov 2013 18:31:09 +0000 (19:31 +0100)]
Remove generalized vector interface; deprecated in 2.0 already.

* libguile/deprecated.c: Remove the generalized-vector interface,
  deprecated since 2.0.8.

10 years agoDeclare scm_nil_p
Andy Wingo [Wed, 27 Nov 2013 18:30:18 +0000 (19:30 +0100)]
Declare scm_nil_p

* libguile/boolean.h: Declare scm_nil_p.

10 years agoBuild psyntax-pp serially after eval.go.
Andy Wingo [Tue, 26 Nov 2013 09:47:29 +0000 (10:47 +0100)]
Build psyntax-pp serially after eval.go.

* module/Makefile.am: Arrange to build psyntax-pp.go in serial mode,
  after eval.go.  Before the expander is compiled, expanding all the
  Scheme files dominates compile-time, even for larger files like
  psyntax-pp.scm.  If we compile psyntax in parallel with other files,
  it could be one of the other files finishes first, leading to two
  consecutive compiles that have to use an uncompiled psyntax expander.
  Ordering the compilation minimizes total real and user time, at least
  locally on a 4-core machine.

  Also take the opportunity to shuffle compile order for the rest of the
  Scheme files, to build parts of the RTL compiler early.

10 years agoContification converges more quickly
Andy Wingo [Mon, 25 Nov 2013 19:07:27 +0000 (20:07 +0100)]
Contification converges more quickly

* module/language/cps/contification.scm (compute-contification):
  Converge more quickly by using the information we compute within a
  compute-contification pass.

10 years agoCompute-contification also visits body
Andy Wingo [Sun, 24 Nov 2013 12:59:18 +0000 (13:59 +0100)]
Compute-contification also visits body

* module/language/cps/contification.scm (compute-contification): If we
  decide to contify, don't forget to visit the body.  Should make
  contification converge faster.

10 years agoExpandable stacks.
Andy Wingo [Fri, 22 Nov 2013 16:31:07 +0000 (17:31 +0100)]
Expandable stacks.

* libguile/vm-engine.c (CHECK_OVERFLOW): Call vm_expand_stack, not
  vm_error_stack_overflow.
* libguile/vm.c (hard_max_stack_size, default_max_stack_size): Recast
  #defines as locals.  Have both hard and soft stack limits.
  (initialize_default_stack_size): Set soft stack limit from
  GUILE_STACK_SIZE.
  (expand_stack, vm_expand_stack): Support for expanding stacks as
  needed.  Whee!
  (make_vm): Adapt limits.
  (scm_call_n): Expand stack if needed.

* libguile/vm.h (struct scm_vm): Add max_stack_size member.

10 years agoVM copes with moving FP
Andy Wingo [Fri, 22 Nov 2013 17:35:02 +0000 (18:35 +0100)]
VM copes with moving FP

* libguile/_scm.h (SCM_ASYNC_TICK_WITH_GUARD_CODE): New macro.
* libguile/vm-engine.c (VM_HANDLE_INTERRUPTS): Restore FP after
  ticking.
  (CACHE_FP): New macro.
  (CHECK_OVERFLOW): Use CACHE_FP.
  (BR_ARITHMETIC, RETURN_EXP, RETURN_ONE_VALUE, BINARY_INTEGER_OP):
  (call, return-values, subr-call, foreign-call)
  (resolve, define!, toplevel-box, module-box): Restore the FP from the
  vp where needed.

10 years agoSimplify state sync in VM before potential bailout.
Andy Wingo [Fri, 22 Nov 2013 17:06:35 +0000 (18:06 +0100)]
Simplify state sync in VM before potential bailout.

* libguile/vm-engine.c (SYNC_IP): Remove calls to SYNC_BEFORE_GC, a
  no-op.  Replace SYNC_REGISTER / SYNC_ALL calls with just SYNC_IP.

10 years agoMore precise stack marking.
Andy Wingo [Fri, 22 Nov 2013 14:02:17 +0000 (15:02 +0100)]
More precise stack marking.

* libguile/vm.c (scm_i_vm_mark_stack): Mark the stack more precisely.

10 years agoAllocate stacks using mmap, and mark them via the thread marker
Andy Wingo [Fri, 22 Nov 2013 13:41:19 +0000 (14:41 +0100)]
Allocate stacks using mmap, and mark them via the thread marker

* libguile/threads.c (thread_mark): Mark the VM stack, if we have one.
  (on_thread_exit): Free the VM stack here.

* libguile/vm.c (make_vm): Allocate the VM stack using mmap, and arrange
  for it to be marked by the thread marker.
  (scm_i_vm_mark_stack, scm_i_vm_free_stack): New internal interfaces.
  (allocate_stack, free_stack): New helpers.

10 years agoAdd thread mark procedure
Andy Wingo [Fri, 22 Nov 2013 12:01:53 +0000 (13:01 +0100)]
Add thread mark procedure

* libguile/threads.c (thread_mark): A mark procedure for threads.
  Eventually will mark the stack.
  (guilify_self_1): Move initialization of VP earlier.  Allocate thread
  using thread_gc_kind.
  (scm_threads_prehistory): Initialize thread_gc_kind.

10 years agoRemove unused scm_i_thread fields
Andy Wingo [Fri, 22 Nov 2013 09:59:14 +0000 (10:59 +0100)]
Remove unused scm_i_thread fields

* libguile/threads.h (scm_i_thread):
* libguile/threads.c (guilify_self_1): Remove unused mark stack fields.

10 years agoRemove tests and shims for pre-7.2 bdw-gc.
Andy Wingo [Fri, 22 Nov 2013 09:51:56 +0000 (10:51 +0100)]
Remove tests and shims for pre-7.2 bdw-gc.

* configure.ac: Remove checks for symbols present in bdw-gc 7.2.

* libguile/finalizers.c:
* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/guardians.c:
* libguile/scmsigs.c:
* libguile/threads.c: Remove shims.

10 years agoAdd explicit nopcodes
Andy Wingo [Thu, 21 Nov 2013 21:51:38 +0000 (22:51 +0100)]
Add explicit nopcodes

* libguile/vm-engine.c (VM_NAME): Add explicit nopcodes, later to be
  interspersed with others.  This will allow us some extensibility
  without always shuffling around opcodes.  Also avoid lazy
  initialization; have the linker do it for us.

* libguile/instructions.c (parse_instruction):
  (scm_instruction_list): Rework instruction parsing to avoid using
  malloc.  It would seem that this would fix some GC issue -- but who
  knows!

10 years agoSetjmp before calling into the VM
Andy Wingo [Thu, 21 Nov 2013 20:15:58 +0000 (21:15 +0100)]
Setjmp before calling into the VM

* libguile/vm-engine.c (CACHE_REGISTER): Remove an unneeded cast.
  (VM_NAME):
* libguile/vm.c (scm_call_n): Setjmp out here.  This leaves the VM
  without any initialization work to do.  It also makes it possible to
  restart the VM in another mode (with hooks, for example).

10 years agoscm_call_n sets up boot continuation frame for VM
Andy Wingo [Thu, 21 Nov 2013 18:05:43 +0000 (19:05 +0100)]
scm_call_n sets up boot continuation frame for VM

* libguile/vm-engine.c:
* libguile/vm.c (scm_call_n): Move boot continuation setup to
  scm_call_n, so that vm-engine takes all of its state from the vp.

10 years agoscm_call_n avoids double TLS lookup
Andy Wingo [Thu, 21 Nov 2013 17:50:12 +0000 (18:50 +0100)]
scm_call_n avoids double TLS lookup

* libguile/vm-engine.c (VM_NAME): Take the current thread as an
  argument.
* libguile/vm.c (scm_i_capture_current_stack): Call thread_vm.
  (thread_vm): New helper.
  (scm_the_vm): Call thread_vm.
  (scm_call_n): Call thread_vm.  Avoids a double TLS lookup.

10 years agoRemove scm_tc7_vm
Andy Wingo [Thu, 21 Nov 2013 17:37:52 +0000 (18:37 +0100)]
Remove scm_tc7_vm

* libguile/tags.h (scm_tc7_vm): Return to pool.

* libguile/goops.c:
* libguile/gc.c (scm_i_tag_name):
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/print.c (iprin1): Remove tc7_vm things.

* libguile/vm.h (scm_the_vm_fluid): Remove stray declaration.  Remove
  SCM_VM_P.  Remove SCM_VM_DATA.  Remove SCM_VALIDATE_VM.
* libguile/vm.c (scm_i_vm_print): Remove.

10 years agoRemove last use of SCM vm
Andy Wingo [Thu, 21 Nov 2013 17:33:06 +0000 (18:33 +0100)]
Remove last use of SCM vm

* libguile/threads.h (scm_i_thread): Hold a struct scm_vm*, not a SCM
  vm.
* libguile/threads.c (guilify_self_2):
* libguile/vm.c (make_vm): Adapt.

10 years agoscm_the_vm now returns raw struct scm_vm pointer
Andy Wingo [Thu, 21 Nov 2013 17:28:06 +0000 (18:28 +0100)]
scm_the_vm now returns raw struct scm_vm pointer

* libguile/vm.h (scm_the_vm): Return struct scm_vm*.
  (scm_c_vm_run): Remove.

* libguile/control.c:
* libguile/eval.c:
* libguile/throw.c:
* libguile/vm.c: Adapt.

10 years agoPrefer scm_call_n to scm_c_vm_run (scm_the_vm())
Andy Wingo [Thu, 21 Nov 2013 17:23:08 +0000 (18:23 +0100)]
Prefer scm_call_n to scm_c_vm_run (scm_the_vm())

* libguile/vm.c (scm_i_capture_current_stack): Cosmetic tweak.
  (scm_call_n): Define here instead of in eval.c.  All callers of
  scm_c_vm_run were passing scm_the_vm() as the VM.  Eventually
  scm_call_n will replace scm_c_vm_run.

* libguile/eval.c: Adapt all callers.

10 years agoscm_i_prompt_pop_abort_args_x takes struct scm_vm* as arg
Andy Wingo [Thu, 21 Nov 2013 17:09:29 +0000 (18:09 +0100)]
scm_i_prompt_pop_abort_args_x takes struct scm_vm* as arg

* libguile/control.h:
* libguile/control.c (scm_i_prompt_pop_abort_args_x): Change to take VP
  as an arg, not VM.

* libguile/eval.c (eval):
* libguile/throw.c (pre_init_catch): Adapt.

10 years agoEngine takes struct scm_vm* as argument
Andy Wingo [Thu, 21 Nov 2013 16:52:00 +0000 (17:52 +0100)]
Engine takes struct scm_vm* as argument

* libguile/vm-engine.c:
* libguile/vm.c (scm_c_vm_run): VM engine now takes struct scm_vm* as
  argument, not SCM vm.

10 years agoOne more SCM vm user: continuations.
Andy Wingo [Thu, 21 Nov 2013 16:50:33 +0000 (17:50 +0100)]
One more SCM vm user: continuations.

* libguile/continuations.c:
* libguile/continuations.h (struct scm_t_contregs): Rename SCM vm member
  to struct scm_vm *vp.
  (scm_i_make_continuation): Take vp instead of vm.
  (scm_i_contregs_vp): Rename from scm_i_contregs_vm, return vp.

* libguile/vm-engine.c (continuation-call, call/cc): Fix remaining SCM
  vm user.

* libguile/vm.c (vm_return_to_continuation): Adapt prototype.

10 years agoRemove last use of SCM vm in VM
Andy Wingo [Thu, 21 Nov 2013 16:36:22 +0000 (17:36 +0100)]
Remove last use of SCM vm in VM

* libguile/control.h:
* libguile/control.c (reify_partial_continuation, scm_c_abort): Take
  struct scm_vm *vp as an arg.

* libguile/dynstack.h: Remove control.h include.

* libguile/vm.c (vm_abort): Take struct scm_vm *vp as an arg.

* libguile/vm-engine.c (abort): Adapt to vm_abort change.

10 years agoRemove use of SCM vm in compose-continuation
Andy Wingo [Thu, 21 Nov 2013 16:28:34 +0000 (17:28 +0100)]
Remove use of SCM vm in compose-continuation

* libguile/vm.c (vm_reinstate_partial_continuation): Take struct scm_vm
  argument instead of SCM.
* libguile/vm-engine.c (compose-continuation): Adapt.

10 years agoDispatch hooks use "vp" rather than "vm"
Andy Wingo [Thu, 21 Nov 2013 16:24:48 +0000 (17:24 +0100)]
Dispatch hooks use "vp" rather than "vm"

* libguile/vm.c (vm_dispatch_hook):
  (vm_dispatch_apply_hook):
  (vm_dispatch_push_continuation_hook):
  (vm_dispatch_pop_continuation_hook):
  (vm_dispatch_next_hook):
  (vm_dispatch_abort_hook):
  (vm_dispatch_restore_continuation_hook): Use scm_vm pointer instead of
  Scheme vm object.

10 years agoHeap frame "stack holders" are raw scm_vm / scm_vm_cont pointers
Andy Wingo [Thu, 21 Nov 2013 16:21:37 +0000 (17:21 +0100)]
Heap frame "stack holders" are raw scm_vm / scm_vm_cont pointers

* libguile/frames.h (struct scm_frame): stack_holder is a void*.
* libguile/frames.c (scm_i_frame_stack_base, scm_i_frame_offset): Expect
  stack_holder to be the raw struct scm_vm or scm_vm_cont.

* libguile/continuations.c (scm_i_continuation_to_frame):
* libguile/stacks.c (scm_make_stack)
* libguile/vm.c (vm_dispatch_hook): Adapt creators.

10 years agoHeap frames have a "frame kind" bit
Andy Wingo [Thu, 21 Nov 2013 16:13:18 +0000 (17:13 +0100)]
Heap frames have a "frame kind" bit

* libguile/frames.h (enum scm_vm_frame_kind, SCM_VM_FRAME_KIND)
  (scm_c_make_frame): Add a "frame kind" bit to the first word.  This
  will allow the "stack holder" to be a non-SCM object.

* libguile/continuations.c (scm_i_continuation_to_frame):
* libguile/frames.c (scm_c_make_frame, scm_frame_previous)
* libguile/stacks.c (scm_make_stack):
* libguile/vm.c (vm_dispatch_hook): Adapt frame creators to set the
  frame kind bit.

10 years agoThe dynamic stack records SP and FP values as offsets
Andy Wingo [Thu, 21 Nov 2013 11:12:38 +0000 (12:12 +0100)]
The dynamic stack records SP and FP values as offsets

* libguile/dynstack.h:
* libguile/dynstack.c (PROMPT_FP, PROMPT_SP):
  (scm_dynstack_push_prompt, scm_dynstack_find_prompt): Prompts on the
  dynstack are recorded as offsets from the base stack address in this
  thread.

* libguile/control.c (scm_c_abort):
* libguile/eval.c (eval):
* libguile/stacks.c (find_prompt, narrow_stack):
* libguile/throw.c (pre_init_catch):
* libguile/vm-engine.c (prompt): Adapt.

10 years agoReorder struct scm_vm fields.
Andy Wingo [Thu, 21 Nov 2013 15:51:04 +0000 (16:51 +0100)]
Reorder struct scm_vm fields.

* libguile/vm.h (struct scm_vm): Reorder fields, perhaps for better
  locality.

10 years agoNo more VM objects visible to Scheme
Andy Wingo [Thu, 21 Nov 2013 15:45:03 +0000 (16:45 +0100)]
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.

10 years agoVM accessors take VM as implicit argument, not explicit argument
Andy Wingo [Thu, 21 Nov 2013 15:10:41 +0000 (16:10 +0100)]
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.

10 years agoChange eval.c to use scm_c_vm_run instead of scm_call_with_vm.
Andy Wingo [Thu, 21 Nov 2013 14:41:27 +0000 (15:41 +0100)]
Change eval.c to use scm_c_vm_run instead of scm_call_with_vm.

* libguile/eval.c (scm_apply_0, scm_apply_1, scm_apply_2, scm_apply_3)
  (scm_map, scm_for_each, scm_apply): Change to prefer scm_apply_0, and
  to have it call vm_run instead of call_with_vm.
  (eval): Use scm_apply_0 and scm_call_0.

* libguile/srfi-1.c (scm_srfi1_count): Use scm_apply_0.

10 years agoRemove unused vm:ip, vm:sp, vm:fp
Andy Wingo [Thu, 21 Nov 2013 14:02:36 +0000 (15:02 +0100)]
Remove unused vm:ip, vm:sp, vm:fp

* libguile/vm.h:
* libguile/vm.c (scm_vm_ip, scm_vm_fp, scm_vm_sp): Remove unused
  functions.

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

10 years agoRemove make-vm; there will be one vm per thread now.
Andy Wingo [Thu, 21 Nov 2013 13:59:58 +0000 (14:59 +0100)]
Remove make-vm; there will be one vm per thread now.

* libguile/vm.h:
* libguile/vm.c (scm_make_vm): Remove.

* module/system/vm/vm.scm: Remove make-vm export.

* test-suite/tests/control.test ("the-vm"):
* test-suite/tests/coverage.test (%test-vm):
* test-suite/tests/eval.test ("stack overflow"): Adapt tests.

10 years agoScheme frame objects hold relative stack offsets
Andy Wingo [Thu, 21 Nov 2013 10:20:19 +0000 (11:20 +0100)]
Scheme frame objects hold relative stack offsets

* libguile/frames.h: Wrap the C interface to VM frames in
  BUILDING_LIBGUILE.  Change VM frames to record relative offsets into a
  stack held by some other object, so that if the stack moves they will
  remain valid.
* libguile/frames.c (scm_c_make_frame): Remove offset argument.
  (scm_i_frame_offset): Instead, compute the offset from the stack
  holder.
  (scm_i_frame_stack_base): New helper.
  (scm_frame_previous): Adapt.

* libguile/stacks.c (scm_make_stack)
* libguile/vm.c (vm_dispatch_hook):
* libguile/continuations.c (scm_i_continuation_to_frame): Adapt.

10 years agoPrepare for moveable stacks in the VM.
Andy Wingo [Thu, 21 Nov 2013 09:23:35 +0000 (10:23 +0100)]
Prepare for moveable stacks in the VM.

* libguile/vm-engine.c (CHECK_OVERFLOW, ALLOC_FRAME, vm_engine): Prepare
  for moveable stacks.

10 years agoCHECK_OVERFLOW tweak
Andy Wingo [Thu, 21 Nov 2013 09:07:58 +0000 (10:07 +0100)]
CHECK_OVERFLOW tweak

* libguile/vm-engine.c (CHECK_OVERFLOW): Now that we aren't checking for
  overflow on every push, fetch the stack limit from the vm instead of a
  local.

10 years agoFix standalone tests
Andy Wingo [Wed, 20 Nov 2013 19:01:30 +0000 (20:01 +0100)]
Fix standalone tests

* test-suite/vm/run-vm-tests.scm: Fix for objcode -> loader rename.

10 years agovm-engine cosmetic cleanup
Andy Wingo [Wed, 20 Nov 2013 18:38:37 +0000 (19:38 +0100)]
vm-engine cosmetic cleanup

* libguile/vm-engine.c: Reindent UNPACK macros.

10 years agoRemove unused resolve_variable helper
Andy Wingo [Wed, 20 Nov 2013 18:38:06 +0000 (19:38 +0100)]
Remove unused resolve_variable helper

* libguile/vm.c (resolve_variable): Remove unused helper.

10 years agoRework hook dispatch mechanism
Andy Wingo [Tue, 19 Nov 2013 21:14:20 +0000 (22:14 +0100)]
Rework hook dispatch mechanism

* libguile/vm-engine.c (RUN_HOOK, RUN_HOOK0, RUN_HOOK1): Rework to
  dispatch through specific per-hook procedures.  Might reduce register
  pressure in the VM.

* libguile/vm.c (vm_dispatch_apply_hook):
  (vm_dispatch_push_continuation_hook):
  (vm_dispatch_pop_continuation_hook):
  (vm_dispatch_next_hook):
  (vm_dispatch_abort_hook):
  (vm_dispatch_restore_continuation_hook): New internal helpers.

10 years agoRemove VM_ENABLE_STACK_NULLING
Andy Wingo [Tue, 19 Nov 2013 20:47:55 +0000 (21:47 +0100)]
Remove VM_ENABLE_STACK_NULLING

* libguile/vm.c: Remove code dependent on VM_ENABLE_STACK_NULLING.  This
  defined didn't work and doesn't apply to the RTL model.

10 years agoRename objcodes?.{scm,c,h} to loader.{scm,c,h}
Andy Wingo [Tue, 19 Nov 2013 20:45:07 +0000 (21:45 +0100)]
Rename objcodes?.{scm,c,h} to loader.{scm,c,h}

* libguile/loader.c:
* libguile/loader.h: Rename from objcodes.[ch].
* module/system/vm/loader.scm: Rename from objcode.scm.

* libguile/Makefile.am:
* libguile/gsubr.c:
* libguile/init.c:
* libguile/procs.c:
* libguile/vm.c:
* module/Makefile.am:
* module/ice-9/eval-string.scm:
* module/language/rtl/spec.scm:
* module/system/base/target.scm:
* module/system/repl/command.scm:
* module/system/repl/common.scm:
* module/system/vm/debug.scm:
* module/system/vm/disassembler.scm:
* module/system/vm/objcode.scm:
* test-suite/tests/compiler.test:
* test-suite/tests/dwarf.test:
* test-suite/tests/rtl-compilation.test:
* test-suite/tests/rtl.test: Adapt.

10 years agoRemove (oop goops) <objcode> export
Andy Wingo [Tue, 19 Nov 2013 20:32:42 +0000 (21:32 +0100)]
Remove (oop goops) <objcode> export

* module/oop/goops.scm (oop): Remove objcode export.

10 years agoFix gsubr comment
Andy Wingo [Tue, 19 Nov 2013 20:27:38 +0000 (21:27 +0100)]
Fix gsubr comment

* libguile/gsubr.c: Update comment to excise RTL.

10 years agoLingering RTL excision in vm.c
Andy Wingo [Tue, 19 Nov 2013 20:26:26 +0000 (21:26 +0100)]
Lingering RTL excision in vm.c

* libguile/vm-engine.c:
* libguile/vm.c: Rework VM inclusion so that we don't define VM_ENGINE
  and expect vm-engine.c to understand that -- since there is only
  VM_USE_HOOKS, define that in vm.c directly.  Rename rtl_vm_foo to
  vm_foo.

* libguile/vm.h: Remove scm_t_vm_engine typedef.

10 years agoMove RTL unpack macros to vm-engine.c
Andy Wingo [Tue, 19 Nov 2013 20:11:28 +0000 (21:11 +0100)]
Move RTL unpack macros to vm-engine.c

* libguile/instructions.h: Remove SCM_UNPACK macros from here.
* libguile/vm-engine.c: Add them here, without the RTL_, and without the
  SCM_ prefix.

10 years agoChange SCM_PACK_RTL macros to SCM_PACK_OP / SCM_PACK_OP_ARG
Andy Wingo [Tue, 19 Nov 2013 20:04:24 +0000 (21:04 +0100)]
Change SCM_PACK_RTL macros to SCM_PACK_OP / SCM_PACK_OP_ARG

* libguile/instructions.h: Guard in BUILDING_LIBGUILE.
  (SCM_PACK_OP_24):
  (SCM_PACK_OP_8_8_8):
  (SCM_PACK_OP_8_16):
  (SCM_PACK_OP_16_8):
  (SCM_PACK_OP_12_12): Rename from SCM_PACK_RTL_*, and splice in the
  opcode.
  (SCM_PACK_OP_ARG_8_24): New helper.

* libguile/vm.c:
* libguile/gsubr.c:
* libguile/foreign.c:
* libguile/control.c:
* libguile/continuations.c: Adapt.

10 years agoscm_rtl_op_* -> scm_op_*
Andy Wingo [Tue, 19 Nov 2013 19:31:21 +0000 (20:31 +0100)]
scm_rtl_op_* -> scm_op_*

* libguile/instructions.h (scm_opcode): Rename from scm_rtl_opcode.
  Rename opcodes from scm_rtl_op_* to scm_op_*.

* libguile/continuations.c:
* libguile/control.c:
* libguile/foreign.c:
* libguile/gsubr.c:
* libguile/instructions.c:
* libguile/vm.c: Adapt.

10 years ago(system vm instruction) rtl-instruction-list -> (language rtl) instruction-list
Andy Wingo [Tue, 19 Nov 2013 19:45:57 +0000 (20:45 +0100)]
(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.

10 years agoInternal RTL excision in vm.c
Andy Wingo [Tue, 19 Nov 2013 19:05:45 +0000 (20:05 +0100)]
Internal RTL excision in vm.c

* libguile/vm.c (vm_boot_continuation, vm_boot_continuation_code):
  Rename from rtl_boot_continuation[_code].
  (scm_bootstrap_vm):
* libguile/vm-engine.c (rtl_vm_engine): Adapt.

10 years agoSmall comment fix.
Andy Wingo [Tue, 19 Nov 2013 19:02:49 +0000 (20:02 +0100)]
Small comment fix.

* libguile/vm-builtins.h: Rename RTL to VM in a comment.

10 years agoRename DT_GUILE_VM_VERSION.
Andy Wingo [Tue, 19 Nov 2013 19:02:15 +0000 (20:02 +0100)]
Rename DT_GUILE_VM_VERSION.

* libguile/objcodes.c (DT_GUILE_VM_VERSION, process_dynamic_segment):
* module/system/vm/elf.scm (DT_GUILE_VM_VERSION): Rename from
  DT_GUILE_RTL_VERSION.
* module/system/vm/assembler.scm (link-dynamic-section): Adapt.

10 years agoRename internal rtl-program-properties -> program-properties
Andy Wingo [Tue, 19 Nov 2013 18:50:15 +0000 (19:50 +0100)]
Rename internal rtl-program-properties -> program-properties

* module/system/vm/program.scm (program-properties): Rename from
  rtl-program-properties.

* libguile/programs.c (scm_i_program_properties): Adapt.

10 years agoExcise "rtl-" from fallback program printer
Andy Wingo [Tue, 19 Nov 2013 18:47:33 +0000 (19:47 +0100)]
Excise "rtl-" from fallback program printer

* libguile/programs.c (scm_i_program_print): Fallback printer uses
  "program", not "rtl-program".

10 years agoRename internals of (system vm program) program-minimum-arity
Andy Wingo [Tue, 19 Nov 2013 18:45:56 +0000 (19:45 +0100)]
Rename internals of (system vm program) program-minimum-arity

* module/system/vm/debug.scm (find-program-minimum-arity): Rename from
  program-minimum-arity.

* module/system/vm/program.scm (program-minimum-arity): Rename from
  rtl-program-minimum-arity.

* libguile/programs.c (scm_i_program_arity): Adapt.

10 years agoRename (system vm program) internal functions to remove rtl-
Andy Wingo [Tue, 19 Nov 2013 18:36:16 +0000 (19:36 +0100)]
Rename (system vm program) internal functions to remove rtl-

* module/system/vm/program.scm (program-name)
  (program-documentation): Rename (removing rtl-).
* libguile/programs.c (scm_i_program_name):
  (scm_i_program_documentation): Adapt callers.

10 years agoRemove unused C scm_program_source.
Andy Wingo [Tue, 19 Nov 2013 18:19:55 +0000 (19:19 +0100)]
Remove unused C scm_program_source.

* libguile/programs.c (scm_program_source): Remove; not called.  (The
  definition is in Scheme.)

10 years agoReorganize programs.h.
Andy Wingo [Tue, 19 Nov 2013 18:18:36 +0000 (19:18 +0100)]
Reorganize programs.h.

* libguile/programs.h: Reorganize.

10 years agortl-program-code -> program-code
Andy Wingo [Tue, 19 Nov 2013 18:16:26 +0000 (19:16 +0100)]
rtl-program-code -> program-code

* libguile/programs.h:
* libguile/programs.c (scm_program_code): Rename from
  scm_rtl_program_code.  Also renames rtl-program-code to program-code.

* 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/program.scm:
* module/system/vm/traps.scm:
* test-suite/tests/dwarf.test:
* test-suite/tests/rtl.test: Adapt callers.

10 years agortl-program? -> program?
Andy Wingo [Tue, 19 Nov 2013 18:11:40 +0000 (19:11 +0100)]
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.

10 years agoRemove make-rtl-program.
Andy Wingo [Tue, 19 Nov 2013 18:03:09 +0000 (19:03 +0100)]
Remove make-rtl-program.

* libguile/programs.h:
* libguile/programs.c (scm_make_rtl_program): Remove.  Unused.

* module/system/vm/program.scm (system): Remove make-rtl-program
  export.  Unused.

10 years agoscm_i_rtl_program_* -> scm_i_program_*
Andy Wingo [Tue, 19 Nov 2013 17:57:31 +0000 (18:57 +0100)]
scm_i_rtl_program_* -> scm_i_program_*

* libguile/programs.h (scm_i_make_program):
* libguile/programs.c (scm_i_program_name):
  (scm_i_program_documentation):
  (scm_i_program_properties): Remove "rtl_" infix.

* libguile/objcodes.c:
* libguile/procprop.c:
* libguile/vm.c: Adapt callers.

10 years agoscm_i_make_rtl_program in BUILDING_LIBGUILE
Andy Wingo [Tue, 19 Nov 2013 17:55:03 +0000 (18:55 +0100)]
scm_i_make_rtl_program in BUILDING_LIBGUILE

* libguile/programs.h (scm_i_make_rtl_program): Enclose in a
  BUILDING_LIBGUILE guard.

10 years agoRemove RTL_ infix from macros
Andy Wingo [Tue, 19 Nov 2013 17:28:19 +0000 (18:28 +0100)]
Remove RTL_ infix from macros

* libguile/programs.h (SCM_PROGRAM_P):
  (SCM_PROGRAM_CODE):
  (SCM_PROGRAM_FREE_VARIABLES):
  (SCM_PROGRAM_FREE_VARIABLE_REF):
  (SCM_PROGRAM_FREE_VARIABLE_SET):
  (SCM_PROGRAM_NUM_FREE_VARIABLES):
  (SCM_VALIDATE_PROGRAM): Remove RTL_ infix.

* libguile/continuations.c:
* libguile/continuations.h:
* libguile/control.c:
* libguile/foreign.c:
* libguile/frames.c:
* libguile/gsubr.c:
* libguile/gsubr.h:
* libguile/procprop.c:
* libguile/procs.c:
* libguile/programs.c:
* libguile/stacks.c:
* libguile/vm-engine.c: Adapt.

10 years agoRename scm_tc7_rtl_program to scm_tc7_program
Andy Wingo [Tue, 19 Nov 2013 17:24:22 +0000 (18:24 +0100)]
Rename scm_tc7_rtl_program to scm_tc7_program

* libguile/tags.h (scm_tc7_program): Rename from scm_tc7_rtl_program.
* libguile/continuations.c:
* libguile/control.c:
* libguile/evalext.c:
* libguile/foreign.c:
* libguile/goops.c:
* libguile/gsubr.c:
* libguile/print.c:
* libguile/programs.c:
* libguile/programs.h:
* libguile/vm-engine.c: Adapt users.

* module/system/vm/assembler.scm: Rename a tc7-rtl-program local to
  tc7-program.
* libguile/tags.h (scm_tc7_program): Rename from scm_tc7_rtl_program. * libguile/continuations.c: * libguile/control.c: * libguile/evalext.c: * libguile/foreign.c: * libguile/goops.c: * libguile/gsubr.c: * libguile/print.c: * libguile/programs.c: * libguile/programs.h: * libguile/vm-engine.c: Adapt users.

* module/system/vm/assembler.scm: Rename a tc7-rtl-program local to
  tc7-program.

10 years agoAll instruction pointers are now scm_t_uint32*
Andy Wingo [Tue, 19 Nov 2013 17:09:34 +0000 (18:09 +0100)]
All instruction pointers are now scm_t_uint32*

* libguile/frames.h (SCM_FRAME_RTL_RETURN_ADDRESS)
  (SCM_FRAME_SET_RTL_RETURN_ADDRESS): Remove.  The variants without _RTL
  now work fine.
  (struct scm_vm_frame): Change the return address to be a
  scm_t_uint32*.
  (struct scm_frame): Change IP to be scm_t_uint32*.

* libguile/frames.c (scm_c_make_frame)
* libguile/control.c (reify_partial_continuation, scm_c_abort)
* libguile/dynstack.c (PROMPT_IP)
  (scm_dynstack_push_prompt, scm_dynstack_find_prompt)
* libguile/dynstack.h:
* libguile/vm-engine.c (SYNC_IP, RETURN_ONE_VALUE)
  (call, return-values, prompt): Adapt.

10 years agoFrame pointer points to local 0 instead of local 1
Andy Wingo [Sun, 17 Nov 2013 21:07:44 +0000 (22:07 +0100)]
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.

10 years agoRemove use of SCM_CRITICAL_SECTION in smob.c
Andy Wingo [Fri, 15 Nov 2013 16:14:15 +0000 (17:14 +0100)]
Remove use of SCM_CRITICAL_SECTION in smob.c

* libguile/smob.c (scm_make_smob_type): Use a mutex instead of a
  critical section, which does an async tick.  Not important, just a
  thing I saw.

10 years agoRemove MVRA from VM frames
Andy Wingo [Fri, 15 Nov 2013 16:13:10 +0000 (17:13 +0100)]
Remove MVRA from VM frames

* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump for frame layout
  change.

* libguile/frames.c: Update some static checks.
  (scm_frame_num_locals, scm_frame_local_ref, scm_frame_local_set_x):
  Update to not skip over uninitialized frames, as that's not a thing
  any more.

* libguile/frames.h: Update to remove MVRA.  Woo!

* libguile/vm-engine.c (ALLOC_FRAME, RETURN_ONE_VALUE):
  (rtl_vm_engine): Update for 3 words per frame instead of 4.

* libguile/vm.c (vm_return_to_continuation): Likewise.

* module/language/cps/slot-allocation.scm (allocate-slots): 3 words per
  frame, not 4.

* module/system/vm/assembler.scm (*bytecode-minor-version*): Bump.  Also
  remove a couple of tc7's that aren't around any more.

10 years agoRemove MVRA accessors in libguile
Andy Wingo [Fri, 15 Nov 2013 14:39:38 +0000 (15:39 +0100)]
Remove MVRA accessors in libguile

* libguile/vm.c (scm_i_vm_capture_stack): Remove MVRA argument, in
  preparation for removing MVRA from frames.
  (scm_i_capture_current_stack): Adapt to scm_i_vm_capture_stack
  change.
  (vm_reinstate_partial_continuation): Remove references to MVRA.

* libguile/vm.h (struct scm_vm_cont): Remove mvra member.

* libguile/vm-engine.c (call): Set MVRA to 0.  Will remove later.
  (return-values): Return to RA.
  (call/cc): Remove MVRA from capture call.

* libguile/frames.c:
* libguile/frames.h (SCM_FRAME_MV_RETURN_ADDRESS)
  (SCM_FRAME_RTL_MV_RETURN_ADDRESS, scm_frame_mv_return_address): Remove
  accessors.

* libguile/control.c (reify_partial_continuation): Adapt to
  scm_i_vm_capture_stack change.

10 years agoTry to allocate arguments directly in call frames
Andy Wingo [Fri, 15 Nov 2013 13:57:05 +0000 (14:57 +0100)]
Try to allocate arguments directly in call frames

* module/language/cps/slot-allocation.scm (allocate-slots): Convert
  cont-table to a vector, for ease of access.  Run a pass before
  allocation that determines the set of variables whose slot allocation
  can and should be delayed, so that they can ideally be allocated
  directly in an argument slot.

10 years agoRewrite slot allocation pass
Andy Wingo [Fri, 15 Nov 2013 10:17:18 +0000 (11:17 +0100)]
Rewrite slot allocation pass

* module/language/cps/slot-allocation.scm ($allocation): Refactor
  internal format of allocations.  Instead of an allocation being a hash
  table of small $allocation objects, it is an $allocation object that
  contains packed vectors.
  (find-first-trailing-zero): Rework to not need a maximum.
  (lookup-maybe-slot): New interface.
  (lookup-slot): Raise an error if a var has no slot.
  (lookup-call-allocation): New helper.
  (lookup-constant-value, lookup-maybe-constant-value):
  (lookup-call-proc-slot, lookup-parallel-moves): Adapt to $allocation
  change

  (allocate-slots): Rewrite so that instead of being recursive, it
  traverses the blocks in CFA order.  Also, procedure call frames are
  now allocated with respect to the live set after using arguments (and
  killing any dead-after-use vars); this should make call frames more
  compact but it does necessitate a parallel move solution.  Therefore
  parallel moves are recorded for all calls, for arguments; also if the
  continuation is a $ktrunc, the continuation gets parallel moves for
  the results.

  This rewrite is in preparation to allocating call args directly in the
  appropriate slots, where possible.

* module/language/cps/compile-rtl.scm (compile-fun): Adapt to slot
  allocation changes, using lookup-maybe-slot where appropriate,
  performing parallel moves when calling functions, and expecting return
  moves to be associated with $ktrunc continuations.

10 years agoReplace ($var sym) with ($values (sym)).
Andy Wingo [Wed, 13 Nov 2013 18:58:55 +0000 (19:58 +0100)]
Replace ($var sym) with ($values (sym)).

* module/language/cps.scm: Remove $var.  Replaced by $values with one
  value.

* module/language/cps/arities.scm:
* module/language/cps/closure-conversion.scm:
* module/language/cps/compile-rtl.scm:
* module/language/cps/dfg.scm:
* module/language/cps/slot-allocation.scm:
* module/language/cps/verify.scm:
* module/language/tree-il/compile-cps.scm: Adapt all the world.

10 years agoAdd specialize-primcalls pass; bump objcode version.
Andy Wingo [Sun, 10 Nov 2013 18:27:19 +0000 (19:27 +0100)]
Add specialize-primcalls pass; bump objcode version.

* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.

* libguile/objcodes.c (process_dynamic_segment): Expect the minor
  version to be present and, while we are still banging on the VM,
  exactly equal to SCM_OBJCODE_MINOR_VERSION.

* libguile/vm-engine.c: Renumber ops.  Remove the general make-vector.
  Rename constant-FOO to FOO/immediate.  Remove struct-ref and
  struct-set!, replace with struct-ref/immediate and
  struct-set!/immediate.

* module/Makefile.am:
* module/language/cps/specialize-primcalls.scm: New pass, inlines FOO to
  FOO/immediate -- e.g. vector-ref to vector-ref/immediate.

* module/language/cps/arities.scm: Remove struct-set! case, now that
  there is no struct-set! opcode.

* module/language/cps/compile-rtl.scm (compile-fun): Remove dispatch to
  constant-FOO versus FOO here -- that decision is made by
  specialize-primcalls.
  (optimize): Add specialize-primcalls pass.

* module/language/cps/dfg.scm (constant-needs-allocation?): Adapt to
  name changes.

* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*primitive-constructors*): Add allocate-struct.

* module/system/vm/assembler.scm (*bytecode-major-version*):
  (*bytecode-minor-version*, link-dynamic-section): Write minor version
  into resulting image.

10 years agoEffects analysis distinguishes between struct fields
Andy Wingo [Sun, 10 Nov 2013 11:05:35 +0000 (12:05 +0100)]
Effects analysis distinguishes between struct fields

* module/language/tree-il/effects.scm (compile-time-cond):
  (define-effects): Make the effects analysis more precise,
  distinguishing between different kinds of mutable data.  On 64-bit
  systems we take advantage of the additional bits to be even more
  precise.
  (make-effects-analyzer): Inline handlers for all "accessor" primitives
  and their corresponding mutators.

* module/language/tree-il/peval.scm (peval): Reflow to remove use of the
  "accessor-primitive?" predicate.

* module/language/tree-il/primitives.scm (accessor-primitive?): Remove.

10 years agoEffects analysis sees match-error, throw-bad-structs as bailouts
Andy Wingo [Sun, 10 Nov 2013 09:13:37 +0000 (10:13 +0100)]
Effects analysis sees match-error, throw-bad-structs as bailouts

* module/language/tree-il/effects.scm (make-effects-analyzer): Allow
  module-ref calls to be treated as bailouts, if the procedure has the
  "definite-bailout?" property.  Perhaps this should be renamed.

* module/ice-9/match.upstream.scm (match-error):
* module/srfi/srfi-9.scm (throw-bad-struct): Give these procedures the
  definite-bailout? property.

10 years agoBinary search to find procedure properties.
Andy Wingo [Sat, 9 Nov 2013 15:25:12 +0000 (16:25 +0100)]
Binary search to find procedure properties.

* module/system/vm/debug.scm (find-program-properties): Use binary
  search.

10 years agoFix RTL linking of procedure properties.
Andy Wingo [Sat, 9 Nov 2013 15:23:35 +0000 (16:23 +0100)]
Fix RTL linking of procedure properties.

* module/system/vm/assembler.scm (link-procprops): Fix procedure
  property embedding in bytecode.

10 years agoBinary search to find docstrings.
Andy Wingo [Sat, 9 Nov 2013 15:15:12 +0000 (16:15 +0100)]
Binary search to find docstrings.

* module/system/vm/debug.scm (find-program-docstring): Use binary
  search.

10 years agoFinding a procedure's arity uses binary search
Andy Wingo [Sat, 9 Nov 2013 15:02:13 +0000 (16:02 +0100)]
Finding a procedure's arity uses binary search

* module/system/vm/assembler.scm (pack-arity-flags):
  (write-arity-headers): Add a flag to indicate that an arity is part of
  a case-lambda, so that we can use binary search to find arities.

* module/system/vm/debug.scm (is-in-case-lambda?)
  (arity-is-in-case-lambda?, find-first-arity): Use binary search.

10 years agoUse binary search in find-elf-symbol
Andy Wingo [Sat, 9 Nov 2013 14:51:54 +0000 (15:51 +0100)]
Use binary search in find-elf-symbol

* module/system/vm/debug.scm (binary-search): New helper.
  (find-elf-symbol): Use binary search.

10 years agoFix run-vm-tests
Andy Wingo [Fri, 8 Nov 2013 18:26:18 +0000 (19:26 +0100)]
Fix run-vm-tests

* test-suite/vm/run-vm-tests.scm: Fix for RTL.

10 years agoRemove stack programs, objcode, and the old VM.
Andy Wingo [Fri, 8 Nov 2013 17:28:24 +0000 (18:28 +0100)]
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.

10 years agoMiscellaneous fixups related to objcode removal.
Andy Wingo [Fri, 8 Nov 2013 16:42:54 +0000 (17:42 +0100)]
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.

10 years agoRemove program-sources-pre-retire case for stack programs.
Andy Wingo [Fri, 8 Nov 2013 16:41:31 +0000 (17:41 +0100)]
Remove program-sources-pre-retire case for stack programs.

* module/system/vm/program.scm (program-sources-pre-retire): Remove
  stack program case.

10 years agoRemove (language objcode)
Andy Wingo [Fri, 8 Nov 2013 16:40:46 +0000 (17:40 +0100)]
Remove (language objcode)

* module/language/objcode.scm: Remove.  Seems to have been unused.

10 years agoMove assemble-program to test cases.
Andy Wingo [Fri, 8 Nov 2013 16:36:45 +0000 (17:36 +0100)]
Move assemble-program to test cases.

* module/system/vm/assembler.scm (assemble-program): Remove.
* test-suite/tests/rtl.test (assemble-program): Move here.

10 years agoPer-instruction tracing doesn't try to disassemble stack VM code
Andy Wingo [Fri, 8 Nov 2013 16:32:41 +0000 (17:32 +0100)]
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.

10 years ago(system vm traps) support for rtl programs
Andy Wingo [Fri, 8 Nov 2013 16:31:51 +0000 (17:31 +0100)]
(system vm traps) support for rtl programs

* module/system/vm/debug.scm: Export program-debug-info-size.

* module/system/vm/traps.scm (frame-matcher): Remove stack program
  case.  Use absolute frame-instruction-procedure to match if
  match-code?.
  (program-last-ip): Use (system vm debug) interfaces.
  (program-sources-by-line): Use program-sources, as
  program-sources-pre-retire will go away soon.  Return absolute
  addresses.

10 years agoRemove objcode language.
Andy Wingo [Fri, 8 Nov 2013 15:51:44 +0000 (16:51 +0100)]
Remove objcode language.

* module/language/objcode/elf.scm:
* module/language/objcode/spec.scm: Remove objcode language.

* module/Makefile.am: Adapt.