diff options
author | Andy Wingo <wingo@pobox.com> | 2008-10-09 12:17:51 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2008-10-09 12:17:51 +0200 |
commit | 0570c3f197f910cc136969d6a2ed2ad0792b3501 (patch) | |
tree | 1dbb11e8f715803d6ab0eceb5e5acd34ddf6e5c9 | |
parent | 1bb6b839ecd06f3a487c792fb317f000a557f771 (diff) | |
download | guile-0570c3f197f910cc136969d6a2ed2ad0792b3501.tar.gz |
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.
-rw-r--r-- | libguile/vm-engine.c | 3 | ||||
-rw-r--r-- | libguile/vm.c | 6 | ||||
-rw-r--r-- | module/language/scheme/spec.scm | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index 4436e7bd5..a79786015 100644 --- a/libguile/vm-engine.c +++ b/libguile/vm-engine.c @@ -152,6 +152,9 @@ vm_run (SCM vm, SCM program, SCM args) vm_error_wrong_num_args: /* nargs and program are valid */ + SYNC_ALL (); + if (objects) + scm_array_handle_release (&objects_handle); scm_wrong_num_args (program); /* shouldn't get here */ goto vm_error; diff --git a/libguile/vm.c b/libguile/vm.c index 6606335ba..f649d4ec7 100644 --- a/libguile/vm.c +++ b/libguile/vm.c @@ -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); frame = scm_c_make_heap_frame (fp); 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_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) { +#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_ip = vp->ip; } diff --git a/module/language/scheme/spec.scm b/module/language/scheme/spec.scm index 2c9bc4fb6..ad40a3a2a 100644 --- a/module/language/scheme/spec.scm +++ b/module/language/scheme/spec.scm @@ -46,6 +46,6 @@ #:reader read #:read-file read-file #:translator translate - #:evaluator eval + #:evaluator (lambda (x module) (primitive-eval x)) #:printer write ) |