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.lir; 24 25 import org.graalvm.compiler.common.PermanentBailoutException; 26 import org.graalvm.compiler.lir.phases.LIRSuites; 27 import org.graalvm.compiler.options.Option; 28 import org.graalvm.compiler.options.OptionType; 29 import org.graalvm.compiler.options.OptionValue; 30 import org.graalvm.compiler.options.OptionValue.OverrideScope; 31 import org.graalvm.compiler.options.StableOptionValue; 32 33 /** 34 * Restarts the {@link LIR low-level} compilation with a modified configuration. 35 * {@link BailoutAndRestartBackendException.Options#LIRUnlockBackendRestart LIRUnlockBackendRestart} 36 * needs to be enabled. Use only for debugging purposes only. 37 */ 38 public abstract class BailoutAndRestartBackendException extends PermanentBailoutException { 39 40 public static class Options { 41 // @formatter:off 42 @Option(help = "Unlock backend restart feature.", type = OptionType.Debug) 43 public static final StableOptionValue<Boolean> LIRUnlockBackendRestart = new StableOptionValue<>(false); 44 // @formatter:on 45 } 46 47 private static final long serialVersionUID = 792969002851591180L; 48 49 public BailoutAndRestartBackendException(String msg) { 50 super(msg); 51 } 52 53 public BailoutAndRestartBackendException(Throwable cause, String msg) { 54 super(cause, msg); 55 } 56 57 /** Returns {@code true} if the low-level compilation should be restarted. */ 58 public abstract boolean shouldRestart(); 59 60 /** 61 * Returns an {@link OverrideScope} to change {@link OptionValue OptionValues} or {@code null} 62 * if no changes are required. 63 */ 64 public abstract OverrideScope getOverrideScope(); 65 66 /** 67 * Updates the {@link LIRSuites} used by the low-level compiler. Note that {@link LIRSuites} are 68 * usually shared, so a modified input parameter will affect other compilations. In case only 69 * the current compilation should be altered, create a copy using {@link LIRSuites#copy()}. 70 */ 71 public abstract LIRSuites updateLIRSuites(LIRSuites lirSuites); 72 73 } | 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.lir; 24 25 import org.graalvm.compiler.core.common.PermanentBailoutException; 26 import org.graalvm.compiler.options.Option; 27 import org.graalvm.compiler.options.OptionKey; 28 import org.graalvm.compiler.options.OptionType; 29 30 /** 31 * Restarts the {@link LIR low-level} compilation with a modified configuration. 32 * {@link BailoutAndRestartBackendException.Options#LIRUnlockBackendRestart LIRUnlockBackendRestart} 33 * needs to be enabled. Use only for debugging purposes only. 34 */ 35 public abstract class BailoutAndRestartBackendException extends PermanentBailoutException { 36 37 public static class Options { 38 // @formatter:off 39 @Option(help = "Unlock backend restart feature.", type = OptionType.Debug) 40 public static final OptionKey<Boolean> LIRUnlockBackendRestart = new OptionKey<>(false); 41 // @formatter:on 42 } 43 44 private static final long serialVersionUID = 792969002851591180L; 45 46 public BailoutAndRestartBackendException(String msg) { 47 super(msg); 48 } 49 50 public BailoutAndRestartBackendException(Throwable cause, String msg) { 51 super(cause, msg); 52 } 53 } |