# HG changeset patch # User Doug Simon # Date 1364558096 -3600 # Node ID b5eff8bd82dade2549a40a2de24fbd04fbc39a4c # Parent 6b5b9673de9f8ac78bb867b70f867df8c63bab31 added HotSpotLIRFrameState subclass of LIRFrameState to move HotSpot specific handling of lock state into HotSpot specific classes diff -r 6b5b9673de9f -r b5eff8bd82da graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Fri Mar 29 12:33:24 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Fri Mar 29 12:54:56 2013 +0100 @@ -106,6 +106,10 @@ } objectStates.clear(); + return newLIRFrameState(reason, exceptionEdge, frame, virtualObjectsArray); + } + + protected LIRFrameState newLIRFrameState(short reason, LabelRef exceptionEdge, BytecodeFrame frame, VirtualObject[] virtualObjectsArray) { return new LIRFrameState(frame, virtualObjectsArray, exceptionEdge, reason); } diff -r 6b5b9673de9f -r b5eff8bd82da graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java Fri Mar 29 12:33:24 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java Fri Mar 29 12:54:56 2013 +0100 @@ -26,6 +26,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.gen.*; import com.oracle.graal.graph.*; +import com.oracle.graal.lir.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.virtual.*; @@ -57,4 +58,9 @@ boolean eliminated = lock instanceof VirtualObjectNode; return new MonitorValue(object, slot, eliminated); } + + @Override + protected LIRFrameState newLIRFrameState(short reason, LabelRef exceptionEdge, BytecodeFrame frame, VirtualObject[] virtualObjectsArray) { + return new HotSpotLIRFrameState(frame, virtualObjectsArray, exceptionEdge, reason); + } } diff -r 6b5b9673de9f -r b5eff8bd82da graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRFrameState.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRFrameState.java Fri Mar 29 12:54:56 2013 +0100 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2013, 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.hotspot; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.lir.*; +import com.oracle.graal.lir.LIRInstruction.OperandMode; +import com.oracle.graal.lir.LIRInstruction.ValueProcedure; + +/** + * Extends {@link LIRFrameState} to handle {@link MonitorValue}s correctly. + */ +class HotSpotLIRFrameState extends LIRFrameState { + + public HotSpotLIRFrameState(BytecodeFrame topFrame, VirtualObject[] virtualObjects, LabelRef exceptionEdge, short deoptimizationReason) { + super(topFrame, virtualObjects, exceptionEdge, deoptimizationReason); + } + + @Override + protected Value processValue(ValueProcedure proc, Value value) { + if (value instanceof MonitorValue) { + MonitorValue monitor = (MonitorValue) value; + if (processed(monitor.getOwner())) { + monitor.setOwner(proc.doValue(monitor.getOwner(), OperandMode.ALIVE, STATE_FLAGS)); + } + return value; + } else { + return super.processValue(proc, value); + } + } +} diff -r 6b5b9673de9f -r b5eff8bd82da 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 Fri Mar 29 12:33:24 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java Fri Mar 29 12:54:56 2013 +0100 @@ -80,24 +80,23 @@ * We filter out constant and illegal values ourself before calling the procedure, so * {@link OperandFlag#CONST} and {@link OperandFlag#ILLEGAL} need not be set. */ - private static final EnumSet STATE_FLAGS = EnumSet.of(OperandFlag.REG, OperandFlag.STACK); + protected static final EnumSet STATE_FLAGS = EnumSet.of(OperandFlag.REG, OperandFlag.STACK); - private void processValues(Value[] values, ValueProcedure proc) { + protected void processValues(Value[] values, ValueProcedure proc) { for (int i = 0; i < values.length; i++) { Value value = values[i]; - if (value instanceof MonitorValue) { - MonitorValue monitor = (MonitorValue) value; - if (processed(monitor.getOwner())) { - monitor.setOwner(proc.doValue(monitor.getOwner(), OperandMode.ALIVE, STATE_FLAGS)); - } - - } else if (processed(value)) { - values[i] = proc.doValue(value, OperandMode.ALIVE, STATE_FLAGS); - } + values[i] = processValue(proc, value); } } - private boolean processed(Value value) { + protected Value processValue(ValueProcedure proc, Value value) { + if (processed(value)) { + return proc.doValue(value, OperandMode.ALIVE, STATE_FLAGS); + } + return value; + } + + protected boolean processed(Value value) { if (isIllegal(value)) { // Ignore dead local variables. return false;