use of jdk.vm.ci.code.StackLockValue in project graal by oracle.
the class HotSpotDebugInfoBuilder method computeLockValue.
@Override
protected JavaValue computeLockValue(FrameState state, int lockIndex) {
int lockDepth = lockIndex;
if (state.outerFrameState() != null) {
lockDepth += state.outerFrameState().nestedLockDepth();
}
VirtualStackSlot slot = lockStack.makeLockSlot(lockDepth);
ValueNode lock = state.lockAt(lockIndex);
JavaValue object = toJavaValue(lock);
boolean eliminated = object instanceof VirtualObject || state.monitorIdAt(lockIndex).isEliminated();
assert state.monitorIdAt(lockIndex).getLockDepth() == lockDepth;
return new StackLockValue(object, slot, eliminated);
}
use of jdk.vm.ci.code.StackLockValue in project graal by oracle.
the class LIRFrameState method processValues.
protected void processValues(LIRInstruction inst, JavaValue[] values, InstructionValueProcedure proc) {
for (int i = 0; i < values.length; i++) {
JavaValue value = values[i];
if (isIllegalJavaValue(value)) {
continue;
}
if (value instanceof AllocatableValue) {
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;
JavaValue owner = monitor.getOwner();
if (owner instanceof AllocatableValue) {
monitor.setOwner((JavaValue) proc.doValue(inst, (AllocatableValue) owner, OperandMode.ALIVE, STATE_FLAGS));
}
Value slot = monitor.getSlot();
if (isVirtualStackSlot(slot)) {
monitor.setSlot(asAllocatableValue(proc.doValue(inst, slot, OperandMode.ALIVE, STATE_FLAGS)));
}
} else {
assert unprocessed(value);
}
}
}
use of jdk.vm.ci.code.StackLockValue in project graal by oracle.
the class HotSpotMonitorValueTest method addMethod.
@Override
protected InstalledCode addMethod(DebugContext debug, ResolvedJavaMethod method, CompilationResult compResult) {
for (Infopoint i : compResult.getInfopoints()) {
if (i instanceof Call) {
Call call = (Call) i;
if (call.target instanceof ResolvedJavaMethod) {
ResolvedJavaMethod target = (ResolvedJavaMethod) call.target;
if (target.equals(lookupObjectWait())) {
BytecodeFrame frame = call.debugInfo.frame();
BytecodeFrame caller = frame.caller();
assertNotNull(caller);
assertNull(caller.caller());
assertDeepEquals(2, frame.numLocks);
assertDeepEquals(2, caller.numLocks);
StackLockValue lock1 = (StackLockValue) frame.getLockValue(0);
StackLockValue lock2 = (StackLockValue) frame.getLockValue(1);
StackLockValue lock3 = (StackLockValue) caller.getLockValue(0);
StackLockValue lock4 = (StackLockValue) caller.getLockValue(1);
List<StackLockValue> locks = Arrays.asList(lock1, lock2, lock3, lock4);
for (StackLockValue lock : locks) {
for (StackLockValue other : locks) {
if (other != lock) {
// Every lock must have a different stack slot
assertThat(lock.getSlot(), not(other.getSlot()));
}
}
}
assertDeepEquals(lock3.getOwner(), lock4.getOwner());
assertThat(lock1.getOwner(), not(lock2.getOwner()));
return super.addMethod(debug, method, compResult);
}
}
}
}
throw new AssertionError("Could not find debug info for call to Object.wait(long)");
}
use of jdk.vm.ci.code.StackLockValue in project graal by oracle.
the class LIRFrameState method visitValues.
protected void visitValues(LIRInstruction inst, JavaValue[] values, InstructionValueConsumer proc) {
for (int i = 0; i < values.length; i++) {
JavaValue value = values[i];
if (isIllegalJavaValue(value)) {
continue;
} else if (value instanceof AllocatableValue) {
proc.visitValue(inst, (AllocatableValue) value, OperandMode.ALIVE, STATE_FLAGS);
} else if (value instanceof StackLockValue) {
StackLockValue monitor = (StackLockValue) value;
JavaValue owner = monitor.getOwner();
if (owner instanceof AllocatableValue) {
proc.visitValue(inst, (AllocatableValue) owner, OperandMode.ALIVE, STATE_FLAGS);
}
Value slot = monitor.getSlot();
if (isVirtualStackSlot(slot)) {
proc.visitValue(inst, slot, OperandMode.ALIVE, STATE_FLAGS);
}
} else {
assert unprocessed(value);
}
}
}
Aggregations