1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

Better compilation of calls to raise-exception

Recognize `raise-exception` in the same way we recognize `throw`, though
it is a bit less optimized and the boot story is not as complicated.

* doc/ref/vm.texi (Non-Local Control Flow Instructions):
* libguile/jit.c (compile_unreachable):
(compile_unreachable_slow):
* libguile/vm-engine.c (VM_NAME):
* module/language/cps/compile-bytecode.scm (compile-function):
* module/system/vm/assembler.scm (emit-unreachable): Add new
"unreachable" instruction, inserted after a call to non-continuable
`raise-exception`.
* module/language/tree-il/compile-cps.scm (raise-exception):
* module/language/tree-il/primitives.scm
(*interesting-primitive-names*): Recognize raise-exception, and if it is
called with just one argument, prune that branch of the control-flow
graph.
This commit is contained in:
Andy Wingo 2023-08-28 12:03:17 +02:00
parent a52c9cf7c3
commit c2cba86785
8 changed files with 67 additions and 8 deletions

View file

@ -1,6 +1,6 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
@c Copyright (C) 2008-2011, 2013, 2015, 2018, 2019, 2020, 2022
@c Copyright (C) 2008-2011, 2013, 2015, 2018, 2019, 2020, 2022, 2023
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -1014,6 +1014,14 @@ list with @var{value}, and either @code{#f} or the list with @var{value}
as the last argument respectively.
@end deftypefn
@deftypefn Instruction {} unreachable x24:@var{_}
Abort the process. This instruction should never be reached and must
not continue. You would think this is useless but that's not the case:
it is inserted after a primcall to @code{raise-exception}, and allows
compilers to know that this branch of control flow does not rejoin the
graph.
@end deftypefn
@node Instrumentation Instructions
@subsubsection Instrumentation Instructions