Mercurial > hg > graal-compiler
changeset 20918:6daa0fd4af52
Catch OutOfRegistersException in LinearScanPhase and retry if RegisterPressure was specified.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Mon, 13 Apr 2015 16:53:47 +0200 |
parents | 6aea1527de7b |
children | c6545476bc77 |
files | graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java |
diffstat | 1 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> 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; + } + } } }