src/share/vm/oops/oop.cpp

Sun, 25 Sep 2011 16:03:29 -0700

author
never
date
Sun, 25 Sep 2011 16:03:29 -0700
changeset 3156
f08d439fab8c
parent 2314
f95d63e2154a
child 3711
b632e80fc9dc
permissions
-rw-r--r--

7089790: integrate bsd-port changes
Reviewed-by: kvn, twisti, jrose
Contributed-by: Kurt Miller <kurt@intricatesoftware.com>, Greg Lewis <glewis@eyesbeyond.com>, Jung-uk Kim <jkim@freebsd.org>, Christos Zoulas <christos@zoulas.com>, Landon Fuller <landonf@plausible.coop>, The FreeBSD Foundation <board@freebsdfoundation.org>, Michael Franz <mvfranz@gmail.com>, Roger Hoover <rhoover@apple.com>, Alexander Strange <astrange@apple.com>

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "classfile/javaClasses.hpp"
stefank@2314 27 #include "oops/oop.inline.hpp"
stefank@2314 28 #include "runtime/handles.inline.hpp"
stefank@2314 29 #include "utilities/copy.hpp"
stefank@2314 30 #ifdef TARGET_OS_FAMILY_linux
stefank@2314 31 # include "thread_linux.inline.hpp"
stefank@2314 32 #endif
stefank@2314 33 #ifdef TARGET_OS_FAMILY_solaris
stefank@2314 34 # include "thread_solaris.inline.hpp"
stefank@2314 35 #endif
stefank@2314 36 #ifdef TARGET_OS_FAMILY_windows
stefank@2314 37 # include "thread_windows.inline.hpp"
stefank@2314 38 #endif
never@3156 39 #ifdef TARGET_OS_FAMILY_bsd
never@3156 40 # include "thread_bsd.inline.hpp"
never@3156 41 #endif
duke@435 42
duke@435 43 bool always_do_update_barrier = false;
duke@435 44
duke@435 45 BarrierSet* oopDesc::_bs = NULL;
duke@435 46
duke@435 47 void oopDesc::print_on(outputStream* st) const {
duke@435 48 if (this == NULL) {
duke@435 49 st->print_cr("NULL");
duke@435 50 } else {
duke@435 51 blueprint()->oop_print_on(oop(this), st);
duke@435 52 }
duke@435 53 }
duke@435 54
duke@435 55 void oopDesc::print_address_on(outputStream* st) const {
duke@435 56 if (PrintOopAddress) {
jrose@1100 57 st->print("{"INTPTR_FORMAT"}", this);
duke@435 58 }
duke@435 59 }
duke@435 60
duke@435 61 void oopDesc::print() { print_on(tty); }
duke@435 62
duke@435 63 void oopDesc::print_address() { print_address_on(tty); }
duke@435 64
duke@435 65 char* oopDesc::print_string() {
jrose@1590 66 stringStream st;
jrose@1590 67 print_on(&st);
jrose@1590 68 return st.as_string();
jrose@1590 69 }
jrose@1590 70
jrose@1590 71 void oopDesc::print_value() {
jrose@1590 72 print_value_on(tty);
duke@435 73 }
duke@435 74
duke@435 75 char* oopDesc::print_value_string() {
jrose@1590 76 char buf[100];
jrose@1590 77 stringStream st(buf, sizeof(buf));
jrose@1590 78 print_value_on(&st);
jrose@1590 79 return st.as_string();
duke@435 80 }
duke@435 81
jrose@1590 82 void oopDesc::print_value_on(outputStream* st) const {
jrose@1590 83 oop obj = oop(this);
jrose@1590 84 if (this == NULL) {
jrose@1590 85 st->print("NULL");
jrose@1590 86 } else if (java_lang_String::is_instance(obj)) {
jrose@1590 87 java_lang_String::print(obj, st);
jrose@1590 88 if (PrintOopAddress) print_address_on(st);
jrose@1590 89 #ifdef ASSERT
jrose@1590 90 } else if (!Universe::heap()->is_in(obj) || !Universe::heap()->is_in(klass())) {
jrose@1590 91 st->print("### BAD OOP %p ###", (address)obj);
jrose@1590 92 #endif //ASSERT
jrose@1590 93 } else {
jrose@1590 94 blueprint()->oop_print_value_on(obj, st);
jrose@1590 95 }
jrose@1590 96 }
jrose@1590 97
duke@435 98
duke@435 99 void oopDesc::verify_on(outputStream* st) {
duke@435 100 if (this != NULL) {
duke@435 101 blueprint()->oop_verify_on(this, st);
duke@435 102 }
duke@435 103 }
duke@435 104
duke@435 105
duke@435 106 void oopDesc::verify() {
duke@435 107 verify_on(tty);
duke@435 108 }
duke@435 109
duke@435 110
coleenp@548 111 // XXX verify_old_oop doesn't do anything (should we remove?)
duke@435 112 void oopDesc::verify_old_oop(oop* p, bool allow_dirty) {
duke@435 113 blueprint()->oop_verify_old_oop(this, p, allow_dirty);
duke@435 114 }
duke@435 115
coleenp@548 116 void oopDesc::verify_old_oop(narrowOop* p, bool allow_dirty) {
coleenp@548 117 blueprint()->oop_verify_old_oop(this, p, allow_dirty);
coleenp@548 118 }
duke@435 119
duke@435 120 bool oopDesc::partially_loaded() {
duke@435 121 return blueprint()->oop_partially_loaded(this);
duke@435 122 }
duke@435 123
duke@435 124
duke@435 125 void oopDesc::set_partially_loaded() {
duke@435 126 blueprint()->oop_set_partially_loaded(this);
duke@435 127 }
duke@435 128
duke@435 129
duke@435 130 intptr_t oopDesc::slow_identity_hash() {
duke@435 131 // slow case; we have to acquire the micro lock in order to locate the header
duke@435 132 ResetNoHandleMark rnm; // Might be called from LEAF/QUICK ENTRY
duke@435 133 HandleMark hm;
duke@435 134 Handle object((oop)this);
duke@435 135 assert(!is_shared_readonly(), "using identity hash on readonly object?");
duke@435 136 return ObjectSynchronizer::identity_hash_value_for(object);
duke@435 137 }
duke@435 138
duke@435 139 VerifyOopClosure VerifyOopClosure::verify_oop;
coleenp@548 140
coleenp@548 141 void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); }
coleenp@548 142 void VerifyOopClosure::do_oop(narrowOop* p) { VerifyOopClosure::do_oop_work(p); }

mercurial