# HG changeset patch # User Josef Eisl # Date 1416252578 -3600 # Node ID 3b89c08c75f7d7ccad8108920d51b295f9552f6a # Parent 318751159681d4b2fa281a0f5c2004e2c588f31d Rename DelayedFrameMapBuilder to FrameMapBuilderImpl (again). diff -r 318751159681 -r 3b89c08c75f7 graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Mon Nov 17 20:28:29 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Mon Nov 17 20:29:38 2014 +0100 @@ -388,7 +388,7 @@ @Override public FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) { RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig; - return new DelayedFrameMapBuilder(newFrameMap(registerConfigNonNull), getCodeCache(), registerConfigNonNull); + return new FrameMapBuilderImpl(newFrameMap(registerConfigNonNull), getCodeCache(), registerConfigNonNull); } /** diff -r 318751159681 -r 3b89c08c75f7 graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java Mon Nov 17 20:28:29 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java Mon Nov 17 20:29:38 2014 +0100 @@ -159,7 +159,7 @@ @Override public FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) { RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig; - return new DelayedFrameMapBuilder(newFrameMap(registerConfigNonNull), getCodeCache(), registerConfigNonNull); + return new FrameMapBuilderImpl(newFrameMap(registerConfigNonNull), getCodeCache(), registerConfigNonNull); } @Override diff -r 318751159681 -r 3b89c08c75f7 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Mon Nov 17 20:28:29 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Mon Nov 17 20:29:38 2014 +0100 @@ -75,7 +75,7 @@ @Override public FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) { RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig; - return new DelayedFrameMapBuilder(newFrameMap(registerConfigNonNull), getCodeCache(), registerConfigNonNull); + return new FrameMapBuilderImpl(newFrameMap(registerConfigNonNull), getCodeCache(), registerConfigNonNull); } @Override diff -r 318751159681 -r 3b89c08c75f7 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMapBuilder.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMapBuilder.java Mon Nov 17 20:28:29 2014 +0100 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMapBuilder.java Mon Nov 17 20:29:38 2014 +0100 @@ -25,7 +25,7 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.lir.framemap.*; -public class AMD64FrameMapBuilder extends DelayedFrameMapBuilder { +public class AMD64FrameMapBuilder extends FrameMapBuilderImpl { public AMD64FrameMapBuilder(FrameMap frameMap, CodeCacheProvider codeCache, RegisterConfig registerConfig) { super(frameMap, codeCache, registerConfig); diff -r 318751159681 -r 3b89c08c75f7 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/DelayedFrameMapBuilder.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/DelayedFrameMapBuilder.java Mon Nov 17 20:28:29 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* - * 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.*; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.common.*; -import com.oracle.graal.lir.gen.*; - -/** - * A FrameMapBuilder that records allocation. - */ -public class DelayedFrameMapBuilder implements FrameMapBuilder { - - private final RegisterConfig registerConfig; - private final CodeCacheProvider codeCache; - protected final FrameMap frameMap; - private final List stackSlots; - private final List calls; - - public DelayedFrameMapBuilder(FrameMap frameMap, CodeCacheProvider codeCache, RegisterConfig registerConfig) { - assert registerConfig != null : "No register config!"; - this.registerConfig = registerConfig == null ? codeCache.getRegisterConfig() : registerConfig; - this.codeCache = codeCache; - this.frameMap = frameMap; - this.stackSlots = new ArrayList<>(); - this.calls = new ArrayList<>(); - this.mappables = new ArrayList<>(); - } - - private final List mappables; - - public VirtualStackSlot allocateSpillSlot(LIRKind kind) { - SimpleVirtualStackSlot slot = new SimpleVirtualStackSlot(kind); - stackSlots.add(slot); - return slot; - } - - public VirtualStackSlot allocateStackSlots(int slots, BitSet objects, List outObjectStackSlots) { - if (slots == 0) { - return null; - } - if (outObjectStackSlots != null) { - throw GraalInternalError.unimplemented(); - } - VirtualStackSlotRange slot = new VirtualStackSlotRange(slots, objects); - stackSlots.add(slot); - return slot; - } - - public RegisterConfig getRegisterConfig() { - return registerConfig; - } - - public CodeCacheProvider getCodeCache() { - return codeCache; - } - - public void callsMethod(CallingConvention cc) { - calls.add(cc); - } - - public FrameMap buildFrameMap(LIRGenerationResult res) { - FrameMappingTool mapper = new SimpleStackSlotAllocator().allocateStackSlots(this); - for (CallingConvention cc : calls) { - frameMap.callsMethod(cc); - } - // rewrite - mappables.forEach(m -> m.map(mapper)); - - frameMap.finish(); - return frameMap; - } - - public void requireMapping(FrameMappable mappable) { - this.mappables.add(mappable); - } - - List getStackSlots() { - return stackSlots; - } - -} diff -r 318751159681 -r 3b89c08c75f7 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderImpl.java Mon Nov 17 20:29:38 2014 +0100 @@ -0,0 +1,105 @@ +/* + * 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.*; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.compiler.common.*; +import com.oracle.graal.lir.gen.*; + +/** + * A FrameMapBuilder that records allocation. + */ +public class FrameMapBuilderImpl implements FrameMapBuilder { + + private final RegisterConfig registerConfig; + private final CodeCacheProvider codeCache; + protected final FrameMap frameMap; + private final List stackSlots; + private final List calls; + + public FrameMapBuilderImpl(FrameMap frameMap, CodeCacheProvider codeCache, RegisterConfig registerConfig) { + assert registerConfig != null : "No register config!"; + this.registerConfig = registerConfig == null ? codeCache.getRegisterConfig() : registerConfig; + this.codeCache = codeCache; + this.frameMap = frameMap; + this.stackSlots = new ArrayList<>(); + this.calls = new ArrayList<>(); + this.mappables = new ArrayList<>(); + } + + private final List mappables; + + public VirtualStackSlot allocateSpillSlot(LIRKind kind) { + SimpleVirtualStackSlot slot = new SimpleVirtualStackSlot(kind); + stackSlots.add(slot); + return slot; + } + + public VirtualStackSlot allocateStackSlots(int slots, BitSet objects, List outObjectStackSlots) { + if (slots == 0) { + return null; + } + if (outObjectStackSlots != null) { + throw GraalInternalError.unimplemented(); + } + VirtualStackSlotRange slot = new VirtualStackSlotRange(slots, objects); + stackSlots.add(slot); + return slot; + } + + public RegisterConfig getRegisterConfig() { + return registerConfig; + } + + public CodeCacheProvider getCodeCache() { + return codeCache; + } + + public void callsMethod(CallingConvention cc) { + calls.add(cc); + } + + public FrameMap buildFrameMap(LIRGenerationResult res) { + FrameMappingTool mapper = new SimpleStackSlotAllocator().allocateStackSlots(this); + for (CallingConvention cc : calls) { + frameMap.callsMethod(cc); + } + // rewrite + mappables.forEach(m -> m.map(mapper)); + + frameMap.finish(); + return frameMap; + } + + public void requireMapping(FrameMappable mappable) { + this.mappables.add(mappable); + } + + List getStackSlots() { + return stackSlots; + } + +} diff -r 318751159681 -r 3b89c08c75f7 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 Mon Nov 17 20:28:29 2014 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/SimpleStackSlotAllocator.java Mon Nov 17 20:29:38 2014 +0100 @@ -29,7 +29,7 @@ public class SimpleStackSlotAllocator implements StackSlotAllocator { - public FrameMappingTool allocateStackSlots(DelayedFrameMapBuilder builder) { + public FrameMappingTool allocateStackSlots(FrameMapBuilderImpl builder) { HashMap mapping = new HashMap<>(); for (VirtualStackSlot virtualSlot : builder.getStackSlots()) { final StackSlot slot; @@ -45,11 +45,11 @@ return mapping::get; } - protected StackSlot mapSimpleVirtualStackSlot(DelayedFrameMapBuilder builder, SimpleVirtualStackSlot virtualStackSlot) { + protected StackSlot mapSimpleVirtualStackSlot(FrameMapBuilderImpl builder, SimpleVirtualStackSlot virtualStackSlot) { return builder.frameMap.allocateSpillSlot(virtualStackSlot.getLIRKind()); } - protected StackSlot mapVirtualStackSlotRange(DelayedFrameMapBuilder builder, VirtualStackSlotRange virtualStackSlot) { + protected StackSlot mapVirtualStackSlotRange(FrameMapBuilderImpl builder, VirtualStackSlotRange virtualStackSlot) { return builder.frameMap.allocateStackSlots(virtualStackSlot.getSlots(), virtualStackSlot.getObjects()); } } diff -r 318751159681 -r 3b89c08c75f7 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 Mon Nov 17 20:28:29 2014 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/StackSlotAllocator.java Mon Nov 17 20:29:38 2014 +0100 @@ -29,5 +29,5 @@ * stack slots into {@link StackSlot real} stack slots. */ public interface StackSlotAllocator { - FrameMappingTool allocateStackSlots(DelayedFrameMapBuilder builder); + FrameMappingTool allocateStackSlots(FrameMapBuilderImpl builder); }