1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-20 10:40:19 +02:00

sundries: side effects in interpreted repl, wrong-num-args in vm, self-checks

* libguile/vm-engine.c (vm_error_wrong_num_args): Sync the registers
  before calling scm_wrong_num_args. (The other cases are handled more
  uniformly.)

* libguile/vm.c (vm_heapify_frames_1): Add a FIXME: I don't think we
  should be modifying the stack.
  (scm_vm_save_stack): If stack nulling is enabled, verify the stack here
  before reifying it.

* module/language/scheme/spec.scm (scheme): Use primitive-eval here
  instead of eval, because at the repl we do want to allow evaluations to
  have side effects like setting the current module.
This commit is contained in:
Andy Wingo 2008-10-09 12:17:51 +02:00
parent 1bb6b839ec
commit 0570c3f197
3 changed files with 10 additions and 1 deletions

View file

@ -152,6 +152,9 @@ vm_run (SCM vm, SCM program, SCM args)
vm_error_wrong_num_args: vm_error_wrong_num_args:
/* nargs and program are valid */ /* nargs and program are valid */
SYNC_ALL ();
if (objects)
scm_array_handle_release (&objects_handle);
scm_wrong_num_args (program); scm_wrong_num_args (program);
/* shouldn't get here */ /* shouldn't get here */
goto vm_error; goto vm_error;

View file

@ -293,6 +293,7 @@ vm_heapify_frames_1 (struct scm_vm *vp, SCM *fp, SCM *sp, SCM **destp)
link = vm_heapify_frames_1 (vp, dl, dest - 1, &dest); link = vm_heapify_frames_1 (vp, dl, dest - 1, &dest);
frame = scm_c_make_heap_frame (fp); frame = scm_c_make_heap_frame (fp);
fp = SCM_HEAP_FRAME_POINTER (frame); fp = SCM_HEAP_FRAME_POINTER (frame);
/* FIXME: I don't think we should be storing heap links on the stack. */
SCM_FRAME_HEAP_LINK (fp) = link; SCM_FRAME_HEAP_LINK (fp) = link;
SCM_FRAME_SET_DYNAMIC_LINK (fp, SCM_HEAP_FRAME_POINTER (link)); SCM_FRAME_SET_DYNAMIC_LINK (fp, SCM_HEAP_FRAME_POINTER (link));
} }
@ -670,6 +671,11 @@ SCM_DEFINE (scm_vm_save_stack, "vm-save-stack", 1, 0, 0,
if (vp->fp) if (vp->fp)
{ {
#ifdef VM_ENABLE_STACK_NULLING
if (vp->sp >= vp->stack_base)
if (!vp->sp[0] || vp->sp[1])
abort ();
#endif
vp->last_frame = vm_heapify_frames_1 (vp, vp->fp, vp->sp, &dest); vp->last_frame = vm_heapify_frames_1 (vp, vp->fp, vp->sp, &dest);
vp->last_ip = vp->ip; vp->last_ip = vp->ip;
} }

View file

@ -46,6 +46,6 @@
#:reader read #:reader read
#:read-file read-file #:read-file read-file
#:translator translate #:translator translate
#:evaluator eval #:evaluator (lambda (x module) (primitive-eval x))
#:printer write #:printer write
) )