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.core.common.type; 26 27 import jdk.vm.ci.meta.Constant; 28 import jdk.vm.ci.meta.JavaConstant; 29 import jdk.vm.ci.meta.JavaKind; 30 31 /** 32 * Abstract base class of all pointer types. 33 */ 34 public abstract class AbstractPointerStamp extends Stamp { 35 36 private final boolean nonNull; 37 private final boolean alwaysNull; 38 39 protected AbstractPointerStamp(boolean nonNull, boolean alwaysNull) { 40 this.nonNull = nonNull; 41 this.alwaysNull = alwaysNull; 42 } 43 44 public boolean nonNull() { 45 assert !this.isEmpty() || nonNull; 46 return nonNull; 47 } 48 49 public boolean alwaysNull() { 50 return alwaysNull; 51 } 52 53 protected abstract AbstractPointerStamp copyWith(boolean newNonNull, boolean newAlwaysNull); 54 55 @Override 56 public int hashCode() { 57 final int prime = 31; 58 int result = 1; | 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.core.common.type; 26 27 import jdk.vm.ci.meta.Constant; 28 import jdk.vm.ci.meta.JavaConstant; 29 import jdk.vm.ci.meta.JavaKind; 30 31 /** 32 * Abstract base class of all pointer types. 33 */ 34 public abstract class AbstractPointerStamp extends Stamp { 35 36 private final boolean nonNull; 37 private final boolean alwaysNull; 38 39 @Override 40 public void accept(Visitor v) { 41 v.visitBoolean(nonNull); 42 v.visitBoolean(alwaysNull); 43 } 44 45 protected AbstractPointerStamp(boolean nonNull, boolean alwaysNull) { 46 this.nonNull = nonNull; 47 this.alwaysNull = alwaysNull; 48 } 49 50 public boolean nonNull() { 51 assert !this.isEmpty() || nonNull; 52 return nonNull; 53 } 54 55 public boolean alwaysNull() { 56 return alwaysNull; 57 } 58 59 protected abstract AbstractPointerStamp copyWith(boolean newNonNull, boolean newAlwaysNull); 60 61 @Override 62 public int hashCode() { 63 final int prime = 31; 64 int result = 1; |