< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/extended/RawLoadNode.java

Print this page
rev 52509 : [mq]: graal


  82         super(TYPE, stamp, object, offset, accessKind, locationIdentity, false);
  83     }
  84 
  85     protected RawLoadNode(NodeClass<? extends RawLoadNode> c, ValueNode object, ValueNode offset, JavaKind accessKind, LocationIdentity locationIdentity) {
  86         super(c, StampFactory.forKind(accessKind.getStackKind()), object, offset, accessKind, locationIdentity, false);
  87     }
  88 
  89     @Override
  90     public void lower(LoweringTool tool) {
  91         tool.getLowerer().lower(this, tool);
  92     }
  93 
  94     @Override
  95     public void virtualize(VirtualizerTool tool) {
  96         ValueNode alias = tool.getAlias(object());
  97         if (alias instanceof VirtualObjectNode) {
  98             VirtualObjectNode virtual = (VirtualObjectNode) alias;
  99             ValueNode offsetValue = tool.getAlias(offset());
 100             if (offsetValue.isConstant()) {
 101                 long off = offsetValue.asJavaConstant().asLong();
 102                 int entryIndex = virtual.entryIndexForOffset(tool.getArrayOffsetProvider(), off, accessKind());
 103 
 104                 if (entryIndex != -1) {
 105                     ValueNode entry = tool.getEntry(virtual, entryIndex);
 106                     JavaKind entryKind = virtual.entryKind(entryIndex);
 107                     if (entry.getStackKind() == getStackKind() || entryKind == accessKind()) {
 108 
 109                         if (!(entry.stamp(NodeView.DEFAULT).isCompatible(stamp(NodeView.DEFAULT)))) {
 110                             if (entry.stamp(NodeView.DEFAULT) instanceof PrimitiveStamp && stamp instanceof PrimitiveStamp) {
 111                                 PrimitiveStamp p1 = (PrimitiveStamp) stamp;
 112                                 PrimitiveStamp p2 = (PrimitiveStamp) entry.stamp(NodeView.DEFAULT);
 113                                 int width1 = p1.getBits();
 114                                 int width2 = p2.getBits();
 115                                 if (width1 == width2) {
 116                                     Node replacement = ReinterpretNode.create(p2, entry, NodeView.DEFAULT);
 117                                     tool.replaceWith((ValueNode) replacement);
 118                                     return;
 119                                 } else {
 120                                     // different bit width
 121                                     return;
 122                                 }




  82         super(TYPE, stamp, object, offset, accessKind, locationIdentity, false);
  83     }
  84 
  85     protected RawLoadNode(NodeClass<? extends RawLoadNode> c, ValueNode object, ValueNode offset, JavaKind accessKind, LocationIdentity locationIdentity) {
  86         super(c, StampFactory.forKind(accessKind.getStackKind()), object, offset, accessKind, locationIdentity, false);
  87     }
  88 
  89     @Override
  90     public void lower(LoweringTool tool) {
  91         tool.getLowerer().lower(this, tool);
  92     }
  93 
  94     @Override
  95     public void virtualize(VirtualizerTool tool) {
  96         ValueNode alias = tool.getAlias(object());
  97         if (alias instanceof VirtualObjectNode) {
  98             VirtualObjectNode virtual = (VirtualObjectNode) alias;
  99             ValueNode offsetValue = tool.getAlias(offset());
 100             if (offsetValue.isConstant()) {
 101                 long off = offsetValue.asJavaConstant().asLong();
 102                 int entryIndex = virtual.entryIndexForOffset(tool.getMetaAccess(), off, accessKind());
 103 
 104                 if (entryIndex != -1) {
 105                     ValueNode entry = tool.getEntry(virtual, entryIndex);
 106                     JavaKind entryKind = virtual.entryKind(entryIndex);
 107                     if (entry.getStackKind() == getStackKind() || entryKind == accessKind()) {
 108 
 109                         if (!(entry.stamp(NodeView.DEFAULT).isCompatible(stamp(NodeView.DEFAULT)))) {
 110                             if (entry.stamp(NodeView.DEFAULT) instanceof PrimitiveStamp && stamp instanceof PrimitiveStamp) {
 111                                 PrimitiveStamp p1 = (PrimitiveStamp) stamp;
 112                                 PrimitiveStamp p2 = (PrimitiveStamp) entry.stamp(NodeView.DEFAULT);
 113                                 int width1 = p1.getBits();
 114                                 int width2 = p2.getBits();
 115                                 if (width1 == width2) {
 116                                     Node replacement = ReinterpretNode.create(p2, entry, NodeView.DEFAULT);
 117                                     tool.replaceWith((ValueNode) replacement);
 118                                     return;
 119                                 } else {
 120                                     // different bit width
 121                                     return;
 122                                 }


< prev index next >