< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/AbstractPointerStamp.java

Print this page
rev 56282 : [mq]: graal
   1 /*
   2  * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  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  */


  95     @Override
  96     public Stamp unrestricted() {
  97         return copyWith(false, false);
  98     }
  99 
 100     public static Stamp pointerNonNull(Stamp stamp) {
 101         AbstractPointerStamp pointer = (AbstractPointerStamp) stamp;
 102         return pointer.asNonNull();
 103     }
 104 
 105     public static Stamp pointerMaybeNull(Stamp stamp) {
 106         AbstractPointerStamp pointer = (AbstractPointerStamp) stamp;
 107         return pointer.asMaybeNull();
 108     }
 109 
 110     public static Stamp pointerAlwaysNull(Stamp stamp) {
 111         AbstractPointerStamp pointer = (AbstractPointerStamp) stamp;
 112         return pointer.asAlwaysNull();
 113     }
 114 
 115     public Stamp asNonNull() {
 116         if (isEmpty()) {
 117             return this;
 118         }
 119         return copyWith(true, false);
 120     }
 121 
 122     public Stamp asMaybeNull() {
 123         if (isEmpty()) {
 124             return this;
 125         }
 126         return copyWith(false, false);
 127     }
 128 
 129     public Stamp asAlwaysNull() {
 130         if (isEmpty()) {
 131             return this;
 132         }
 133         return copyWith(false, true);
 134     }
 135 
 136     @Override
 137     public boolean equals(Object obj) {
 138         if (this == obj) {
 139             return true;
 140         }
 141         if (obj == null || getClass() != obj.getClass()) {
 142             return false;


   1 /*
   2  * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  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  */


  95     @Override
  96     public Stamp unrestricted() {
  97         return copyWith(false, false);
  98     }
  99 
 100     public static Stamp pointerNonNull(Stamp stamp) {
 101         AbstractPointerStamp pointer = (AbstractPointerStamp) stamp;
 102         return pointer.asNonNull();
 103     }
 104 
 105     public static Stamp pointerMaybeNull(Stamp stamp) {
 106         AbstractPointerStamp pointer = (AbstractPointerStamp) stamp;
 107         return pointer.asMaybeNull();
 108     }
 109 
 110     public static Stamp pointerAlwaysNull(Stamp stamp) {
 111         AbstractPointerStamp pointer = (AbstractPointerStamp) stamp;
 112         return pointer.asAlwaysNull();
 113     }
 114 
 115     public AbstractPointerStamp asNonNull() {
 116         if (isEmpty()) {
 117             return this;
 118         }
 119         return copyWith(true, false);
 120     }
 121 
 122     public AbstractPointerStamp asMaybeNull() {
 123         if (isEmpty()) {
 124             return this;
 125         }
 126         return copyWith(false, false);
 127     }
 128 
 129     public Stamp asAlwaysNull() {
 130         if (isEmpty()) {
 131             return this;
 132         }
 133         return copyWith(false, true);
 134     }
 135 
 136     @Override
 137     public boolean equals(Object obj) {
 138         if (this == obj) {
 139             return true;
 140         }
 141         if (obj == null || getClass() != obj.getClass()) {
 142             return false;


< prev index next >