< prev index next >

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

Print this page
rev 52509 : [mq]: graal


  72             return synonym;
  73         }
  74         return new UnboxNode(value, boxingKind);
  75     }
  76 
  77     public JavaKind getBoxingKind() {
  78         return boxingKind;
  79     }
  80 
  81     @Override
  82     public void lower(LoweringTool tool) {
  83         tool.getLowerer().lower(this, tool);
  84     }
  85 
  86     @Override
  87     public void virtualize(VirtualizerTool tool) {
  88         ValueNode alias = tool.getAlias(getValue());
  89         if (alias instanceof VirtualObjectNode) {
  90             VirtualObjectNode virtual = (VirtualObjectNode) alias;
  91             ResolvedJavaType objectType = virtual.type();
  92             ResolvedJavaType expectedType = tool.getMetaAccessProvider().lookupJavaType(boxingKind.toBoxedJavaClass());
  93             if (objectType.equals(expectedType)) {
  94                 tool.replaceWithValue(tool.getEntry(virtual, 0));
  95             }
  96         }
  97     }
  98 
  99     @Override
 100     public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) {
 101         if (tool.allUsagesAvailable() && hasNoUsages() && StampTool.isPointerNonNull(forValue)) {
 102             return null;
 103         }
 104         ValueNode synonym = findSynonym(tool.getMetaAccess(), tool.getConstantReflection(), forValue, boxingKind);
 105         if (synonym != null) {
 106             return synonym;
 107         }
 108         return this;
 109     }
 110 
 111     private static ValueNode findSynonym(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, ValueNode forValue, JavaKind boxingKind) {
 112         if (forValue.isConstant()) {


  72             return synonym;
  73         }
  74         return new UnboxNode(value, boxingKind);
  75     }
  76 
  77     public JavaKind getBoxingKind() {
  78         return boxingKind;
  79     }
  80 
  81     @Override
  82     public void lower(LoweringTool tool) {
  83         tool.getLowerer().lower(this, tool);
  84     }
  85 
  86     @Override
  87     public void virtualize(VirtualizerTool tool) {
  88         ValueNode alias = tool.getAlias(getValue());
  89         if (alias instanceof VirtualObjectNode) {
  90             VirtualObjectNode virtual = (VirtualObjectNode) alias;
  91             ResolvedJavaType objectType = virtual.type();
  92             ResolvedJavaType expectedType = tool.getMetaAccess().lookupJavaType(boxingKind.toBoxedJavaClass());
  93             if (objectType.equals(expectedType)) {
  94                 tool.replaceWithValue(tool.getEntry(virtual, 0));
  95             }
  96         }
  97     }
  98 
  99     @Override
 100     public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) {
 101         if (tool.allUsagesAvailable() && hasNoUsages() && StampTool.isPointerNonNull(forValue)) {
 102             return null;
 103         }
 104         ValueNode synonym = findSynonym(tool.getMetaAccess(), tool.getConstantReflection(), forValue, boxingKind);
 105         if (synonym != null) {
 106             return synonym;
 107         }
 108         return this;
 109     }
 110 
 111     private static ValueNode findSynonym(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, ValueNode forValue, JavaKind boxingKind) {
 112         if (forValue.isConstant()) {
< prev index next >