1 /* 2 * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.graalvm.compiler.nodes; 24 25 import org.graalvm.compiler.nodes.spi.NodeWithState; 26 27 /** 28 * Interface implemented by nodes which may need {@linkplain FrameState deoptimization information}. 29 */ 30 public interface DeoptimizingNode extends NodeWithState { 31 32 /** 33 * Determines if this node needs deoptimization information. 34 */ 35 boolean canDeoptimize(); 36 37 /** 38 * Interface for nodes that need a {@link FrameState} for deoptimizing to a point before their 39 * execution. 40 */ 41 public interface DeoptBefore extends DeoptimizingNode { 42 43 /** 44 * Sets the {@link FrameState} describing the program state before the execution of this 45 * node. 46 */ 47 void setStateBefore(FrameState state); 48 49 FrameState stateBefore(); 50 } 51 52 /** 53 * Interface for nodes that need a {@link FrameState} for deoptimizing to a point after their 54 * execution. 55 */ 56 public interface DeoptAfter extends DeoptimizingNode, StateSplit { 57 } 58 59 /** 60 * Interface for nodes that need a special {@link FrameState} for deoptimizing during their 61 * execution (e.g. {@link Invoke}). 62 */ 63 public interface DeoptDuring extends DeoptimizingNode, StateSplit { 64 65 FrameState stateDuring(); 66 67 /** 68 * Sets the {@link FrameState} describing the program state during the execution of this 69 * node. 70 */ 71 void setStateDuring(FrameState state); 72 73 /** 74 * Compute the {@link FrameState} describing the program state during the execution of this 75 * node from an input {@link FrameState} describing the program state after finishing the 76 * execution of this node. 77 */ 78 void computeStateDuring(FrameState stateAfter); 79 } 80 }