# HG changeset patch # User Thomas Wuerthinger # Date 1425379876 -3600 # Node ID 9669f6a5624b236c1a7c53c9e45cb9a8d2d5b616 # Parent d9e44edfca9b47fb34ab020271b1120ff9374836# Parent 6bc0c7c6f690a0deef8393281bf4d3591694a79f Merge. diff -r d9e44edfca9b -r 9669f6a5624b graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java Tue Mar 03 11:50:31 2015 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java Tue Mar 03 11:51:16 2015 +0100 @@ -66,7 +66,7 @@ * Note that the number of locals and the number of stack slots may be smaller than the maximum * number of locals and stack slots as specified in the compiled method. */ - public final JavaValue[] values; + public final Value[] values; /** * The number of locals in the values array. @@ -144,7 +144,7 @@ * @param numStack the depth of the stack * @param numLocks the number of locked objects */ - public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, JavaValue[] values, int numLocals, int numStack, int numLocks) { + public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, Value[] values, int numLocals, int numStack, int numLocks) { super(caller, method, bci); assert values != null; this.rethrowException = rethrowException; @@ -183,7 +183,7 @@ * @param i the local variable index * @return the value that can be used to reconstruct the local's current value */ - public JavaValue getLocalValue(int i) { + public Value getLocalValue(int i) { return values[i]; } @@ -193,7 +193,7 @@ * @param i the stack index * @return the value that can be used to reconstruct the stack slot's current value */ - public JavaValue getStackValue(int i) { + public Value getStackValue(int i) { return values[i + numLocals]; } @@ -203,7 +203,7 @@ * @param i the lock index * @return the value that can be used to reconstruct the lock's current value */ - public JavaValue getLockValue(int i) { + public Value getLockValue(int i) { return values[i + numLocals + numStack]; } diff -r d9e44edfca9b -r 9669f6a5624b graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackLockValue.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackLockValue.java Tue Mar 03 11:50:31 2015 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackLockValue.java Tue Mar 03 11:51:16 2015 +0100 @@ -33,22 +33,22 @@ private static final long serialVersionUID = 8241681800464483691L; - private JavaValue owner; + private Value owner; private StackSlotValue slot; private final boolean eliminated; - public StackLockValue(JavaValue owner, StackSlotValue slot, boolean eliminated) { + public StackLockValue(Value object, StackSlotValue slot, boolean eliminated) { super(LIRKind.Illegal); - this.owner = owner; + this.owner = object; this.slot = slot; this.eliminated = eliminated; } - public JavaValue getOwner() { + public Value getOwner() { return owner; } - public void setOwner(JavaValue newOwner) { + public void setOwner(Value newOwner) { this.owner = newOwner; } diff -r d9e44edfca9b -r 9669f6a5624b graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java Tue Mar 03 11:50:31 2015 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java Tue Mar 03 11:51:16 2015 +0100 @@ -36,7 +36,7 @@ private static final long serialVersionUID = -2907197776426346021L; private final ResolvedJavaType type; - private JavaValue[] values; + private Value[] values; private final int id; /** @@ -54,18 +54,18 @@ * position in the compiled code. * @return a new {@link VirtualObject} instance. */ - public static VirtualObject get(ResolvedJavaType type, JavaValue[] values, int id) { + public static VirtualObject get(ResolvedJavaType type, Value[] values, int id) { return new VirtualObject(type, values, id); } - private VirtualObject(ResolvedJavaType type, JavaValue[] values, int id) { + private VirtualObject(ResolvedJavaType type, Value[] values, int id) { super(LIRKind.reference(Kind.Object)); this.type = type; this.values = values; this.id = id; } - private static StringBuilder appendValue(StringBuilder buf, JavaValue value, Set visited) { + private static StringBuilder appendValue(StringBuilder buf, Value value, Set visited) { if (value instanceof VirtualObject) { VirtualObject vo = (VirtualObject) value; buf.append("vobject:").append(vo.type.toJavaName(false)).append(':').append(vo.id); @@ -120,7 +120,7 @@ /** * Returns an array containing all the values to be stored into the object when it is recreated. */ - public JavaValue[] getValues() { + public Value[] getValues() { return values; } @@ -132,7 +132,7 @@ return id; } - private static boolean checkValues(ResolvedJavaType type, JavaValue[] values) { + private static boolean checkValues(ResolvedJavaType type, Value[] values) { if (values != null) { if (!type.isArray()) { ResolvedJavaField[] fields = type.getInstanceFields(true); @@ -140,8 +140,8 @@ for (int i = 0; i < values.length; i++) { ResolvedJavaField field = fields[fieldIndex++]; Kind valKind = values[i].getKind().getStackKind(); - if (field.getKind() == Kind.Object && values[i] instanceof Value) { - assert ((Value) values[i]).getLIRKind().isReference(0) : field + ": " + valKind + " != " + field.getKind(); + if (field.getKind() == Kind.Object) { + assert values[i].getLIRKind().isReference(0) : field + ": " + valKind + " != " + field.getKind(); } else { if ((valKind == Kind.Double || valKind == Kind.Long) && field.getKind() == Kind.Int) { assert fields[fieldIndex].getKind() == Kind.Int; @@ -156,9 +156,7 @@ Kind componentKind = type.getComponentType().getKind().getStackKind(); if (componentKind == Kind.Object) { for (int i = 0; i < values.length; i++) { - if (values[i] instanceof Value) { - assert ((Value) values[i]).getLIRKind().isReference(0) : values[i].getKind() + " != " + componentKind; - } + assert values[i].getLIRKind().isReference(0) : values[i].getKind() + " != " + componentKind; } } else { for (int i = 0; i < values.length; i++) { @@ -177,7 +175,7 @@ * @param values an array containing all the values to be stored into the object when it is * recreated. */ - public void setValues(JavaValue[] values) { + public void setValues(Value[] values) { assert checkValues(type, values); this.values = values; } diff -r d9e44edfca9b -r 9669f6a5624b graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Tue Mar 03 11:50:31 2015 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Tue Mar 03 11:51:16 2015 +0100 @@ -43,10 +43,10 @@ import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.framemap.*; import com.oracle.graal.lir.gen.*; +import com.oracle.graal.lir.phases.AllocationPhase.AllocationContext; import com.oracle.graal.lir.phases.*; +import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.PostAllocationOptimizationContext; import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext; -import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.PostAllocationOptimizationContext; -import com.oracle.graal.lir.phases.AllocationPhase.AllocationContext; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.spi.*; @@ -64,6 +64,8 @@ private static final DebugTimer FrontEnd = Debug.timer("FrontEnd"); private static final DebugTimer BackEnd = Debug.timer("BackEnd"); + private static final DebugTimer EmitLIR = Debug.timer("EmitLIR"); + private static final DebugTimer EmitCode = Debug.timer("EmitCode"); /** * The set of positive filters specified by the {@code -G:IntrinsificationsEnabled} option. To @@ -93,6 +95,9 @@ @Option(help = "Pattern for method(s) to which intrinsification will not be applied. " + "See MethodFilter class for pattern syntax.", type = OptionType.Debug) public static final OptionValue IntrinsificationsDisabled = new OptionValue<>(null); + + @Option(help = "Repeatedly run the LIR code generation pass to improve statistical profiling results.", type = OptionType.Debug) + public static final OptionValue EmitLIRRepeatCount = new OptionValue<>(0); // @formatter:on } @@ -276,10 +281,18 @@ public static void emitBackEnd(StructuredGraph graph, Object stub, CallingConvention cc, ResolvedJavaMethod installedCodeOwner, Backend backend, TargetDescription target, T compilationResult, CompilationResultBuilderFactory factory, SchedulePhase schedule, RegisterConfig registerConfig, LIRSuites lirSuites) { - try (TimerCloseable a = BackEnd.start()) { + try (Scope s = Debug.scope("BackEnd"); TimerCloseable a = BackEnd.start()) { + // Repeatedly run the LIR code generation pass to improve statistical profiling results. + for (int i = 0; i < EmitLIRRepeatCount.getValue(); i++) { + SchedulePhase dummySchedule = new SchedulePhase(); + dummySchedule.setScheduleConstants(true); + dummySchedule.apply(graph); + emitLIR(backend, target, dummySchedule, graph, stub, cc, registerConfig, lirSuites); + } + LIRGenerationResult lirGen = null; lirGen = emitLIR(backend, target, schedule, graph, stub, cc, registerConfig, lirSuites); - try (Scope s = Debug.scope("CodeGen", lirGen, lirGen.getLIR())) { + try (Scope s2 = Debug.scope("CodeGen", lirGen, lirGen.getLIR())) { emitCode(backend, graph.getAssumptions(), graph.method(), graph.getInlinedMethods(), lirGen, compilationResult, installedCodeOwner, factory); } catch (Throwable e) { throw Debug.handle(e); @@ -300,18 +313,21 @@ } } + private static final DebugTimer lirGenTimeTracker = Debug.timer("LIRGenTime"); + private static final DebugMemUseTracker lirGenMemUseTracker = Debug.memUseTracker("LIRGenMemUse"); + public static LIRGenerationResult emitLIR(Backend backend, TargetDescription target, SchedulePhase schedule, StructuredGraph graph, Object stub, CallingConvention cc, RegisterConfig registerConfig, LIRSuites lirSuites) { - List blocks = schedule.getCFG().getBlocks(); - Block startBlock = schedule.getCFG().getStartBlock(); - assert startBlock != null; - assert startBlock.getPredecessorCount() == 0; + try (Scope ds = Debug.scope("EmitLIR"); TimerCloseable a = EmitLIR.start()) { + List blocks = schedule.getCFG().getBlocks(); + Block startBlock = schedule.getCFG().getStartBlock(); + assert startBlock != null; + assert startBlock.getPredecessorCount() == 0; - LIR lir = null; - List codeEmittingOrder = null; - List linearScanOrder = null; - try (Scope ds = Debug.scope("MidEnd")) { - try (Scope s = Debug.scope("ComputeLinearScanOrder")) { + LIR lir = null; + List codeEmittingOrder = null; + List linearScanOrder = null; + try (Scope s = Debug.scope("ComputeLinearScanOrder", lir)) { codeEmittingOrder = ComputeBlockOrder.computeCodeEmittingOrder(blocks.size(), startBlock); linearScanOrder = ComputeBlockOrder.computeLinearScanOrder(blocks.size(), startBlock); @@ -320,16 +336,12 @@ } catch (Throwable e) { throw Debug.handle(e); } - } catch (Throwable e) { - throw Debug.handle(e); - } - try (Scope ds = Debug.scope("BackEnd", lir)) { FrameMapBuilder frameMapBuilder = backend.newFrameMapBuilder(registerConfig); LIRGenerationResult lirGenRes = backend.newLIRGenerationResult(lir, frameMapBuilder, graph.method(), stub); LIRGeneratorTool lirGen = backend.newLIRGenerator(cc, lirGenRes); NodeLIRBuilderTool nodeLirGen = backend.newNodeLIRBuilder(graph, lirGen); - try (Scope s = Debug.scope("LIRGen", lirGen)) { + try (Scope s = Debug.scope("LIRGen", lir, lirGen); AutoCloseable c = lirGenMemUseTracker.start(); AutoCloseable t = lirGenTimeTracker.start()) { for (Block b : linearScanOrder) { emitBlock(nodeLirGen, lirGenRes, b, graph, schedule.getBlockToNodesMap()); } @@ -366,45 +378,49 @@ public static void emitCode(Backend backend, Assumptions assumptions, ResolvedJavaMethod rootMethod, Set inlinedMethods, LIRGenerationResult lirGenRes, CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner, CompilationResultBuilderFactory factory) { - FrameMap frameMap = lirGenRes.getFrameMap(); - CompilationResultBuilder crb = backend.newCompilationResultBuilder(lirGenRes, frameMap, compilationResult, factory); - backend.emitCode(crb, lirGenRes.getLIR(), installedCodeOwner); - crb.finish(); - if (assumptions != null && !assumptions.isEmpty()) { - compilationResult.setAssumptions(assumptions.toArray()); - } - if (inlinedMethods != null) { - compilationResult.setMethods(rootMethod, inlinedMethods); - } - - if (Debug.isMeterEnabled()) { - List ldp = compilationResult.getDataPatches(); - Kind[] kindValues = Kind.values(); - DebugMetric[] dms = new DebugMetric[kindValues.length]; - for (int i = 0; i < dms.length; i++) { - dms[i] = Debug.metric("DataPatches-%s", kindValues[i]); + try (TimerCloseable a = EmitCode.start()) { + FrameMap frameMap = lirGenRes.getFrameMap(); + CompilationResultBuilder crb = backend.newCompilationResultBuilder(lirGenRes, frameMap, compilationResult, factory); + backend.emitCode(crb, lirGenRes.getLIR(), installedCodeOwner); + crb.finish(); + if (assumptions != null && !assumptions.isEmpty()) { + compilationResult.setAssumptions(assumptions.toArray()); + } + if (inlinedMethods != null) { + compilationResult.setMethods(rootMethod, inlinedMethods); } - for (DataPatch dp : ldp) { - Kind kind = Kind.Illegal; - if (dp.reference instanceof ConstantReference) { - VMConstant constant = ((ConstantReference) dp.reference).getConstant(); - kind = ((JavaConstant) constant).getKind(); + if (Debug.isMeterEnabled()) { + List ldp = compilationResult.getDataPatches(); + Kind[] kindValues = Kind.values(); + DebugMetric[] dms = new DebugMetric[kindValues.length]; + for (int i = 0; i < dms.length; i++) { + dms[i] = Debug.metric("DataPatches-%s", kindValues[i]); } - dms[kind.ordinal()].add(1); + + for (DataPatch dp : ldp) { + Kind kind = Kind.Illegal; + if (dp.reference instanceof ConstantReference) { + VMConstant constant = ((ConstantReference) dp.reference).getConstant(); + kind = ((JavaConstant) constant).getKind(); + } + dms[kind.ordinal()].add(1); + } + + Debug.metric("CompilationResults").increment(); + Debug.metric("CodeBytesEmitted").add(compilationResult.getTargetCodeSize()); + Debug.metric("InfopointsEmitted").add(compilationResult.getInfopoints().size()); + Debug.metric("DataPatches").add(ldp.size()); + Debug.metric("ExceptionHandlersEmitted").add(compilationResult.getExceptionHandlers().size()); } - Debug.metric("CompilationResults").increment(); - Debug.metric("CodeBytesEmitted").add(compilationResult.getTargetCodeSize()); - Debug.metric("InfopointsEmitted").add(compilationResult.getInfopoints().size()); - Debug.metric("DataPatches").add(ldp.size()); - Debug.metric("ExceptionHandlersEmitted").add(compilationResult.getExceptionHandlers().size()); + if (Debug.isLogEnabled()) { + Debug.log("%s", backend.getProviders().getCodeCache().disassemble(compilationResult, null)); + } + + Debug.dump(compilationResult, "After code generation"); + } catch (Throwable e) { + throw Debug.handle(e); } - - if (Debug.isLogEnabled()) { - Debug.log("%s", backend.getProviders().getCodeCache().disassemble(compilationResult, null)); - } - - Debug.dump(compilationResult, "After code generation"); } } diff -r d9e44edfca9b -r 9669f6a5624b 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 Tue Mar 03 11:50:31 2015 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Tue Mar 03 11:51:16 2015 +0100 @@ -83,7 +83,7 @@ for (Entry entry : virtualObjectsCopy.entrySet()) { if (entry.getValue().getValues() == null) { VirtualObjectNode vobj = entry.getKey(); - JavaValue[] values = new JavaValue[vobj.entryCount()]; + Value[] values = new Value[vobj.entryCount()]; if (values.length > 0) { changed = true; VirtualObjectState currentField = (VirtualObjectState) objectStates.get(vobj); @@ -98,7 +98,7 @@ } } if (pos != vobj.entryCount()) { - JavaValue[] newValues = new JavaValue[pos]; + Value[] newValues = new Value[pos]; System.arraycopy(values, 0, newValues, 0, pos); values = newValues; } @@ -136,7 +136,7 @@ int numStack = state.stackSize(); int numLocks = state.locksSize(); - JavaValue[] values = new JavaValue[numLocals + numStack + numLocks]; + Value[] values = new Value[numLocals + numStack + numLocks]; computeLocals(state, numLocals, values); computeStack(state, numLocals, numStack, values); computeLocks(state, values); @@ -151,33 +151,33 @@ } } - protected void computeLocals(FrameState state, int numLocals, JavaValue[] values) { + protected void computeLocals(FrameState state, int numLocals, Value[] values) { for (int i = 0; i < numLocals; i++) { values[i] = computeLocalValue(state, i); } } - protected JavaValue computeLocalValue(FrameState state, int i) { + protected Value computeLocalValue(FrameState state, int i) { return toValue(state.localAt(i)); } - protected void computeStack(FrameState state, int numLocals, int numStack, JavaValue[] values) { + protected void computeStack(FrameState state, int numLocals, int numStack, Value[] values) { for (int i = 0; i < numStack; i++) { values[numLocals + i] = computeStackValue(state, i); } } - protected JavaValue computeStackValue(FrameState state, int i) { + protected Value computeStackValue(FrameState state, int i) { return toValue(state.stackAt(i)); } - protected void computeLocks(FrameState state, JavaValue[] values) { + protected void computeLocks(FrameState state, Value[] values) { for (int i = 0; i < state.locksSize(); i++) { values[state.localsSize() + state.stackSize() + i] = computeLockValue(state, i); } } - protected JavaValue computeLockValue(FrameState state, int i) { + protected Value computeLockValue(FrameState state, int i) { return toValue(state.lockAt(i)); } @@ -186,7 +186,7 @@ private static final DebugMetric STATE_VARIABLES = Debug.metric("StateVariables"); private static final DebugMetric STATE_CONSTANTS = Debug.metric("StateConstants"); - protected JavaValue toValue(ValueNode value) { + protected Value toValue(ValueNode value) { try { if (value instanceof VirtualObjectNode) { VirtualObjectNode obj = (VirtualObjectNode) value; @@ -218,7 +218,7 @@ STATE_VARIABLES.increment(); Value operand = nodeOperands.get(value); assert operand != null && (operand instanceof Variable || operand instanceof JavaConstant) : operand + " for " + value; - return (JavaValue) operand; + return operand; } else { // return a dummy value because real value not needed diff -r d9e44edfca9b -r 9669f6a5624b 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 Tue Mar 03 11:50:31 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java Tue Mar 03 11:51:16 2015 +0100 @@ -26,7 +26,6 @@ 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.*; /** @@ -46,25 +45,20 @@ } @Override - protected JavaValue computeLockValue(FrameState state, int lockIndex) { + protected Value computeLockValue(FrameState state, int lockIndex) { int lockDepth = lockIndex; if (state.outerFrameState() != null) { lockDepth += state.outerFrameState().nestedLockDepth(); } StackSlotValue slot = lockStack.makeLockSlot(lockDepth); ValueNode lock = state.lockAt(lockIndex); - JavaValue object = toValue(lock); + Value object = toValue(lock); boolean eliminated = object instanceof VirtualObject && state.monitorIdAt(lockIndex) != null; assert state.monitorIdAt(lockIndex) == null || state.monitorIdAt(lockIndex).getLockDepth() == lockDepth; return new StackLockValue(object, slot, eliminated); } @Override - protected LIRFrameState newLIRFrameState(LabelRef exceptionEdge, BytecodeFrame frame, VirtualObject[] virtualObjectsArray) { - return new HotSpotLIRFrameState(frame, virtualObjectsArray, exceptionEdge); - } - - @Override protected BytecodeFrame computeFrameForState(FrameState state) { assert state.bci >= 0 || state.bci == BytecodeFrame.BEFORE_BCI : state.bci; return super.computeFrameForState(state); diff -r d9e44edfca9b -r 9669f6a5624b 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 Mar 03 11:50:31 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2013, 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.hotspot; - -import static com.oracle.graal.api.code.ValueUtil.*; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.LIRInstruction.OperandMode; - -/** - * Extends {@link LIRFrameState} to handle {@link StackLockValue}s correctly. - */ -class HotSpotLIRFrameState extends LIRFrameState { - - public HotSpotLIRFrameState(BytecodeFrame topFrame, VirtualObject[] virtualObjects, LabelRef exceptionEdge) { - super(topFrame, virtualObjects, exceptionEdge); - } - - @Override - protected Value processValue(LIRInstruction inst, InstructionValueProcedure proc, Value value) { - if (value instanceof StackLockValue) { - StackLockValue monitor = (StackLockValue) value; - if (monitor.getOwner() instanceof Value) { - Value owner = (Value) monitor.getOwner(); - if (processed(owner)) { - monitor.setOwner((JavaValue) proc.doValue(inst, owner, OperandMode.ALIVE, STATE_FLAGS)); - } - } - Value slot = monitor.getSlot(); - if (isVirtualStackSlot(slot) && processed(slot)) { - monitor.setSlot(asStackSlotValue(proc.doValue(inst, slot, OperandMode.ALIVE, STATE_FLAGS))); - } - return value; - } else { - return super.processValue(inst, proc, value); - } - } -} diff -r d9e44edfca9b -r 9669f6a5624b 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 Mar 03 11:50:31 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java Tue Mar 03 11:51:16 2015 +0100 @@ -80,34 +80,46 @@ */ protected static final EnumSet STATE_FLAGS = EnumSet.of(OperandFlag.REG, OperandFlag.STACK); - protected void processValues(LIRInstruction inst, JavaValue[] values, InstructionValueProcedure proc) { + protected void processValues(LIRInstruction inst, Value[] values, InstructionValueProcedure proc) { for (int i = 0; i < values.length; i++) { - if (values[i] instanceof Value) { - Value value = (Value) values[i]; - values[i] = (JavaValue) processValue(inst, proc, value); - } + Value value = values[i]; + values[i] = processValue(inst, proc, value); } } protected Value processValue(LIRInstruction inst, InstructionValueProcedure proc, Value value) { - if (processed(value)) { - return proc.doValue(inst, value, OperandMode.ALIVE, STATE_FLAGS); + if (value instanceof StackLockValue) { + StackLockValue monitor = (StackLockValue) value; + Value owner = monitor.getOwner(); + if (owner instanceof AllocatableValue) { + monitor.setOwner(proc.doValue(inst, owner, OperandMode.ALIVE, STATE_FLAGS)); + } + Value slot = monitor.getSlot(); + if (isVirtualStackSlot(slot)) { + monitor.setSlot(asStackSlotValue(proc.doValue(inst, slot, OperandMode.ALIVE, STATE_FLAGS))); + } + } else { + if (!isIllegal(value) && value instanceof AllocatableValue) { + return proc.doValue(inst, value, OperandMode.ALIVE, STATE_FLAGS); + } else { + assert unprocessed(value); + } } return value; } - protected boolean processed(Value value) { + private boolean unprocessed(Value value) { if (isIllegal(value)) { // Ignore dead local variables. - return false; + return true; } else if (isConstant(value)) { // Ignore constants, the register allocator does not need to see them. - return false; + return true; } else if (isVirtualObject(value)) { assert Arrays.asList(virtualObjects).contains(value); - return false; + return true; } else { - return true; + return false; } } diff -r d9e44edfca9b -r 9669f6a5624b graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java Tue Mar 03 11:50:31 2015 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java Tue Mar 03 11:51:16 2015 +0100 @@ -182,7 +182,7 @@ return sb.toString(); } - protected String valueToString(JavaValue value, List virtualObjects) { + protected String valueToString(Value value, List virtualObjects) { if (value == null) { return "-"; } diff -r d9e44edfca9b -r 9669f6a5624b src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Tue Mar 03 11:50:31 2015 +0100 +++ b/src/share/vm/graal/graalJavaAccess.hpp Tue Mar 03 11:51:16 2015 +0100 @@ -169,7 +169,7 @@ typeArrayOop_field(BitSet, words, "[J") \ end_class \ start_class(BytecodeFrame) \ - objArrayOop_field(BytecodeFrame, values, "[Lcom/oracle/graal/api/meta/JavaValue;") \ + objArrayOop_field(BytecodeFrame, values, "[Lcom/oracle/graal/api/meta/Value;") \ int_field(BytecodeFrame, numLocals) \ int_field(BytecodeFrame, numStack) \ int_field(BytecodeFrame, numLocks) \ @@ -241,10 +241,10 @@ start_class(VirtualObject) \ int_field(VirtualObject, id) \ oop_field(VirtualObject, type, "Lcom/oracle/graal/api/meta/ResolvedJavaType;") \ - objArrayOop_field(VirtualObject, values, "[Lcom/oracle/graal/api/meta/JavaValue;") \ + objArrayOop_field(VirtualObject, values, "[Lcom/oracle/graal/api/meta/Value;") \ end_class \ - start_class(StackLockValue) \ - oop_field(StackLockValue, owner, "Lcom/oracle/graal/api/meta/JavaValue;") \ + start_class(StackLockValue) \ + oop_field(StackLockValue, owner, "Lcom/oracle/graal/api/meta/Value;") \ oop_field(StackLockValue, slot, "Lcom/oracle/graal/api/code/StackSlotValue;") \ boolean_field(StackLockValue, eliminated) \ end_class \ diff -r d9e44edfca9b -r 9669f6a5624b src/share/vm/runtime/deoptimization.cpp --- a/src/share/vm/runtime/deoptimization.cpp Tue Mar 03 11:50:31 2015 +0100 +++ b/src/share/vm/runtime/deoptimization.cpp Tue Mar 03 11:51:16 2015 +0100 @@ -1405,6 +1405,7 @@ ScopeDesc* trap_scope = cvf->scope(); if (TraceDeoptimization) { + ttyLocker ttyl; tty->print_cr(" bci=%d pc=" INTPTR_FORMAT ", relative_pc=%d, method=%s" GRAAL_ONLY(", debug_id=%d"), trap_scope->bci(), fr.pc(), fr.pc() - nm->code_begin(), trap_scope->method()->name_and_sig_as_C_string() #ifdef GRAAL , debug_id