# HG changeset patch # User Josef Eisl # Date 1417644653 -3600 # Node ID caa39e9bf2b0dfeaf9bc3adcc3a536943a220bb8 # Parent 0be248fb42b26a58a284f10425521c04e8c0feda Introduce FrameMapBuilderTool. diff -r 0be248fb42b2 -r caa39e9bf2b0 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderImpl.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderImpl.java Thu Dec 04 11:15:04 2014 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderImpl.java Wed Dec 03 23:10:53 2014 +0100 @@ -32,7 +32,7 @@ /** * A FrameMapBuilder that records allocation. */ -public class FrameMapBuilderImpl implements FrameMapBuilder { +public class FrameMapBuilderImpl implements FrameMapBuilderTool { private final RegisterConfig registerConfig; private final CodeCacheProvider codeCache; @@ -81,10 +81,6 @@ return frameMap; } - /** - * Returns the number of {@link VirtualStackSlot}s created by this {@link FrameMapBuilder}. Can - * be used as an upper bound for an array indexed by {@link VirtualStackSlot#getId()}. - */ public int getNumberOfStackSlots() { return numStackSlots; } @@ -102,7 +98,7 @@ return frameMap; } - List getStackSlots() { + public List getStackSlots() { return stackSlots; } diff -r 0be248fb42b2 -r caa39e9bf2b0 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderTool.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderTool.java Wed Dec 03 23:10:53 2014 +0100 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2014, 2014, 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.framemap; + +import java.util.*; + +import com.oracle.graal.api.code.*; + +/** + * A {@link FrameMapBuilder} that allows access to the underlying {@link FrameMap}. + */ +public interface FrameMapBuilderTool extends FrameMapBuilder { + + /** + * Returns the number of {@link VirtualStackSlot}s created by this {@link FrameMapBuilder}. Can + * be used as an upper bound for an array indexed by {@link VirtualStackSlot#getId()}. + */ + int getNumberOfStackSlots(); + + List getStackSlots(); + + FrameMap getFrameMap(); + +} diff -r 0be248fb42b2 -r caa39e9bf2b0 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/SimpleStackSlotAllocator.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/SimpleStackSlotAllocator.java Thu Dec 04 11:15:04 2014 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/SimpleStackSlotAllocator.java Wed Dec 03 23:10:53 2014 +0100 @@ -34,7 +34,7 @@ public class SimpleStackSlotAllocator implements StackSlotAllocator { - public void allocateStackSlots(FrameMapBuilderImpl builder, LIRGenerationResult res) { + public void allocateStackSlots(FrameMapBuilderTool builder, LIRGenerationResult res) { StackSlot[] mapping = new StackSlot[builder.getNumberOfStackSlots()]; for (VirtualStackSlot virtualSlot : builder.getStackSlots()) { final StackSlot slot; @@ -76,11 +76,11 @@ } } - protected StackSlot mapSimpleVirtualStackSlot(FrameMapBuilderImpl builder, SimpleVirtualStackSlot virtualStackSlot) { + protected StackSlot mapSimpleVirtualStackSlot(FrameMapBuilderTool builder, SimpleVirtualStackSlot virtualStackSlot) { return builder.getFrameMap().allocateSpillSlot(virtualStackSlot.getLIRKind()); } - protected StackSlot mapVirtualStackSlotRange(FrameMapBuilderImpl builder, VirtualStackSlotRange virtualStackSlot) { + protected StackSlot mapVirtualStackSlotRange(FrameMapBuilderTool builder, VirtualStackSlotRange virtualStackSlot) { return builder.getFrameMap().allocateStackSlots(virtualStackSlot.getSlots(), virtualStackSlot.getObjects()); } } diff -r 0be248fb42b2 -r caa39e9bf2b0 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/StackSlotAllocator.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/StackSlotAllocator.java Thu Dec 04 11:15:04 2014 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/StackSlotAllocator.java Wed Dec 03 23:10:53 2014 +0100 @@ -31,5 +31,5 @@ * {@link VirtualStackSlot} in the {@link LIRGenerationResult#getLIR() LIR} to {@link StackSlot}. */ public interface StackSlotAllocator { - void allocateStackSlots(FrameMapBuilderImpl builder, LIRGenerationResult res); + void allocateStackSlots(FrameMapBuilderTool builder, LIRGenerationResult res); }