# HG changeset patch # User Josef Eisl # Date 1454497635 -3600 # Node ID 6a01ba690eb28b3a375058be17124b7edecf5ee2 # Parent 4d74344a78a539c7655982072689ae4ff7f5c125 GraalCompiler.emitLIR: allow multiple restarts. diff -r 4d74344a78a5 -r 6a01ba690eb2 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Feb 03 12:18:19 2016 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Feb 03 12:07:15 2016 +0100 @@ -32,6 +32,7 @@ import jdk.vm.ci.code.TargetDescription; import jdk.vm.ci.code.site.ConstantReference; import jdk.vm.ci.code.site.DataPatch; +import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.Assumptions; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; @@ -236,18 +237,22 @@ @SuppressWarnings("try") public static LIRGenerationResult emitLIR(Backend backend, StructuredGraph graph, Object stub, RegisterConfig registerConfig, LIRSuites lirSuites) { - try { - return emitLIR0(backend, graph, stub, registerConfig, lirSuites); - } catch (BailoutAndRestartBackendException e) { - if (BailoutAndRestartBackendException.Options.LIRUnlockBackendRestart.getValue() && e.shouldRestart()) { - try (OverrideScope scope = e.getOverrideScope()) { - LIRSuites lirSuites0 = e.updateLIRSuites(lirSuites); + OverrideScope overrideScope = null; + LIRSuites lirSuites0 = lirSuites; + while (true) { + try (OverrideScope scope = overrideScope) { + return emitLIR0(backend, graph, stub, registerConfig, lirSuites0); + } catch (BailoutAndRestartBackendException e) { + if (BailoutAndRestartBackendException.Options.LIRUnlockBackendRestart.getValue() && e.shouldRestart()) { + overrideScope = e.getOverrideScope(); + lirSuites0 = e.updateLIRSuites(lirSuites); if (lirSuites0 != null) { - return emitLIR0(backend, graph, stub, registerConfig, lirSuites0); + continue; } } + /* If the restart fails we convert the exception into a "hard" failure */ + throw new JVMCIError(e); } - throw e; } }