# HG changeset patch # User Josef Eisl # Date 1412096188 -7200 # Node ID 0f8b1fb632df82a19fd0631c782c5506ba700108 # Parent afafc0aad977d945e953d3c939b049b1fe74cb7f Remove InstructionValueProcedureBase (superseded by InstructionValueProcedure). diff -r afafc0aad977 -r 0f8b1fb632df graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRFrameState.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRFrameState.java Tue Sep 30 18:41:18 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRFrameState.java Tue Sep 30 18:56:28 2014 +0200 @@ -38,11 +38,11 @@ } @Override - protected Value processValue(LIRInstruction inst, InstructionValueProcedureBase proc, Value value) { + protected Value processValue(LIRInstruction inst, InstructionValueProcedure proc, Value value) { if (value instanceof HotSpotMonitorValue) { HotSpotMonitorValue monitor = (HotSpotMonitorValue) value; if (processed(monitor.getOwner())) { - monitor.setOwner(proc.processValue(inst, monitor.getOwner(), OperandMode.ALIVE, STATE_FLAGS)); + monitor.setOwner(proc.doValue(inst, monitor.getOwner(), OperandMode.ALIVE, STATE_FLAGS)); } return value; } else { diff -r afafc0aad977 -r 0f8b1fb632df graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValue.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValue.java Tue Sep 30 18:41:18 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValue.java Tue Sep 30 18:56:28 2014 +0200 @@ -54,7 +54,7 @@ valueClass = CompositeValueClass.get(getClass()); } - final CompositeValue forEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueProcedureBase proc) { + final CompositeValue forEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueProcedure proc) { return valueClass.forEachComponent(inst, this, mode, proc); } diff -r afafc0aad977 -r 0f8b1fb632df graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java Tue Sep 30 18:41:18 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java Tue Sep 30 18:56:28 2014 +0200 @@ -101,7 +101,7 @@ return str.toString(); } - final CompositeValue forEachComponent(LIRInstruction inst, CompositeValue obj, OperandMode mode, InstructionValueProcedureBase proc) { + final CompositeValue forEachComponent(LIRInstruction inst, CompositeValue obj, OperandMode mode, InstructionValueProcedure proc) { return super.forEachComponent(inst, obj, values, mode, proc); } diff -r afafc0aad977 -r 0f8b1fb632df graal/com.oracle.graal.lir/src/com/oracle/graal/lir/InstructionValueConsumer.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/InstructionValueConsumer.java Tue Sep 30 18:41:18 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/InstructionValueConsumer.java Tue Sep 30 18:56:28 2014 +0200 @@ -32,7 +32,7 @@ * Non-modifying version of {@link InstructionValueProcedure}. */ @FunctionalInterface -public interface InstructionValueConsumer extends InstructionValueProcedureBase { +public interface InstructionValueConsumer extends InstructionValueProcedure { /** * Iterator method to be overwritten. @@ -44,7 +44,7 @@ */ void visitValue(LIRInstruction instruction, Value value, OperandMode mode, EnumSet flags); - default Value processValue(LIRInstruction instruction, Value value, OperandMode mode, EnumSet flags) { + default Value doValue(LIRInstruction instruction, Value value, OperandMode mode, EnumSet flags) { visitValue(instruction, value, mode, flags); return value; } diff -r afafc0aad977 -r 0f8b1fb632df graal/com.oracle.graal.lir/src/com/oracle/graal/lir/InstructionValueProcedure.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/InstructionValueProcedure.java Tue Sep 30 18:41:18 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/InstructionValueProcedure.java Tue Sep 30 18:56:28 2014 +0200 @@ -29,12 +29,10 @@ import com.oracle.graal.lir.LIRInstruction.OperandMode; /** - * Iterator for iterating over a list of values. Subclasses must overwrite one of the doValue - * methods. Clients should not use this interface directly but call - * {@link InstructionValueProcedureBase#processValue} instead. + * Functional interface for iterating over a list of values. */ @FunctionalInterface -public interface InstructionValueProcedure extends InstructionValueProcedureBase { +public interface InstructionValueProcedure { /** * Iterator method to be overwritten. @@ -47,7 +45,4 @@ */ Value doValue(LIRInstruction instruction, Value value, OperandMode mode, EnumSet flags); - default Value processValue(LIRInstruction instruction, Value value, OperandMode mode, EnumSet flags) { - return doValue(instruction, value, mode, flags); - } } diff -r afafc0aad977 -r 0f8b1fb632df graal/com.oracle.graal.lir/src/com/oracle/graal/lir/InstructionValueProcedureBase.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/InstructionValueProcedureBase.java Tue Sep 30 18:41:18 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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; - -import java.util.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.lir.LIRInstruction.*; - -/** - * Common base class for modifying and non-modifying {@link Value value} iterators. - * - * This type should not be sub-classed directly. Use {@link InstructionValueProcedureBase} or - * {@link InstructionValueConsumer} instead. - * - * @see InstructionValueProcedure - * @see ValueProcedure - * @see InstructionValueConsumer - * @see ValueConsumer - */ -public interface InstructionValueProcedureBase { - - /** - * Iterator method to be overwritten. This version of the iterator gets additional parameters - * about the processed value. - * - * @param instruction The current instruction. - * @param value The value that is iterated. - * @param mode The operand mode for the value. - * @param flags A set of flags for the value. - * @return The new value to replace the value that was passed in. - */ - Value processValue(LIRInstruction instruction, Value value, OperandMode mode, EnumSet flags); - -} diff -r afafc0aad977 -r 0f8b1fb632df graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java Tue Sep 30 18:41:18 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java Tue Sep 30 18:56:28 2014 +0200 @@ -63,10 +63,6 @@ * @param proc The procedure called for variables. */ public void forEachState(LIRInstruction inst, InstructionValueProcedure proc) { - forEachState(inst, proc); - } - - void forEachState(LIRInstruction inst, InstructionValueProcedureBase proc) { for (BytecodeFrame cur = topFrame; cur != null; cur = cur.caller()) { processValues(inst, cur.values, proc); } @@ -83,16 +79,16 @@ */ protected static final EnumSet STATE_FLAGS = EnumSet.of(OperandFlag.REG, OperandFlag.STACK); - protected void processValues(LIRInstruction inst, Value[] values, InstructionValueProcedureBase proc) { + protected void processValues(LIRInstruction inst, Value[] values, InstructionValueProcedure proc) { for (int i = 0; i < values.length; i++) { Value value = values[i]; values[i] = processValue(inst, proc, value); } } - protected Value processValue(LIRInstruction inst, InstructionValueProcedureBase proc, Value value) { + protected Value processValue(LIRInstruction inst, InstructionValueProcedure proc, Value value) { if (processed(value)) { - return proc.processValue(inst, value, OperandMode.ALIVE, STATE_FLAGS); + return proc.doValue(inst, value, OperandMode.ALIVE, STATE_FLAGS); } return value; } diff -r afafc0aad977 -r 0f8b1fb632df graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java Tue Sep 30 18:41:18 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java Tue Sep 30 18:56:28 2014 +0200 @@ -234,23 +234,23 @@ forEach(obj, obj, defs, OperandMode.DEF, proc, ValuePosition.ROOT_VALUE_POSITION); } - final void forEachUse(LIRInstruction obj, InstructionValueProcedureBase proc) { + final void forEachUse(LIRInstruction obj, InstructionValueProcedure proc) { forEach(obj, uses, OperandMode.USE, proc); } - final void forEachAlive(LIRInstruction obj, InstructionValueProcedureBase proc) { + final void forEachAlive(LIRInstruction obj, InstructionValueProcedure proc) { forEach(obj, alives, OperandMode.ALIVE, proc); } - final void forEachTemp(LIRInstruction obj, InstructionValueProcedureBase proc) { + final void forEachTemp(LIRInstruction obj, InstructionValueProcedure proc) { forEach(obj, temps, OperandMode.TEMP, proc); } - final void forEachDef(LIRInstruction obj, InstructionValueProcedureBase proc) { + final void forEachDef(LIRInstruction obj, InstructionValueProcedure proc) { forEach(obj, defs, OperandMode.DEF, proc); } - final void forEachState(LIRInstruction obj, InstructionValueProcedureBase proc) { + final void forEachState(LIRInstruction obj, InstructionValueProcedure proc) { for (int i = 0; i < states.getCount(); i++) { LIRFrameState state = (LIRFrameState) states.getObject(obj, i); if (state != null) { @@ -268,7 +268,7 @@ } } - final Value forEachRegisterHint(LIRInstruction obj, OperandMode mode, InstructionValueProcedureBase proc) { + final Value forEachRegisterHint(LIRInstruction obj, OperandMode mode, InstructionValueProcedure proc) { Values hints; if (mode == OperandMode.USE) { hints = defs; @@ -281,7 +281,7 @@ for (int i = 0; i < hints.getCount(); i++) { if (i < hints.getDirectCount()) { Value hintValue = hints.getValue(obj, i); - Value result = proc.processValue(obj, hintValue, null, null); + Value result = proc.doValue(obj, hintValue, null, null); if (result != null) { return result; } @@ -289,7 +289,7 @@ Value[] hintValues = hints.getValueArray(obj, i); for (int j = 0; j < hintValues.length; j++) { Value hintValue = hintValues[j]; - Value result = proc.processValue(obj, hintValue, null, null); + Value result = proc.doValue(obj, hintValue, null, null); if (result != null) { return result; } diff -r afafc0aad977 -r 0f8b1fb632df graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java Tue Sep 30 18:41:18 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java Tue Sep 30 18:56:28 2014 +0200 @@ -214,7 +214,7 @@ } } - protected static void forEach(LIRInstruction inst, Values values, OperandMode mode, InstructionValueProcedureBase proc) { + protected static void forEach(LIRInstruction inst, Values values, OperandMode mode, InstructionValueProcedure proc) { for (int i = 0; i < values.getCount(); i++) { assert LIRInstruction.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); @@ -225,7 +225,7 @@ CompositeValue composite = (CompositeValue) value; newValue = composite.forEachComponent(inst, mode, proc); } else { - newValue = proc.processValue(inst, value, mode, values.getFlags(i)); + newValue = proc.doValue(inst, value, mode, values.getFlags(i)); } if (!value.identityEquals(newValue)) { values.setValue(inst, i, newValue); @@ -239,7 +239,7 @@ CompositeValue composite = (CompositeValue) value; newValue = composite.forEachComponent(inst, mode, proc); } else { - newValue = proc.processValue(inst, value, mode, values.getFlags(i)); + newValue = proc.doValue(inst, value, mode, values.getFlags(i)); } if (!value.identityEquals(newValue)) { valueArray[j] = newValue; @@ -249,7 +249,7 @@ } } - protected static CompositeValue forEachComponent(LIRInstruction inst, CompositeValue obj, Values values, OperandMode mode, InstructionValueProcedureBase proc) { + protected static CompositeValue forEachComponent(LIRInstruction inst, CompositeValue obj, Values values, OperandMode mode, InstructionValueProcedure proc) { CompositeValue newCompValue = null; for (int i = 0; i < values.getCount(); i++) { assert LIRInstruction.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); @@ -261,7 +261,7 @@ CompositeValue composite = (CompositeValue) value; newValue = composite.forEachComponent(inst, mode, proc); } else { - newValue = proc.processValue(inst, value, mode, values.getFlags(i)); + newValue = proc.doValue(inst, value, mode, values.getFlags(i)); } if (!value.identityEquals(newValue)) { // lazy initialize @@ -280,7 +280,7 @@ CompositeValue composite = (CompositeValue) value; newValue = composite.forEachComponent(inst, mode, proc); } else { - newValue = proc.processValue(inst, value, mode, values.getFlags(i)); + newValue = proc.doValue(inst, value, mode, values.getFlags(i)); } if (!value.identityEquals(newValue)) { // lazy initialize diff -r afafc0aad977 -r 0f8b1fb632df graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueConsumer.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueConsumer.java Tue Sep 30 18:41:18 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueConsumer.java Tue Sep 30 18:56:28 2014 +0200 @@ -32,7 +32,7 @@ * Non-modifying version of {@link ValueProcedure}. */ @FunctionalInterface -public interface ValueConsumer extends InstructionValueProcedureBase { +public interface ValueConsumer extends InstructionValueProcedure { /** * Iterator method to be overwritten. @@ -43,7 +43,7 @@ */ void visitValue(Value value, OperandMode mode, EnumSet flags); - default Value processValue(LIRInstruction instruction, Value value, OperandMode mode, EnumSet flags) { + default Value doValue(LIRInstruction instruction, Value value, OperandMode mode, EnumSet flags) { visitValue(value, mode, flags); return value; } diff -r afafc0aad977 -r 0f8b1fb632df graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueProcedure.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueProcedure.java Tue Sep 30 18:41:18 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueProcedure.java Tue Sep 30 18:56:28 2014 +0200 @@ -32,7 +32,7 @@ * Similar to {@link InstructionValueProcedure} but without an {@link LIRInstruction} parameter. */ @FunctionalInterface -public interface ValueProcedure extends InstructionValueProcedureBase { +public interface ValueProcedure extends InstructionValueProcedure { /** * Iterator method to be overwritten. @@ -44,7 +44,7 @@ */ Value doValue(Value value, OperandMode mode, EnumSet flags); - default Value processValue(LIRInstruction instruction, Value value, OperandMode mode, EnumSet flags) { + default Value doValue(LIRInstruction instruction, Value value, OperandMode mode, EnumSet flags) { return doValue(value, mode, flags); } }