Mercurial > hg > graal-compiler
changeset 22527:c9ebb39f4582
Explicitly store slot kinds in DebugInfo.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Fri, 28 Aug 2015 13:36:09 +0200 |
parents | 3d31341dede6 |
children | b1d4fd32135f |
files | graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java mx.graal/suite.py |
diffstat | 5 files changed, 62 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Fri Aug 28 10:39:08 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Fri Aug 28 13:36:09 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -85,7 +85,8 @@ for (Entry<VirtualObjectNode, VirtualObject> entry : virtualObjectsCopy.entrySet()) { if (entry.getValue().getValues() == null) { VirtualObjectNode vobj = entry.getKey(); - Value[] values = new Value[vobj.entryCount()]; + JavaValue[] values = new JavaValue[vobj.entryCount()]; + Kind[] slotKinds = new Kind[vobj.entryCount()]; if (values.length > 0) { changed = true; VirtualObjectState currentField = (VirtualObjectState) objectStates.get(vobj); @@ -93,19 +94,21 @@ int pos = 0; for (int i = 0; i < vobj.entryCount(); i++) { if (!currentField.values().get(i).isConstant() || currentField.values().get(i).asJavaConstant().getKind() != Kind.Illegal) { - values[pos++] = toValue(currentField.values().get(i)); + ValueNode value = currentField.values().get(i); + values[pos] = toJavaValue(value); + slotKinds[pos] = toSlotKind(value); + pos++; } else { assert currentField.values().get(i - 1).getStackKind() == Kind.Double || currentField.values().get(i - 1).getStackKind() == Kind.Long : vobj + " " + i + " " + currentField.values().get(i - 1); } } if (pos != vobj.entryCount()) { - Value[] newValues = new Value[pos]; - System.arraycopy(values, 0, newValues, 0, pos); - values = newValues; + values = Arrays.copyOf(values, pos); + slotKinds = Arrays.copyOf(slotKinds, pos); } } - entry.getValue().setValues(values); + entry.getValue().setValues(values, slotKinds); } } } while (changed); @@ -137,49 +140,46 @@ int numStack = state.stackSize(); int numLocks = state.locksSize(); - Value[] values = new Value[numLocals + numStack + numLocks]; - computeLocals(state, numLocals, values); - computeStack(state, numLocals, numStack, values); + JavaValue[] values = new JavaValue[numLocals + numStack + numLocks]; + Kind[] slotKinds = new Kind[numLocals + numStack]; + computeLocals(state, numLocals, values, slotKinds); + computeStack(state, numLocals, numStack, values, slotKinds); computeLocks(state, values); BytecodeFrame caller = null; if (state.outerFrameState() != null) { caller = computeFrameForState(state.outerFrameState()); } - return new BytecodeFrame(caller, state.method(), state.bci, state.rethrowException(), state.duringCall(), values, numLocals, numStack, numLocks); + return new BytecodeFrame(caller, state.method(), state.bci, state.rethrowException(), state.duringCall(), values, slotKinds, numLocals, numStack, numLocks); } catch (JVMCIError e) { throw e.addContext("FrameState: ", state); } } - protected void computeLocals(FrameState state, int numLocals, Value[] values) { + protected void computeLocals(FrameState state, int numLocals, JavaValue[] values, Kind[] slotKinds) { for (int i = 0; i < numLocals; i++) { - values[i] = computeLocalValue(state, i); + ValueNode local = state.localAt(i); + values[i] = toJavaValue(local); + slotKinds[i] = toSlotKind(local); } } - protected Value computeLocalValue(FrameState state, int i) { - return toValue(state.localAt(i)); - } - - protected void computeStack(FrameState state, int numLocals, int numStack, Value[] values) { + protected void computeStack(FrameState state, int numLocals, int numStack, JavaValue[] values, Kind[] slotKinds) { for (int i = 0; i < numStack; i++) { - values[numLocals + i] = computeStackValue(state, i); + ValueNode stack = state.stackAt(i); + values[numLocals + i] = toJavaValue(stack); + slotKinds[numLocals + i] = toSlotKind(stack); } } - protected Value computeStackValue(FrameState state, int i) { - return toValue(state.stackAt(i)); - } - - protected void computeLocks(FrameState state, Value[] values) { + protected void computeLocks(FrameState state, JavaValue[] values) { for (int i = 0; i < state.locksSize(); i++) { values[state.localsSize() + state.stackSize() + i] = computeLockValue(state, i); } } - protected Value computeLockValue(FrameState state, int i) { - return toValue(state.lockAt(i)); + protected JavaValue computeLockValue(FrameState state, int i) { + return toJavaValue(state.lockAt(i)); } private static final DebugMetric STATE_VIRTUAL_OBJECTS = Debug.metric("StateVirtualObjects"); @@ -187,7 +187,15 @@ private static final DebugMetric STATE_VARIABLES = Debug.metric("StateVariables"); private static final DebugMetric STATE_CONSTANTS = Debug.metric("StateConstants"); - protected Value toValue(ValueNode value) { + private static Kind toSlotKind(ValueNode value) { + if (value == null) { + return Kind.Illegal; + } else { + return value.getStackKind(); + } + } + + protected JavaValue toJavaValue(ValueNode value) { try { if (value instanceof VirtualObjectNode) { VirtualObjectNode obj = (VirtualObjectNode) value; @@ -197,12 +205,12 @@ throw new JVMCIError("no mapping found for virtual object %s", obj); } if (state instanceof MaterializedObjectState) { - return toValue(((MaterializedObjectState) state).materializedValue()); + return toJavaValue(((MaterializedObjectState) state).materializedValue()); } else { assert obj.entryCount() == 0 || state instanceof VirtualObjectState; VirtualObject vobject = virtualObjects.get(value); if (vobject == null) { - vobject = VirtualObject.get(obj.type(), null, virtualObjects.size()); + vobject = VirtualObject.get(obj.type(), virtualObjects.size()); virtualObjects.put(obj, vobject); } STATE_VIRTUAL_OBJECTS.increment(); @@ -219,7 +227,7 @@ STATE_VARIABLES.increment(); Value operand = nodeValueMap.operand(value); assert operand != null && (operand instanceof Variable || operand instanceof JavaConstant) : operand + " for " + value; - return operand; + return (JavaValue) operand; } else { // return a dummy value because real value not needed
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java Fri Aug 28 10:39:08 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java Fri Aug 28 13:36:09 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -49,14 +49,14 @@ } @Override - protected Value computeLockValue(FrameState state, int lockIndex) { + protected JavaValue 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); - Value object = toValue(lock); + JavaValue object = toJavaValue(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);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java Fri Aug 28 10:39:08 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java Fri Aug 28 13:36:09 2015 +0200 @@ -106,22 +106,23 @@ */ protected static final EnumSet<OperandFlag> STATE_FLAGS = EnumSet.of(OperandFlag.REG, OperandFlag.STACK); - protected void processValues(LIRInstruction inst, Value[] values, InstructionValueProcedure proc) { + protected void processValues(LIRInstruction inst, JavaValue[] values, InstructionValueProcedure proc) { for (int i = 0; i < values.length; i++) { - Value value = values[i]; - if (isIllegal(value)) { + JavaValue value = values[i]; + if (isIllegalJavaValue(value)) { continue; } if (value instanceof AllocatableValue) { - Value result = proc.doValue(inst, value, OperandMode.ALIVE, STATE_FLAGS); - if (!value.identityEquals(result)) { - values[i] = result; + AllocatableValue allocatable = (AllocatableValue) value; + Value result = proc.doValue(inst, allocatable, OperandMode.ALIVE, STATE_FLAGS); + if (!allocatable.identityEquals(result)) { + values[i] = (JavaValue) result; } } else if (value instanceof StackLockValue) { StackLockValue monitor = (StackLockValue) value; - Value owner = monitor.getOwner(); + JavaValue owner = monitor.getOwner(); if (owner instanceof AllocatableValue) { - monitor.setOwner(proc.doValue(inst, owner, OperandMode.ALIVE, STATE_FLAGS)); + monitor.setOwner((JavaValue) proc.doValue(inst, (AllocatableValue) owner, OperandMode.ALIVE, STATE_FLAGS)); } Value slot = monitor.getSlot(); if (isVirtualStackSlot(slot)) { @@ -133,18 +134,18 @@ } } - protected void processValues(LIRInstruction inst, Value[] values, InstructionValueConsumer proc) { + protected void processValues(LIRInstruction inst, JavaValue[] values, InstructionValueConsumer proc) { for (int i = 0; i < values.length; i++) { - Value value = values[i]; - if (isIllegal(value)) { + JavaValue value = values[i]; + if (isIllegalJavaValue(value)) { continue; } else if (value instanceof AllocatableValue) { - proc.visitValue(inst, value, OperandMode.ALIVE, STATE_FLAGS); + proc.visitValue(inst, (AllocatableValue) value, OperandMode.ALIVE, STATE_FLAGS); } else if (value instanceof StackLockValue) { StackLockValue monitor = (StackLockValue) value; - Value owner = monitor.getOwner(); + JavaValue owner = monitor.getOwner(); if (owner instanceof AllocatableValue) { - proc.visitValue(inst, owner, OperandMode.ALIVE, STATE_FLAGS); + proc.visitValue(inst, (AllocatableValue) owner, OperandMode.ALIVE, STATE_FLAGS); } Value slot = monitor.getSlot(); if (isVirtualStackSlot(slot)) { @@ -156,11 +157,11 @@ } } - private boolean unprocessed(Value value) { - if (isIllegal(value)) { + private boolean unprocessed(JavaValue value) { + if (isIllegalJavaValue(value)) { // Ignore dead local variables. return true; - } else if (isConstant(value)) { + } else if (isConstantJavaValue(value)) { // Ignore constants, the register allocator does not need to see them. return true; } else if (isVirtualObject(value)) {
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java Fri Aug 28 10:39:08 2015 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java Fri Aug 28 13:36:09 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -180,7 +180,7 @@ return sb.toString(); } - protected String valueToString(Value value, List<VirtualObject> virtualObjects) { + protected String valueToString(JavaValue value, List<VirtualObject> virtualObjects) { if (value == null) { return "-"; }
--- a/mx.graal/suite.py Fri Aug 28 10:39:08 2015 +0200 +++ b/mx.graal/suite.py Fri Aug 28 13:36:09 2015 +0200 @@ -6,7 +6,7 @@ "suites": [ { "name" : "jvmci", - "version" : "a69a8d96ee6ede392b569ed6e5dd4a82dfb199a0", + "version" : "822922922f3c06a1521f5bc4fe785910ebb47d51", "urls" : [ {"url" : "http://lafo.ssw.uni-linz.ac.at/hg/graal-jvmci-8", "kind" : "hg"}, {"url" : "http://lafo.ssw.uni-linz.ac.at/nexus/content/repositories/snapshots", "kind" : "binary"},