fix stack corruption on vm-save-stack; more robust with nonlocal exits
authorAndy Wingo <wingo@pobox.com>
Thu, 7 Aug 2008 17:04:25 +0000 (19:04 +0200)
committerAndy Wingo <wingo@pobox.com>
Thu, 7 Aug 2008 17:04:25 +0000 (19:04 +0200)
commit17d1b4bffd32ab3f4eae5d0dbef63fca96174e6d
treeff7c18f8ac82934fd20579b60da5d1a627e781b8
parent68a2e18a047a2c8cbdc6e000fda51af52e75de0a
fix stack corruption on vm-save-stack; more robust with nonlocal exits

* module/system/repl/command.scm: Coerce rationals to floats.

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

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

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

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

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

* src/vm_scheme.c (REL): Sync the regs before calling scm_lt_p et al,
  cause they can do a nonlocal exit.
module/system/repl/command.scm
module/system/vm/program.scm
src/vm.c
src/vm_engine.c
src/vm_engine.h
src/vm_scheme.c
src/vm_system.c