use of org.graalvm.compiler.nodes.virtual.VirtualObjectNode in project graal by oracle.
the class GetClassNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode alias = tool.getAlias(getObject());
if (alias instanceof VirtualObjectNode) {
VirtualObjectNode virtual = (VirtualObjectNode) alias;
Constant javaClass = tool.getConstantReflectionProvider().asJavaClass(virtual.type());
tool.replaceWithValue(ConstantNode.forConstant(stamp(NodeView.DEFAULT), javaClass, tool.getMetaAccessProvider(), graph()));
}
}
use of org.graalvm.compiler.nodes.virtual.VirtualObjectNode in project graal by oracle.
the class MonitorExitNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode alias = tool.getAlias(object());
if (alias instanceof VirtualObjectNode) {
VirtualObjectNode virtual = (VirtualObjectNode) alias;
if (virtual.hasIdentity()) {
MonitorIdNode removedLock = tool.removeLock(virtual);
assert removedLock == getMonitorId() : "mismatch at " + this + ": " + removedLock + " vs. " + getMonitorId();
tool.delete();
}
}
}
use of org.graalvm.compiler.nodes.virtual.VirtualObjectNode in project graal by oracle.
the class StoreFieldNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode alias = tool.getAlias(object());
if (alias instanceof VirtualObjectNode) {
VirtualInstanceNode virtual = (VirtualInstanceNode) alias;
int fieldIndex = virtual.fieldIndex(field());
if (fieldIndex != -1) {
tool.setVirtualEntry(virtual, fieldIndex, value());
tool.delete();
}
}
}
use of org.graalvm.compiler.nodes.virtual.VirtualObjectNode in project graal by oracle.
the class RawLoadNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode alias = tool.getAlias(object());
if (alias instanceof VirtualObjectNode) {
VirtualObjectNode virtual = (VirtualObjectNode) alias;
ValueNode offsetValue = tool.getAlias(offset());
if (offsetValue.isConstant()) {
long off = offsetValue.asJavaConstant().asLong();
int entryIndex = virtual.entryIndexForOffset(tool.getArrayOffsetProvider(), off, accessKind());
if (entryIndex != -1) {
ValueNode entry = tool.getEntry(virtual, entryIndex);
JavaKind entryKind = virtual.entryKind(entryIndex);
if (entry.getStackKind() == getStackKind() || entryKind == accessKind()) {
if (!(entry.stamp(NodeView.DEFAULT).isCompatible(stamp(NodeView.DEFAULT)))) {
if (entry.stamp(NodeView.DEFAULT) instanceof PrimitiveStamp && stamp instanceof PrimitiveStamp) {
PrimitiveStamp p1 = (PrimitiveStamp) stamp;
PrimitiveStamp p2 = (PrimitiveStamp) entry.stamp(NodeView.DEFAULT);
int width1 = p1.getBits();
int width2 = p2.getBits();
if (width1 == width2) {
Node replacement = ReinterpretNode.create(p2, entry, NodeView.DEFAULT);
tool.replaceWith((ValueNode) replacement);
return;
} else {
// different bit width
return;
}
} else {
// cannot reinterpret for arbitrary objects
return;
}
}
tool.replaceWith(entry);
}
}
}
}
}
use of org.graalvm.compiler.nodes.virtual.VirtualObjectNode in project graal by oracle.
the class RawStoreNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode alias = tool.getAlias(object());
if (alias instanceof VirtualObjectNode) {
VirtualObjectNode virtual = (VirtualObjectNode) alias;
ValueNode indexValue = tool.getAlias(offset());
if (indexValue.isConstant()) {
long off = indexValue.asJavaConstant().asLong();
int entryIndex = virtual.entryIndexForOffset(tool.getArrayOffsetProvider(), off, accessKind());
if (entryIndex != -1 && tool.setVirtualEntry(virtual, entryIndex, value(), accessKind(), off)) {
tool.delete();
}
}
}
}
Aggregations