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

Add rest-arg-length intrinsic.

* libguile/intrinsics.h:
* libguile/vm.c (rest_arg_length): New intrinsic.
  (vm_error_apply_to_non_list): Remove now-unused error proc.
* libguile/vm-engine.c (tail-apply): Use new intrinsic.
This commit is contained in:
Andy Wingo 2018-06-26 15:33:15 +02:00
parent b4553dbb02
commit 03a9b71479
3 changed files with 18 additions and 11 deletions

View file

@ -703,7 +703,7 @@ VM_NAME (scm_thread *thread, jmp_buf *registers, int resume)
/* tail-apply _:24
*
* Tail-apply the procedure in local slot 0 to the rest of the
* Tail-apply the procedure in local slot 1 to the rest of the
* arguments. This instruction is part of the implementation of
* `apply', and is not generated by the compiler.
*/
@ -717,9 +717,9 @@ VM_NAME (scm_thread *thread, jmp_buf *registers, int resume)
VM_ASSERT (nlocals >= 3, abort ());
list_idx = nlocals - 1;
list = FP_REF (list_idx);
list_len = scm_ilength (list);
VM_ASSERT (list_len >= 0, vm_error_apply_to_non_list (list));
SYNC_IP ();
list_len = scm_vm_intrinsics.rest_arg_length (list);
nlocals = nlocals - 2 + list_len;
ALLOC_FRAME (nlocals);