oop.cpp revision 665
0N/A/*
665N/A * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A * CA 95054 USA or visit www.sun.com if you need additional information or
0N/A * have any questions.
0N/A *
0N/A */
0N/A
0N/A# include "incls/_precompiled.incl"
0N/A# include "incls/_oop.cpp.incl"
0N/A
0N/Abool always_do_update_barrier = false;
0N/A
0N/ABarrierSet* oopDesc::_bs = NULL;
0N/A
0N/A#ifdef PRODUCT
0N/Avoid oopDesc::print_on(outputStream* st) const {}
0N/Avoid oopDesc::print_value_on(outputStream* st) const {}
0N/Avoid oopDesc::print_address_on(outputStream* st) const {}
0N/Achar* oopDesc::print_value_string() { return NULL; }
0N/Achar* oopDesc::print_string() { return NULL; }
0N/Avoid oopDesc::print() {}
0N/Avoid oopDesc::print_value() {}
0N/Avoid oopDesc::print_address() {}
0N/A#else
0N/Avoid oopDesc::print_on(outputStream* st) const {
0N/A if (this == NULL) {
0N/A st->print_cr("NULL");
0N/A } else {
0N/A blueprint()->oop_print_on(oop(this), st);
0N/A }
0N/A}
0N/A
0N/Avoid oopDesc::print_value_on(outputStream* st) const {
0N/A oop obj = oop(this);
0N/A if (this == NULL) {
0N/A st->print("NULL");
0N/A } else if (java_lang_String::is_instance(obj)) {
0N/A java_lang_String::print(obj, st);
0N/A if (PrintOopAddress) print_address_on(st);
0N/A#ifdef ASSERT
0N/A } else if (!Universe::heap()->is_in(obj) || !Universe::heap()->is_in(klass())) {
0N/A st->print("### BAD OOP %p ###", (address)obj);
0N/A#endif
0N/A } else {
0N/A blueprint()->oop_print_value_on(obj, st);
0N/A }
0N/A}
0N/A
0N/Avoid oopDesc::print_address_on(outputStream* st) const {
0N/A if (PrintOopAddress) {
665N/A st->print("{"INTPTR_FORMAT"}", this);
0N/A }
0N/A}
0N/A
0N/Avoid oopDesc::print() { print_on(tty); }
0N/A
0N/Avoid oopDesc::print_value() { print_value_on(tty); }
0N/A
0N/Avoid oopDesc::print_address() { print_address_on(tty); }
0N/A
0N/Achar* oopDesc::print_string() {
0N/A stringStream* st = new stringStream();
0N/A print_on(st);
0N/A return st->as_string();
0N/A}
0N/A
0N/Achar* oopDesc::print_value_string() {
0N/A stringStream* st = new stringStream();
0N/A print_value_on(st);
0N/A return st->as_string();
0N/A}
0N/A
0N/A#endif // PRODUCT
0N/A
0N/Avoid oopDesc::verify_on(outputStream* st) {
0N/A if (this != NULL) {
0N/A blueprint()->oop_verify_on(this, st);
0N/A }
0N/A}
0N/A
0N/A
0N/Avoid oopDesc::verify() {
0N/A verify_on(tty);
0N/A}
0N/A
0N/A
113N/A// XXX verify_old_oop doesn't do anything (should we remove?)
0N/Avoid oopDesc::verify_old_oop(oop* p, bool allow_dirty) {
0N/A blueprint()->oop_verify_old_oop(this, p, allow_dirty);
0N/A}
0N/A
113N/Avoid oopDesc::verify_old_oop(narrowOop* p, bool allow_dirty) {
113N/A blueprint()->oop_verify_old_oop(this, p, allow_dirty);
113N/A}
0N/A
0N/Abool oopDesc::partially_loaded() {
0N/A return blueprint()->oop_partially_loaded(this);
0N/A}
0N/A
0N/A
0N/Avoid oopDesc::set_partially_loaded() {
0N/A blueprint()->oop_set_partially_loaded(this);
0N/A}
0N/A
0N/A
0N/Aintptr_t oopDesc::slow_identity_hash() {
0N/A // slow case; we have to acquire the micro lock in order to locate the header
0N/A ResetNoHandleMark rnm; // Might be called from LEAF/QUICK ENTRY
0N/A HandleMark hm;
0N/A Handle object((oop)this);
0N/A assert(!is_shared_readonly(), "using identity hash on readonly object?");
0N/A return ObjectSynchronizer::identity_hash_value_for(object);
0N/A}
0N/A
0N/AVerifyOopClosure VerifyOopClosure::verify_oop;
113N/A
113N/Avoid VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); }
113N/Avoid VerifyOopClosure::do_oop(narrowOop* p) { VerifyOopClosure::do_oop_work(p); }