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

optimize dynamic-wind when we know winders are thunks

* libguile/vm-i-system.c (wind):
* module/language/tree-il/compile-glil.scm (flatten-lambda-case):
  Instead of making `wind' call `scm_thunk_p' on the winder and unwinder
  at runtime, make it the responsibility of the compiler to emit code to
  call thunk? and error, but only if the compiler cannot prove them to
  be thunks.

* libguile/vm-engine.c (vm_engine): Remove a now-unused error block.
This commit is contained in:
Andy Wingo 2012-03-03 21:46:38 +01:00
parent deaae8e9d7
commit d5dbe0c1d5
3 changed files with 28 additions and 18 deletions

View file

@ -1616,17 +1616,9 @@ VM_DEFINE_INSTRUCTION (86, wind, "wind", 0, 2, 0)
SYNC_REGISTER ();
/* Push wind and unwind procedures onto the dynamic stack. Note that neither
are actually called; the compiler should emit calls to wind and unwind for
the normal dynamic-wind control flow. */
if (SCM_UNLIKELY (scm_is_false (scm_thunk_p (wind))))
{
finish_args = wind;
goto vm_error_not_a_thunk;
}
if (SCM_UNLIKELY (scm_is_false (scm_thunk_p (unwind))))
{
finish_args = unwind;
goto vm_error_not_a_thunk;
}
the normal dynamic-wind control flow. Also note that the compiler
should have inserted checks that they wind and unwind procs are
thunks, if it could not prove that to be the case. */
scm_dynstack_push_dynwind (&current_thread->dynstack, wind, unwind);
NEXT;
}