summaryrefslogtreecommitdiff
path: root/module/system
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/system
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/system')
-rw-r--r--module/system/vm/assembler.scm1
-rw-r--r--module/system/vm/disassembler.scm4
2 files changed, 3 insertions, 2 deletions
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index 7e0763e53..ef67c1846 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -109,6 +109,7 @@
emit-throw
(emit-throw/value* . emit-throw/value)
(emit-throw/value+data* . emit-throw/value+data)
+ emit-unreachable
emit-pair?
emit-struct?
diff --git a/module/system/vm/disassembler.scm b/module/system/vm/disassembler.scm
index ac1d21639..0c69c2b57 100644
--- a/module/system/vm/disassembler.scm
+++ b/module/system/vm/disassembler.scm
@@ -1,6 +1,6 @@
;;; Guile bytecode disassembler
-;;; Copyright (C) 2001, 2009-2010, 2012-2015, 2017-2020, 2022 Free Software Foundation, Inc.
+;;; Copyright (C) 2001, 2009-2010, 2012-2015, 2017-2020, 2022, 2023 Free Software Foundation, Inc.
;;;
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public
@@ -583,7 +583,7 @@ address of that offset."
(define (instruction-has-fallthrough? code pos)
(define non-fallthrough-set
(static-opcode-set halt
- throw throw/value throw/value+data
+ throw throw/value throw/value+data unreachable
tail-call tail-call-label
return-values
subr-call foreign-call continuation-call