# HG changeset patch # User Josef Eisl # Date 1395150519 -3600 # Node ID eab93bf521d7a028801d9b7f09a93f64ad029bfc # Parent 73774616a6b31961a538f35734521c2d883c488b Introduce LIRGenResLowerable. diff -r 73774616a6b3 -r eab93bf521d7 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Tue Mar 18 13:49:11 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Tue Mar 18 14:48:39 2014 +0100 @@ -500,6 +500,8 @@ } if (node instanceof LIRGenLowerable) { ((LIRGenLowerable) node).generate(this); + } else if (node instanceof LIRGenResLowerable) { + ((LIRGenResLowerable) node).generate(this, res); } else if (node instanceof LIRLowerable) { ((LIRLowerable) node).generate(this); } else if (node instanceof ArithmeticLIRLowerable) { @@ -1004,9 +1006,4 @@ public abstract void emitByteSwap(Variable result, Value operand); public abstract void emitArrayEquals(Kind kind, Variable result, Value array1, Value array2, Value length); - - @Deprecated - public FrameMap getFrameMap() { - return res.getFrameMap(); - } } diff -r 73774616a6b3 -r eab93bf521d7 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/LIRGenResLowerable.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/LIRGenResLowerable.java Tue Mar 18 14:48:39 2014 +0100 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2011, 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.compiler.target; + +import com.oracle.graal.compiler.gen.*; +import com.oracle.graal.lir.*; +import com.oracle.graal.nodes.spi.*; + +/** + * An alternative to {@link LIRLowerable} for lowering that is tightly coupled to + * {@link LIRGenerationResult} and {@link LIRInstruction}. + */ +public interface LIRGenResLowerable { + + void generate(LIRGenerator generator, LIRGenerationResult genRes); +} diff -r 73774616a6b3 -r eab93bf521d7 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java Tue Mar 18 13:49:11 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java Tue Mar 18 14:48:39 2014 +0100 @@ -36,7 +36,7 @@ * Reserves a block of memory in the stack frame of a method. The block is reserved in the frame for * the entire execution of the associated method. */ -public final class AllocaNode extends FixedWithNextNode implements LIRGenLowerable { +public final class AllocaNode extends FixedWithNextNode implements LIRGenResLowerable { /** * The number of slots in block. @@ -57,8 +57,8 @@ } @Override - public void generate(LIRGenerator gen) { - StackSlot array = gen.getFrameMap().allocateStackSlots(slots, objects, null); + public void generate(LIRGenerator gen, LIRGenerationResult res) { + StackSlot array = res.getFrameMap().allocateStackSlots(slots, objects, null); Value result = gen.emitAddress(array); gen.setResult(this, result); } diff -r 73774616a6b3 -r eab93bf521d7 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java Tue Mar 18 13:49:11 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java Tue Mar 18 14:48:39 2014 +0100 @@ -37,7 +37,7 @@ * Intrinsic for allocating an on-stack array of integers to hold the dimensions of a multianewarray * instruction. */ -public final class DimensionsNode extends FixedWithNextNode implements LIRGenLowerable { +public final class DimensionsNode extends FixedWithNextNode implements LIRGenResLowerable { private final int rank; @@ -47,11 +47,11 @@ } @Override - public void generate(LIRGenerator gen) { + public void generate(LIRGenerator gen, LIRGenerationResult res) { int size = rank * 4; int wordSize = gen.target().wordSize; int slots = roundUp(size, wordSize) / wordSize; - StackSlot array = gen.getFrameMap().allocateStackSlots(slots, new BitSet(0), null); + StackSlot array = res.getFrameMap().allocateStackSlots(slots, new BitSet(0), null); Value result = gen.emitAddress(array); gen.setResult(this, result); } diff -r 73774616a6b3 -r eab93bf521d7 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java Tue Mar 18 13:49:11 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java Tue Mar 18 14:48:39 2014 +0100 @@ -34,16 +34,16 @@ /** * Node that is used to maintain a stack based counter of how many locks are currently held. */ -public final class MonitorCounterNode extends FloatingNode implements LIRGenLowerable { +public final class MonitorCounterNode extends FloatingNode implements LIRGenResLowerable { private MonitorCounterNode() { super(null); } @Override - public void generate(LIRGenerator gen) { + public void generate(LIRGenerator gen, LIRGenerationResult res) { assert graph().getNodes().filter(MonitorCounterNode.class).count() == 1 : "monitor counters not canonicalized to single instance"; - StackSlot counter = gen.getFrameMap().allocateStackSlots(1, new BitSet(0), null); + StackSlot counter = res.getFrameMap().allocateStackSlots(1, new BitSet(0), null); Value result = gen.emitAddress(counter); gen.setResult(this, result); } diff -r 73774616a6b3 -r eab93bf521d7 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Tue Mar 18 13:49:11 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Tue Mar 18 14:48:39 2014 +0100 @@ -30,17 +30,17 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.gen.*; +import com.oracle.graal.compiler.target.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.java.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; /** * Performs a tail call to the specified target compiled method, with the parameter taken from the * supplied FrameState. */ -public class TailcallNode extends FixedWithNextNode implements LIRLowerable { +public class TailcallNode extends FixedWithNextNode implements LIRGenResLowerable { @Input private FrameState frameState; @Input private ValueNode target; @@ -57,15 +57,13 @@ this.frameState = frameState; } - @Override - public void generate(LIRGeneratorTool generator) { - LIRGenerator gen = (LIRGenerator) generator; + public void generate(LIRGenerator gen, LIRGenerationResult res) { HotSpotVMConfig config = runtime().getConfig(); ResolvedJavaMethod method = frameState.method(); boolean isStatic = Modifier.isStatic(method.getModifiers()); JavaType[] signature = MetaUtil.signatureToTypes(method.getSignature(), isStatic ? null : method.getDeclaringClass()); - CallingConvention cc = gen.getFrameMap().registerConfig.getCallingConvention(CallingConvention.Type.JavaCall, null, signature, gen.target(), false); + CallingConvention cc = res.getFrameMap().registerConfig.getCallingConvention(CallingConvention.Type.JavaCall, null, signature, gen.target(), false); List parameters = new ArrayList<>(); for (int i = 0, slot = 0; i < cc.getArgumentCount(); i++, slot += HIRFrameStateBuilder.stackSlots(frameState.localAt(slot).kind())) { parameters.add(frameState.localAt(slot));