# HG changeset patch # User Josef Eisl # Date 1428936827 -7200 # Node ID 6daa0fd4af52cc86ae568415a425191127a54bf8 # Parent 6aea1527de7b4d96ae2134d62f4d32c77ddd3b11 Catch OutOfRegistersException in LinearScanPhase and retry if RegisterPressure was specified. diff -r 6aea1527de7b -r 6daa0fd4af52 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java Mon Apr 13 11:50:27 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java Mon Apr 13 16:53:47 2015 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.lir.alloc.lsra; +import static com.oracle.graal.compiler.common.GraalOptions.*; + import java.util.*; import com.oracle.graal.api.code.*; @@ -30,12 +32,25 @@ import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; +import com.oracle.graal.options.*; +import com.oracle.graal.options.OptionValue.OverrideScope; public final class LinearScanPhase extends AllocationPhase { @Override protected > void run(TargetDescription target, LIRGenerationResult lirGenRes, List codeEmittingOrder, List linearScanOrder, SpillMoveFactory spillMoveFactory) { - new LinearScan(target, lirGenRes, spillMoveFactory, new RegisterAllocationConfig(lirGenRes.getFrameMapBuilder().getRegisterConfig())).allocate(); + try { + new LinearScan(target, lirGenRes, spillMoveFactory, new RegisterAllocationConfig(lirGenRes.getFrameMapBuilder().getRegisterConfig())).allocate(); + } catch (OutOfRegistersException e) { + if (RegisterPressure.getValue() != null) { + try (OverrideScope s = OptionValue.override(RegisterPressure, null)) { + // retry with default register set + new LinearScan(target, lirGenRes, spillMoveFactory, new RegisterAllocationConfig(lirGenRes.getFrameMapBuilder().getRegisterConfig())).allocate(); + } + } else { + throw e; + } + } } }