1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-18 01:30:27 +02:00

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.
This commit is contained in:
Andy Wingo 2010-07-15 12:44:15 +02:00
parent 867961f979
commit 41e49280f3
3 changed files with 37 additions and 27 deletions

View file

@ -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);