Fix byte code verification error in edge case

(Olof-Joachim Frahm)

From <https://github.com/Ferada/abcl/commit/4630bfd27e534bb3e7f0e596cec237c6e5200d6f>.
parent 8059619a
...@@ -6846,8 +6846,6 @@ We need more thought here. ...@@ -6846,8 +6846,6 @@ We need more thought here.
t) t)
(defun p2-throw (form target representation) (defun p2-throw (form target representation)
;; FIXME What if we're called with a non-NIL representation?
(declare (ignore representation))
(with-operand-accumulation (with-operand-accumulation
((emit-thread-operand) ((emit-thread-operand)
(compile-operand (second form) nil) ; Tag. (compile-operand (second form) nil) ; Tag.
...@@ -6857,7 +6855,11 @@ We need more thought here. ...@@ -6857,7 +6855,11 @@ We need more thought here.
(lisp-object-arg-types 2) nil)) (lisp-object-arg-types 2) nil))
;; Following code will not be reached. ;; Following code will not be reached.
(when target (when target
(emit-push-nil) (ecase representation
((:int :boolean :char)
(emit 'iconst_0))
((nil)
(emit-push-nil)))
(emit-move-from-stack target))) (emit-move-from-stack target)))
(defun p2-unwind-protect-node (block target) (defun p2-unwind-protect-node (block target)
......
...@@ -135,3 +135,16 @@ ...@@ -135,3 +135,16 @@
(deftest nth.inlined.1 (deftest nth.inlined.1
(prog1 T (compile NIL (lambda (list) (nth (lambda ()) list)))) (prog1 T (compile NIL (lambda (list) (nth (lambda ()) list))))
T) T)
;; these used to fail during byte code verification
(deftest throw.representation.1
(prog1 T (compile NIL (lambda () (eql (the fixnum (throw 'foo 42)) 2))))
T)
(deftest throw.representation.2
(prog1 T (compile NIL (lambda () (char-code (the character (throw 'foo 42))))))
T)
(deftest throw.representation.3
(prog1 T (compile NIL (lambda () (if (the boolean (throw 'foo 42)) 1 2))))
T)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment