# HG changeset patch # User Josef Eisl # Date 1428918627 -7200 # Node ID 6aea1527de7b4d96ae2134d62f4d32c77ddd3b11 # Parent 661ed7d3d10de271929b6d93fae9d13429ed25a3 Add OutOfRegistersException. diff -r 661ed7d3d10d -r 6aea1527de7b graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java Mon Apr 13 16:50:27 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java Mon Apr 13 11:50:27 2015 +0200 @@ -713,10 +713,11 @@ Debug.log("able to spill current interval. firstUsage(register): %d, usePos: %d", firstUsage, regUsePos); if (firstUsage <= interval.from() + 1) { - assert false : "cannot spill interval that is used in first instruction (possible reason: no register found) firstUsage=" + firstUsage + ", interval.from()=" + interval.from(); + String description = "cannot spill interval that is used in first instruction (possible reason: no register found) firstUsage=" + firstUsage + ", interval.from()=" + + interval.from(); // assign a reasonable register and do a bailout in product mode to avoid errors allocator.assignSpillSlot(interval); - throw new BailoutException("LinearScan: no register found"); + throw new OutOfRegistersException("LinearScan: no register found", description); } splitAndSpillInterval(interval); diff -r 661ed7d3d10d -r 6aea1527de7b graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/OutOfRegistersException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/OutOfRegistersException.java Mon Apr 13 11:50:27 2015 +0200 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.lir.alloc.lsra; + +import com.oracle.graal.api.code.*; + +public class OutOfRegistersException extends BailoutException { + + private static final long serialVersionUID = -3479786650143432195L; + + private final String description; + + public OutOfRegistersException(String msg) { + super(msg); + this.description = ""; + } + + public OutOfRegistersException(Throwable cause, String msg) { + super(cause, msg); + this.description = ""; + } + + public OutOfRegistersException(boolean permanent, String msg) { + super(permanent, msg); + this.description = ""; + } + + public OutOfRegistersException(String msg, String description) { + super(msg); + this.description = description; + } + + public OutOfRegistersException(Throwable cause, String msg, String description) { + super(cause, msg); + this.description = description; + } + + public OutOfRegistersException(boolean permanent, String msg, String description) { + super(permanent, msg); + this.description = description; + } + + public String getDescription() { + return description; + } +}