diff options
author | Andy Wingo <wingo@pobox.com> | 2010-07-15 12:44:15 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-07-15 12:44:15 +0200 |
commit | 41e49280f37c350106719d8377a4dc2390caf0a7 (patch) | |
tree | eacca18c876dbc20ee42ef592d79459a67bcbf32 /libguile/vm-i-system.c | |
parent | 867961f9798d2d6ce398e2d14f8a9dc01cf20ae7 (diff) | |
download | guile-41e49280f37c350106719d8377a4dc2390caf0a7.tar.gz |
better error reporting from the vm
* libguile/vm-engine.c: Add func_name local, for error reporting.
(vm_error_apply_to_non_list): New error case.
(vm_error_wrong_type_arg): Remove this generic error case.
(vm_error_wrong_type_apply): Remove FUNC_NAME -- no sense in seeing
"vm-debug-engine" in the error report.
(vm_error_not_a_pair, vm_error_not_a_bytevector)
(vm_error_not_a_struct, vm_error_not_a_thunk): Use func_name instead
of FUNC_NAME, so we can indicate what caused the error.
* libguile/vm-i-scheme.c (VM_VALIDATE_CONS, car, cdr, set-car!)
(set-cdr!): Indicate provenance of errors.
(VM_VALIDATE_STRUCT, struct-vtable):
(VM_VALIDATE_BYTEVECTOR, BV_FIXABLE_INT_REF, BV_INT_REF)
(BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Same.
* libguile/vm-i-system.c (apply, tail-apply): Use
vm_error_apply_to_non_list.
Diffstat (limited to 'libguile/vm-i-system.c')
-rw-r--r-- | libguile/vm-i-system.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c index cedd43fd5..11f8ae0d8 100644 --- a/libguile/vm-i-system.c +++ b/libguile/vm-i-system.c @@ -1094,8 +1094,11 @@ VM_DEFINE_INSTRUCTION (62, apply, "apply", 1, -1, 1) ASSERT (nargs >= 2); len = scm_ilength (ls); - if (len < 0) - goto vm_error_wrong_type_arg; + if (SCM_UNLIKELY (len < 0)) + { + finish_args = ls; + goto vm_error_apply_to_non_list; + } PUSH_LIST (ls, SCM_NULL_OR_NIL_P); @@ -1113,8 +1116,11 @@ VM_DEFINE_INSTRUCTION (63, tail_apply, "tail-apply", 1, -1, 1) ASSERT (nargs >= 2); len = scm_ilength (ls); - if (len < 0) - goto vm_error_wrong_type_arg; + if (SCM_UNLIKELY (len < 0)) + { + finish_args = ls; + goto vm_error_apply_to_non_list; + } PUSH_LIST (ls, SCM_NULL_OR_NIL_P); |