< prev index next >

src/hotspot/share/oops/oop.cpp

Print this page




   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/altHashing.hpp"
  27 #include "classfile/javaClasses.inline.hpp"
  28 #include "memory/metaspaceShared.inline.hpp"
  29 #include "memory/resourceArea.hpp"
  30 #include "oops/access.inline.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "oops/verifyOopClosure.hpp"
  33 #include "runtime/handles.inline.hpp"
  34 #include "runtime/thread.inline.hpp"
  35 #include "utilities/copy.hpp"
  36 
  37 bool always_do_update_barrier = false;
  38 
  39 void oopDesc::print_on(outputStream* st) const {
  40   klass()->oop_print_on(oop(this), st);
  41 }
  42 
  43 void oopDesc::print_address_on(outputStream* st) const {
  44   st->print("{" INTPTR_FORMAT "}", p2i(this));
  45 
  46 }
  47 
  48 void oopDesc::print()         { print_on(tty);         }


 127   }
 128   if (obj->mark_raw() != NULL) {
 129     return true;
 130   }
 131   return !SafepointSynchronize::is_at_safepoint();
 132 }
 133 
 134 // used only for asserts and guarantees
 135 bool oopDesc::is_oop_or_null(oop obj, bool ignore_mark_word) {
 136   return obj == NULL ? true : is_oop(obj, ignore_mark_word);
 137 }
 138 
 139 #ifndef PRODUCT
 140 // used only for asserts
 141 bool oopDesc::is_unlocked_oop() const {
 142   if (!Universe::heap()->is_in_reserved(this)) return false;
 143   return mark()->is_unlocked();
 144 }
 145 
 146 #if INCLUDE_CDS_JAVA_HEAP
 147 bool oopDesc::is_archive_object(oop p) {
 148   return MetaspaceShared::is_archive_object(p);
 149 }
 150 #endif
 151 #endif // PRODUCT
 152 
 153 VerifyOopClosure VerifyOopClosure::verify_oop;
 154 
 155 template <class T> void VerifyOopClosure::do_oop_work(T* p) {
 156   oop obj = RawAccess<>::oop_load(p);
 157   guarantee(oopDesc::is_oop_or_null(obj), "invalid oop: " INTPTR_FORMAT, p2i((oopDesc*) obj));
 158 }
 159 
 160 void VerifyOopClosure::do_oop(oop* p)       { VerifyOopClosure::do_oop_work(p); }
 161 void VerifyOopClosure::do_oop(narrowOop* p) { VerifyOopClosure::do_oop_work(p); }
 162 
 163 // type test operations that doesn't require inclusion of oop.inline.hpp.
 164 bool oopDesc::is_instance_noinline()          const { return is_instance();            }
 165 bool oopDesc::is_array_noinline()             const { return is_array();               }
 166 bool oopDesc::is_objArray_noinline()          const { return is_objArray();            }
 167 bool oopDesc::is_typeArray_noinline()         const { return is_typeArray();           }
 168 




   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/altHashing.hpp"
  27 #include "classfile/javaClasses.inline.hpp"
  28 #include "memory/heapShared.inline.hpp"
  29 #include "memory/resourceArea.hpp"
  30 #include "oops/access.inline.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "oops/verifyOopClosure.hpp"
  33 #include "runtime/handles.inline.hpp"
  34 #include "runtime/thread.inline.hpp"
  35 #include "utilities/copy.hpp"
  36 
  37 bool always_do_update_barrier = false;
  38 
  39 void oopDesc::print_on(outputStream* st) const {
  40   klass()->oop_print_on(oop(this), st);
  41 }
  42 
  43 void oopDesc::print_address_on(outputStream* st) const {
  44   st->print("{" INTPTR_FORMAT "}", p2i(this));
  45 
  46 }
  47 
  48 void oopDesc::print()         { print_on(tty);         }


 127   }
 128   if (obj->mark_raw() != NULL) {
 129     return true;
 130   }
 131   return !SafepointSynchronize::is_at_safepoint();
 132 }
 133 
 134 // used only for asserts and guarantees
 135 bool oopDesc::is_oop_or_null(oop obj, bool ignore_mark_word) {
 136   return obj == NULL ? true : is_oop(obj, ignore_mark_word);
 137 }
 138 
 139 #ifndef PRODUCT
 140 // used only for asserts
 141 bool oopDesc::is_unlocked_oop() const {
 142   if (!Universe::heap()->is_in_reserved(this)) return false;
 143   return mark()->is_unlocked();
 144 }
 145 
 146 #if INCLUDE_CDS_JAVA_HEAP
 147 bool oopDesc::is_archived_object(oop p) {
 148   return HeapShared::is_archived_object(p);
 149 }
 150 #endif
 151 #endif // PRODUCT
 152 
 153 VerifyOopClosure VerifyOopClosure::verify_oop;
 154 
 155 template <class T> void VerifyOopClosure::do_oop_work(T* p) {
 156   oop obj = RawAccess<>::oop_load(p);
 157   guarantee(oopDesc::is_oop_or_null(obj), "invalid oop: " INTPTR_FORMAT, p2i((oopDesc*) obj));
 158 }
 159 
 160 void VerifyOopClosure::do_oop(oop* p)       { VerifyOopClosure::do_oop_work(p); }
 161 void VerifyOopClosure::do_oop(narrowOop* p) { VerifyOopClosure::do_oop_work(p); }
 162 
 163 // type test operations that doesn't require inclusion of oop.inline.hpp.
 164 bool oopDesc::is_instance_noinline()          const { return is_instance();            }
 165 bool oopDesc::is_array_noinline()             const { return is_array();               }
 166 bool oopDesc::is_objArray_noinline()          const { return is_objArray();            }
 167 bool oopDesc::is_typeArray_noinline()         const { return is_typeArray();           }
 168 


< prev index next >