summaryrefslogtreecommitdiff
path: root/module/language/cps/compile-bytecode.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2023-08-28 12:03:17 +0200
committerAndy Wingo <wingo@pobox.com>2023-08-28 12:11:19 +0200
commitc2cba86785a34351788f52ea4fccf9f10f3a1dee (patch)
tree863e975d9d2728e52d242de954b96a5d71c4a668 /module/language/cps/compile-bytecode.scm
parenta52c9cf7c3eefe05da23cd3233e1f9119eb14862 (diff)
downloadguile-c2cba86785a34351788f52ea4fccf9f10f3a1dee.tar.gz
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.
Diffstat (limited to 'module/language/cps/compile-bytecode.scm')
-rw-r--r--module/language/cps/compile-bytecode.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/module/language/cps/compile-bytecode.scm b/module/language/cps/compile-bytecode.scm
index d6d1737b3..ad5e0024d 100644
--- a/module/language/cps/compile-bytecode.scm
+++ b/module/language/cps/compile-bytecode.scm
@@ -417,7 +417,9 @@
(#('throw/value param (val))
(emit-throw/value asm (from-sp (slot val)) param))
(#('throw/value+data param (val))
- (emit-throw/value+data asm (from-sp (slot val)) param))))
+ (emit-throw/value+data asm (from-sp (slot val)) param))
+ (#('unreachable #f ())
+ (emit-unreachable asm))))
(define (compile-prompt label k kh escape? tag)
(let ((receive-args (gensym "handler"))