< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/virtual/VirtualObjectNode.java

Print this page
rev 52509 : [mq]: graal


  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.nodes.virtual;
  26 
  27 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_0;
  28 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_0;
  29 
  30 import org.graalvm.compiler.core.common.spi.ArrayOffsetProvider;
  31 import org.graalvm.compiler.core.common.type.StampFactory;
  32 import org.graalvm.compiler.core.common.type.TypeReference;
  33 import org.graalvm.compiler.graph.IterableNodeType;
  34 import org.graalvm.compiler.graph.Node;
  35 import org.graalvm.compiler.graph.NodeClass;
  36 import org.graalvm.compiler.nodeinfo.NodeInfo;
  37 import org.graalvm.compiler.nodes.FixedNode;
  38 import org.graalvm.compiler.nodes.ValueNode;
  39 import org.graalvm.compiler.nodes.spi.LIRLowerable;
  40 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
  41 
  42 import jdk.vm.ci.meta.JavaKind;

  43 import jdk.vm.ci.meta.ResolvedJavaType;
  44 
  45 @NodeInfo(cycles = CYCLES_0, size = SIZE_0)
  46 public abstract class VirtualObjectNode extends ValueNode implements LIRLowerable, IterableNodeType {
  47 
  48     public static final NodeClass<VirtualObjectNode> TYPE = NodeClass.create(VirtualObjectNode.class);
  49     protected boolean hasIdentity;
  50     private int objectId = -1;
  51 
  52     protected VirtualObjectNode(NodeClass<? extends VirtualObjectNode> c, ResolvedJavaType type, boolean hasIdentity) {
  53         super(c, StampFactory.objectNonNull(TypeReference.createExactTrusted(type)));
  54         this.hasIdentity = hasIdentity;
  55     }
  56 
  57     public final int getObjectId() {
  58         return objectId;
  59     }
  60 
  61     public final void resetObjectId() {
  62         this.objectId = -1;


  79      */
  80     public abstract ResolvedJavaType type();
  81 
  82     /**
  83      * The number of entries this virtual object has. Either the number of fields or the number of
  84      * array elements.
  85      */
  86     public abstract int entryCount();
  87 
  88     /**
  89      * Returns the name of the entry at the given index. Only used for debugging purposes.
  90      */
  91     public abstract String entryName(int i);
  92 
  93     /**
  94      * If the given index denotes an entry in this virtual object, the index of this entry is
  95      * returned. If no such entry can be found, this method returns -1.
  96      *
  97      * @param constantOffset offset, where the value is placed.
  98      * @param expectedEntryKind Specifies which type is expected at this offset (Is important when
  99      *            doing implicit casts, especially on big endian systems.
 100      */
 101     public abstract int entryIndexForOffset(ArrayOffsetProvider arrayOffsetProvider, long constantOffset, JavaKind expectedEntryKind);
 102 
 103     /**
 104      * Returns the {@link JavaKind} of the entry at the given index.
 105      */
 106     public abstract JavaKind entryKind(int index);
 107 
 108     /**
 109      * Returns an exact duplicate of this virtual object node, which has not been added to the graph
 110      * yet.
 111      */
 112     public abstract VirtualObjectNode duplicate();
 113 
 114     /**
 115      * Specifies whether this virtual object has an object identity. If not, then the result of a
 116      * comparison of two virtual objects is determined by comparing their contents.
 117      */
 118     public boolean hasIdentity() {
 119         return hasIdentity;
 120     }
 121 


  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.nodes.virtual;
  26 
  27 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_0;
  28 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_0;
  29 

  30 import org.graalvm.compiler.core.common.type.StampFactory;
  31 import org.graalvm.compiler.core.common.type.TypeReference;
  32 import org.graalvm.compiler.graph.IterableNodeType;
  33 import org.graalvm.compiler.graph.Node;
  34 import org.graalvm.compiler.graph.NodeClass;
  35 import org.graalvm.compiler.nodeinfo.NodeInfo;
  36 import org.graalvm.compiler.nodes.FixedNode;
  37 import org.graalvm.compiler.nodes.ValueNode;
  38 import org.graalvm.compiler.nodes.spi.LIRLowerable;
  39 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
  40 
  41 import jdk.vm.ci.meta.JavaKind;
  42 import jdk.vm.ci.meta.MetaAccessProvider;
  43 import jdk.vm.ci.meta.ResolvedJavaType;
  44 
  45 @NodeInfo(cycles = CYCLES_0, size = SIZE_0)
  46 public abstract class VirtualObjectNode extends ValueNode implements LIRLowerable, IterableNodeType {
  47 
  48     public static final NodeClass<VirtualObjectNode> TYPE = NodeClass.create(VirtualObjectNode.class);
  49     protected boolean hasIdentity;
  50     private int objectId = -1;
  51 
  52     protected VirtualObjectNode(NodeClass<? extends VirtualObjectNode> c, ResolvedJavaType type, boolean hasIdentity) {
  53         super(c, StampFactory.objectNonNull(TypeReference.createExactTrusted(type)));
  54         this.hasIdentity = hasIdentity;
  55     }
  56 
  57     public final int getObjectId() {
  58         return objectId;
  59     }
  60 
  61     public final void resetObjectId() {
  62         this.objectId = -1;


  79      */
  80     public abstract ResolvedJavaType type();
  81 
  82     /**
  83      * The number of entries this virtual object has. Either the number of fields or the number of
  84      * array elements.
  85      */
  86     public abstract int entryCount();
  87 
  88     /**
  89      * Returns the name of the entry at the given index. Only used for debugging purposes.
  90      */
  91     public abstract String entryName(int i);
  92 
  93     /**
  94      * If the given index denotes an entry in this virtual object, the index of this entry is
  95      * returned. If no such entry can be found, this method returns -1.
  96      *
  97      * @param constantOffset offset, where the value is placed.
  98      * @param expectedEntryKind Specifies which type is expected at this offset (Is important when

  99      */
 100     public abstract int entryIndexForOffset(MetaAccessProvider metaAccess, long constantOffset, JavaKind expectedEntryKind);
 101 
 102     /**
 103      * Returns the {@link JavaKind} of the entry at the given index.
 104      */
 105     public abstract JavaKind entryKind(int index);
 106 
 107     /**
 108      * Returns an exact duplicate of this virtual object node, which has not been added to the graph
 109      * yet.
 110      */
 111     public abstract VirtualObjectNode duplicate();
 112 
 113     /**
 114      * Specifies whether this virtual object has an object identity. If not, then the result of a
 115      * comparison of two virtual objects is determined by comparing their contents.
 116      */
 117     public boolean hasIdentity() {
 118         return hasIdentity;
 119     }
 120 
< prev index next >