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

Remove "resume" arg from vm engine

* libguile/vm-engine.c (vm_engine): Remove "resume" argument; scm_call_n
  will handle the differences.
* libguile/vm.c (scm_call_n): Inline handling of what to do in normal
  and resume cases.  Remove resume argument to vm_engine.
This commit is contained in:
Andy Wingo 2018-06-27 18:57:37 +02:00
parent 64d114817a
commit 9c8c4060dd
2 changed files with 15 additions and 20 deletions

View file

@ -272,7 +272,7 @@
((uintptr_t) (ptr) % alignof_type (type) == 0)
static SCM
VM_NAME (scm_thread *thread, int resume)
VM_NAME (scm_thread *thread)
{
/* Instruction pointer: A pointer to the opcode that is currently
running. */
@ -303,23 +303,7 @@ VM_NAME (scm_thread *thread, int resume)
/* Load VM registers. */
CACHE_REGISTER ();
/* Usually a call to the VM happens on application, with the boot
continuation on the next frame. Sometimes it happens after a
non-local exit however; in that case the VM state is all set up,
and we have but to jump to the next opcode. */
if (SCM_UNLIKELY (resume))
NEXT (0);
if (SCM_LIKELY (SCM_PROGRAM_P (FP_REF (0))))
ip = SCM_PROGRAM_CODE (FP_REF (0));
else
{
CALL_INTRINSIC (apply_non_program, (thread));
CACHE_REGISTER ();
}
APPLY_HOOK ();
/* Start processing! */
NEXT (0);
BEGIN_DISPATCH_SWITCH;

View file

@ -464,7 +464,7 @@ scm_i_call_with_current_continuation (SCM proc)
#undef VM_USE_HOOKS
#undef VM_NAME
typedef SCM (*scm_t_vm_engine) (scm_thread *current_thread, int resume);
typedef SCM (*scm_t_vm_engine) (scm_thread *current_thread);
static const scm_t_vm_engine vm_engines[SCM_VM_NUM_ENGINES] =
{ vm_regular_engine, vm_debug_engine };
@ -1420,9 +1420,20 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
/* Non-local return. */
vm_dispatch_abort_hook (vp);
}
else
{
if (SCM_LIKELY (SCM_PROGRAM_P (proc)))
vp->ip = SCM_PROGRAM_CODE (proc);
else
/* FIXME: Make this return an IP. */
apply_non_program (thread);
if (vp->engine == SCM_VM_DEBUG_ENGINE && vp->trace_level > 0)
vm_dispatch_apply_hook (vp);
}
thread->vm.registers = &registers;
ret = vm_engines[vp->engine](thread, resume);
ret = vm_engines[vp->engine](thread);
thread->vm.registers = prev_registers;
return ret;