annotate src/share/vm/oops/oop.cpp @ 974:26b774d693aa

Merge
author acorn
date Wed, 16 Sep 2009 09:10:57 -0400
parents c89f86385056
children 4e6abf09f540
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
665
c89f86385056 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 196
diff changeset
2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 # include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 # include "incls/_oop.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 bool always_do_update_barrier = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 BarrierSet* oopDesc::_bs = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 #ifdef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
33 void oopDesc::print_on(outputStream* st) const {}
a61af66fc99e Initial load
duke
parents:
diff changeset
34 void oopDesc::print_value_on(outputStream* st) const {}
a61af66fc99e Initial load
duke
parents:
diff changeset
35 void oopDesc::print_address_on(outputStream* st) const {}
a61af66fc99e Initial load
duke
parents:
diff changeset
36 char* oopDesc::print_value_string() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
37 char* oopDesc::print_string() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
38 void oopDesc::print() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
39 void oopDesc::print_value() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
40 void oopDesc::print_address() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
41 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
42 void oopDesc::print_on(outputStream* st) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
43 if (this == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
44 st->print_cr("NULL");
a61af66fc99e Initial load
duke
parents:
diff changeset
45 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
46 blueprint()->oop_print_on(oop(this), st);
a61af66fc99e Initial load
duke
parents:
diff changeset
47 }
a61af66fc99e Initial load
duke
parents:
diff changeset
48 }
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 void oopDesc::print_value_on(outputStream* st) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 oop obj = oop(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
52 if (this == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
53 st->print("NULL");
a61af66fc99e Initial load
duke
parents:
diff changeset
54 } else if (java_lang_String::is_instance(obj)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 java_lang_String::print(obj, st);
a61af66fc99e Initial load
duke
parents:
diff changeset
56 if (PrintOopAddress) print_address_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
57 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
58 } else if (!Universe::heap()->is_in(obj) || !Universe::heap()->is_in(klass())) {
a61af66fc99e Initial load
duke
parents:
diff changeset
59 st->print("### BAD OOP %p ###", (address)obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
60 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
61 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
62 blueprint()->oop_print_value_on(obj, st);
a61af66fc99e Initial load
duke
parents:
diff changeset
63 }
a61af66fc99e Initial load
duke
parents:
diff changeset
64 }
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 void oopDesc::print_address_on(outputStream* st) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
67 if (PrintOopAddress) {
665
c89f86385056 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 196
diff changeset
68 st->print("{"INTPTR_FORMAT"}", this);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
69 }
a61af66fc99e Initial load
duke
parents:
diff changeset
70 }
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 void oopDesc::print() { print_on(tty); }
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 void oopDesc::print_value() { print_value_on(tty); }
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 void oopDesc::print_address() { print_address_on(tty); }
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 char* oopDesc::print_string() {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 stringStream* st = new stringStream();
a61af66fc99e Initial load
duke
parents:
diff changeset
80 print_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 return st->as_string();
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 char* oopDesc::print_value_string() {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 stringStream* st = new stringStream();
a61af66fc99e Initial load
duke
parents:
diff changeset
86 print_value_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
87 return st->as_string();
a61af66fc99e Initial load
duke
parents:
diff changeset
88 }
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 void oopDesc::verify_on(outputStream* st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 if (this != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 blueprint()->oop_verify_on(this, st);
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
a61af66fc99e Initial load
duke
parents:
diff changeset
96 }
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 void oopDesc::verify() {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 verify_on(tty);
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
104 // XXX verify_old_oop doesn't do anything (should we remove?)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
105 void oopDesc::verify_old_oop(oop* p, bool allow_dirty) {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 blueprint()->oop_verify_old_oop(this, p, allow_dirty);
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
109 void oopDesc::verify_old_oop(narrowOop* p, bool allow_dirty) {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
110 blueprint()->oop_verify_old_oop(this, p, allow_dirty);
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
111 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 bool oopDesc::partially_loaded() {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 return blueprint()->oop_partially_loaded(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
115 }
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 void oopDesc::set_partially_loaded() {
a61af66fc99e Initial load
duke
parents:
diff changeset
119 blueprint()->oop_set_partially_loaded(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
120 }
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 intptr_t oopDesc::slow_identity_hash() {
a61af66fc99e Initial load
duke
parents:
diff changeset
124 // slow case; we have to acquire the micro lock in order to locate the header
a61af66fc99e Initial load
duke
parents:
diff changeset
125 ResetNoHandleMark rnm; // Might be called from LEAF/QUICK ENTRY
a61af66fc99e Initial load
duke
parents:
diff changeset
126 HandleMark hm;
a61af66fc99e Initial load
duke
parents:
diff changeset
127 Handle object((oop)this);
a61af66fc99e Initial load
duke
parents:
diff changeset
128 assert(!is_shared_readonly(), "using identity hash on readonly object?");
a61af66fc99e Initial load
duke
parents:
diff changeset
129 return ObjectSynchronizer::identity_hash_value_for(object);
a61af66fc99e Initial load
duke
parents:
diff changeset
130 }
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 VerifyOopClosure VerifyOopClosure::verify_oop;
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
133
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
134 void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
135 void VerifyOopClosure::do_oop(narrowOop* p) { VerifyOopClosure::do_oop_work(p); }