@@ -0,0 +1,3642 @@
+/*%0A * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.%0A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.%0A *%0A * This code is free software; you can redistribute it and/or modify it%0A * under the terms of the GNU General Public License version 2 only, as%0A * published by the Free Software Foundation.%0A *%0A * This code is distributed in the hope that it will be useful, but WITHOUT%0A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or%0A * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License%0A * version 2 for more details (a copy is included in the LICENSE file that%0A * accompanied this code).%0A *%0A * You should have received a copy of the GNU General Public License version%0A * 2 along with this work; if not, write to the Free Software Foundation,%0A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.%0A *%0A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA%0A * or visit www.oracle.com if you need additional information or have any%0A * questions.%0A */%0Apackage com.oracle.graal.truffle.test;%0A%0Aimport org.junit.*;%0A%0Aimport com.oracle.graal.truffle.test.nodes.*;%0Aimport com.oracle.truffle.api.frame.*;%0Aimport com.oracle.truffle.api.nodes.*;%0A%0A@Ignore(%22Currently ignored due to problems with code coverage tools.%22)%0Apublic class ControlFlowExceptionPartialEvaluationTest extends PartialEvaluationTest %7B%0A%0A    public static Object constant42() %7B%0A        return 42;%0A    %7D%0A%0A    @Test%0A    public void catchControlFlowException() %7B%0A        FrameDescriptor fd = new FrameDescriptor();%0A        AbstractTestNode result = new CatchControlFlowExceptionTestNode(new ThrowControlFlowExceptionTestNode());%0A        assertPartialEvalEquals(%22constant42%22, new RootTestNode(fd, %22catchControlFlowException%22, result));%0A    %7D%0A%0A    @Test%0A    public void catchSlowPathAndControlFlowException() %7B%0A        FrameDescriptor fd = new FrameDescriptor();%0A        AbstractTestNode result = new CatchSlowPathAndControlFlowExceptionTestNode(new ThrowControlFlowExceptionTestNode());%0A        assertPartialEvalEquals(%22constant42%22, new RootTestNode(fd, %22catchSlowPathAndControlFlowException%22, result));%0A    %7D%0A%0A    public static class ThrowControlFlowExceptionTestNode extends AbstractTestNode %7B%0A%0A        @Override%0A        public int execute(VirtualFrame frame) %7B%0A            throw new ControlFlowException();%0A        %7D%0A    %7D%0A%0A    public static class CatchControlFlowExceptionTestNode extends AbstractTestNode %7B%0A%0A        @Child private AbstractTestNode child;%0A%0A        public CatchControlFlowExceptionTestNode(AbstractTestNode child) %7B%0A            this.child = adoptChild(child);%0A        %7D%0A%0A        @Override%0A        public int execute(VirtualFrame frame) %7B%0A            try %7B%0A                return child.execute(frame);%0A            %7D catch (ControlFlowException e) %7B%0A                return 42;%0A            %7D%0A        %7D%0A    %7D%0A%0A    public static class CatchSlowPathAndControlFlowExceptionTestNode extends AbstractTestNode %7B%0A%0A        @Child private AbstractTestNode child;%0A%0A        public CatchSlowPathAndControlFlowExceptionTestNode(AbstractTestNode child) %7B%0A            this.child = adoptChild(child);%0A        %7D%0A%0A        @Override%0A        public int execute(VirtualFrame frame) %7B%0A            try %7B%0A                return executeChild(frame);%0A            %7D catch (SlowPathException spe) %7B%0A                return -1;%0A            %7D catch (ControlFlowException e) %7B%0A                return 42;%0A            %7D%0A        %7D%0A%0A        @SuppressWarnings(%22unused%22)%0A        private int executeChild(VirtualFrame frame) throws SlowPathException %7B%0A            return child.execute(frame);%0A        %7D%0A    %7D%0A%7D%0A

add partial evaluation test for a ControlFlowException catch block that follows a SlowPathException catch block