src/share/vm/oops/oop.cpp

Tue, 03 Aug 2010 08:13:38 -0400

author
bobv
date
Tue, 03 Aug 2010 08:13:38 -0400
changeset 2036
126ea7725993
parent 1907
c18cbe5936b8
child 2314
f95d63e2154a
permissions
-rw-r--r--

6953477: Increase portability and flexibility of building Hotspot
Summary: A collection of portability improvements including shared code support for PPC, ARM platforms, software floating point, cross compilation support and improvements in error crash detail.
Reviewed-by: phh, never, coleenp, dholmes

duke@435 1 /*
trims@1907 2 * Copyright (c) 1997, 2009, 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
duke@435 25 # include "incls/_precompiled.incl"
duke@435 26 # include "incls/_oop.cpp.incl"
duke@435 27
duke@435 28 bool always_do_update_barrier = false;
duke@435 29
duke@435 30 BarrierSet* oopDesc::_bs = NULL;
duke@435 31
duke@435 32 void oopDesc::print_on(outputStream* st) const {
duke@435 33 if (this == NULL) {
duke@435 34 st->print_cr("NULL");
duke@435 35 } else {
duke@435 36 blueprint()->oop_print_on(oop(this), st);
duke@435 37 }
duke@435 38 }
duke@435 39
duke@435 40 void oopDesc::print_address_on(outputStream* st) const {
duke@435 41 if (PrintOopAddress) {
jrose@1100 42 st->print("{"INTPTR_FORMAT"}", this);
duke@435 43 }
duke@435 44 }
duke@435 45
duke@435 46 void oopDesc::print() { print_on(tty); }
duke@435 47
duke@435 48 void oopDesc::print_address() { print_address_on(tty); }
duke@435 49
duke@435 50 char* oopDesc::print_string() {
jrose@1590 51 stringStream st;
jrose@1590 52 print_on(&st);
jrose@1590 53 return st.as_string();
jrose@1590 54 }
jrose@1590 55
jrose@1590 56 void oopDesc::print_value() {
jrose@1590 57 print_value_on(tty);
duke@435 58 }
duke@435 59
duke@435 60 char* oopDesc::print_value_string() {
jrose@1590 61 char buf[100];
jrose@1590 62 stringStream st(buf, sizeof(buf));
jrose@1590 63 print_value_on(&st);
jrose@1590 64 return st.as_string();
duke@435 65 }
duke@435 66
jrose@1590 67 void oopDesc::print_value_on(outputStream* st) const {
jrose@1590 68 oop obj = oop(this);
jrose@1590 69 if (this == NULL) {
jrose@1590 70 st->print("NULL");
jrose@1590 71 } else if (java_lang_String::is_instance(obj)) {
jrose@1590 72 java_lang_String::print(obj, st);
jrose@1590 73 if (PrintOopAddress) print_address_on(st);
jrose@1590 74 #ifdef ASSERT
jrose@1590 75 } else if (!Universe::heap()->is_in(obj) || !Universe::heap()->is_in(klass())) {
jrose@1590 76 st->print("### BAD OOP %p ###", (address)obj);
jrose@1590 77 #endif //ASSERT
jrose@1590 78 } else {
jrose@1590 79 blueprint()->oop_print_value_on(obj, st);
jrose@1590 80 }
jrose@1590 81 }
jrose@1590 82
duke@435 83
duke@435 84 void oopDesc::verify_on(outputStream* st) {
duke@435 85 if (this != NULL) {
duke@435 86 blueprint()->oop_verify_on(this, st);
duke@435 87 }
duke@435 88 }
duke@435 89
duke@435 90
duke@435 91 void oopDesc::verify() {
duke@435 92 verify_on(tty);
duke@435 93 }
duke@435 94
duke@435 95
coleenp@548 96 // XXX verify_old_oop doesn't do anything (should we remove?)
duke@435 97 void oopDesc::verify_old_oop(oop* p, bool allow_dirty) {
duke@435 98 blueprint()->oop_verify_old_oop(this, p, allow_dirty);
duke@435 99 }
duke@435 100
coleenp@548 101 void oopDesc::verify_old_oop(narrowOop* p, bool allow_dirty) {
coleenp@548 102 blueprint()->oop_verify_old_oop(this, p, allow_dirty);
coleenp@548 103 }
duke@435 104
duke@435 105 bool oopDesc::partially_loaded() {
duke@435 106 return blueprint()->oop_partially_loaded(this);
duke@435 107 }
duke@435 108
duke@435 109
duke@435 110 void oopDesc::set_partially_loaded() {
duke@435 111 blueprint()->oop_set_partially_loaded(this);
duke@435 112 }
duke@435 113
duke@435 114
duke@435 115 intptr_t oopDesc::slow_identity_hash() {
duke@435 116 // slow case; we have to acquire the micro lock in order to locate the header
duke@435 117 ResetNoHandleMark rnm; // Might be called from LEAF/QUICK ENTRY
duke@435 118 HandleMark hm;
duke@435 119 Handle object((oop)this);
duke@435 120 assert(!is_shared_readonly(), "using identity hash on readonly object?");
duke@435 121 return ObjectSynchronizer::identity_hash_value_for(object);
duke@435 122 }
duke@435 123
duke@435 124 VerifyOopClosure VerifyOopClosure::verify_oop;
coleenp@548 125
coleenp@548 126 void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); }
coleenp@548 127 void VerifyOopClosure::do_oop(narrowOop* p) { VerifyOopClosure::do_oop_work(p); }

mercurial