< prev index next >

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

Print this page




  43 
  44 /**
  45  * The {@code NewInstanceNode} represents the allocation of an instance class object.
  46  */
  47 @NodeInfo(nameTemplate = "New {p#instanceClass/s}")
  48 public class NewInstanceNode extends AbstractNewObjectNode implements VirtualizableAllocation {
  49 
  50     public static final NodeClass<NewInstanceNode> TYPE = NodeClass.create(NewInstanceNode.class);
  51     protected final ResolvedJavaType instanceClass;
  52 
  53     public NewInstanceNode(ResolvedJavaType type, boolean fillContents) {
  54         this(TYPE, type, fillContents, null);
  55     }
  56 
  57     public NewInstanceNode(ResolvedJavaType type, boolean fillContents, FrameState stateBefore) {
  58         this(TYPE, type, fillContents, stateBefore);
  59     }
  60 
  61     protected NewInstanceNode(NodeClass<? extends NewInstanceNode> c, ResolvedJavaType type, boolean fillContents, FrameState stateBefore) {
  62         super(c, StampFactory.objectNonNull(TypeReference.createExactTrusted(type)), fillContents, stateBefore);
  63         assert !type.isArray() && !type.isInterface() && !type.isPrimitive() && !type.isAbstract();
  64         this.instanceClass = type;
  65     }
  66 
  67     /**
  68      * Gets the instance class being allocated by this node.
  69      *
  70      * @return the instance class allocated
  71      */
  72     public ResolvedJavaType instanceClass() {
  73         return instanceClass;
  74     }
  75 
  76     @Override
  77     public void virtualize(VirtualizerTool tool) {
  78         /*
  79          * Reference objects can escape into their ReferenceQueue at any safepoint, therefore
  80          * they're excluded from escape analysis.
  81          */
  82         if (!tool.getMetaAccess().lookupJavaType(Reference.class).isAssignableFrom(instanceClass)) {
  83             VirtualInstanceNode virtualObject = createVirtualInstanceNode(true);


  43 
  44 /**
  45  * The {@code NewInstanceNode} represents the allocation of an instance class object.
  46  */
  47 @NodeInfo(nameTemplate = "New {p#instanceClass/s}")
  48 public class NewInstanceNode extends AbstractNewObjectNode implements VirtualizableAllocation {
  49 
  50     public static final NodeClass<NewInstanceNode> TYPE = NodeClass.create(NewInstanceNode.class);
  51     protected final ResolvedJavaType instanceClass;
  52 
  53     public NewInstanceNode(ResolvedJavaType type, boolean fillContents) {
  54         this(TYPE, type, fillContents, null);
  55     }
  56 
  57     public NewInstanceNode(ResolvedJavaType type, boolean fillContents, FrameState stateBefore) {
  58         this(TYPE, type, fillContents, stateBefore);
  59     }
  60 
  61     protected NewInstanceNode(NodeClass<? extends NewInstanceNode> c, ResolvedJavaType type, boolean fillContents, FrameState stateBefore) {
  62         super(c, StampFactory.objectNonNull(TypeReference.createExactTrusted(type)), fillContents, stateBefore);
  63         assert !type.isArray() && !type.isInterface() && !type.isPrimitive() && !type.isAbstract() : type;
  64         this.instanceClass = type;
  65     }
  66 
  67     /**
  68      * Gets the instance class being allocated by this node.
  69      *
  70      * @return the instance class allocated
  71      */
  72     public ResolvedJavaType instanceClass() {
  73         return instanceClass;
  74     }
  75 
  76     @Override
  77     public void virtualize(VirtualizerTool tool) {
  78         /*
  79          * Reference objects can escape into their ReferenceQueue at any safepoint, therefore
  80          * they're excluded from escape analysis.
  81          */
  82         if (!tool.getMetaAccess().lookupJavaType(Reference.class).isAssignableFrom(instanceClass)) {
  83             VirtualInstanceNode virtualObject = createVirtualInstanceNode(true);
< prev index next >