use of org.graalvm.compiler.nodes.virtual.VirtualObjectNode in project graal by oracle.
the class LoadIndexedNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode alias = tool.getAlias(array());
if (alias instanceof VirtualObjectNode) {
VirtualArrayNode virtual = (VirtualArrayNode) alias;
ValueNode indexValue = tool.getAlias(index());
int idx = indexValue.isConstant() ? indexValue.asJavaConstant().asInt() : -1;
if (idx >= 0 && idx < virtual.entryCount()) {
ValueNode entry = tool.getEntry(virtual, idx);
if (stamp.isCompatible(entry.stamp(NodeView.DEFAULT))) {
tool.replaceWith(entry);
} else {
assert stamp(NodeView.DEFAULT).getStackKind() == JavaKind.Int && (entry.stamp(NodeView.DEFAULT).getStackKind() == JavaKind.Long || entry.getStackKind() == JavaKind.Double || entry.getStackKind() == JavaKind.Illegal) : "Can only allow different stack kind two slot marker writes on one stot fields.";
}
}
}
}
use of org.graalvm.compiler.nodes.virtual.VirtualObjectNode in project graal by oracle.
the class MonitorEnterNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode alias = tool.getAlias(object());
if (alias instanceof VirtualObjectNode) {
VirtualObjectNode virtual = (VirtualObjectNode) alias;
if (virtual.hasIdentity()) {
tool.addLock(virtual, getMonitorId());
tool.delete();
}
}
}
use of org.graalvm.compiler.nodes.virtual.VirtualObjectNode in project graal by oracle.
the class NewArrayNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode lengthAlias = tool.getAlias(length());
if (lengthAlias.asConstant() != null) {
int constantLength = lengthAlias.asJavaConstant().asInt();
if (constantLength >= 0 && constantLength < tool.getMaximumEntryCount()) {
ValueNode[] state = new ValueNode[constantLength];
ConstantNode defaultForKind = constantLength == 0 ? null : defaultElementValue();
for (int i = 0; i < constantLength; i++) {
state[i] = defaultForKind;
}
VirtualObjectNode virtualObject = createVirtualArrayNode(constantLength);
tool.createVirtualObject(virtualObject, state, Collections.<MonitorIdNode>emptyList(), false);
tool.replaceWithVirtual(virtualObject);
}
}
}
use of org.graalvm.compiler.nodes.virtual.VirtualObjectNode in project graal by oracle.
the class RawMonitorEnterNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode alias = tool.getAlias(object());
if (alias instanceof VirtualObjectNode) {
VirtualObjectNode virtual = (VirtualObjectNode) alias;
if (virtual.hasIdentity()) {
tool.addLock(virtual, getMonitorId());
tool.delete();
}
}
}
use of org.graalvm.compiler.nodes.virtual.VirtualObjectNode in project graal by oracle.
the class StoreIndexedNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode alias = tool.getAlias(array());
if (alias instanceof VirtualObjectNode) {
ValueNode indexValue = tool.getAlias(index());
int idx = indexValue.isConstant() ? indexValue.asJavaConstant().asInt() : -1;
VirtualArrayNode virtual = (VirtualArrayNode) alias;
if (idx >= 0 && idx < virtual.entryCount()) {
ResolvedJavaType componentType = virtual.type().getComponentType();
if (componentType.isPrimitive() || StampTool.isPointerAlwaysNull(value) || componentType.getSuperclass() == null || (StampTool.typeReferenceOrNull(value) != null && componentType.isAssignableFrom(StampTool.typeOrNull(value)))) {
tool.setVirtualEntry(virtual, idx, value());
tool.delete();
}
}
}
}
Aggregations