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 "oops/markWord.hpp"
27 #include "runtime/basicLock.inline.hpp"
28 #include "runtime/javaThread.hpp"
29 #include "runtime/objectMonitor.inline.hpp"
30 #include "utilities/ostream.hpp"
31
32 #ifdef _LP64
33 STATIC_ASSERT(markWord::klass_shift + markWord::klass_bits == 64);
34 // The hash (preceding klass bits) shall be a direct neighbor but not interleave
35 STATIC_ASSERT(markWord::klass_shift == markWord::hash_bits + markWord::hash_shift);
36 #endif
37
38 markWord markWord::displaced_mark_helper() const {
39 assert(has_displaced_mark_helper(), "check");
40 if (has_monitor()) {
41 // Has an inflated monitor. Must be checked before has_locker().
42 ObjectMonitor* monitor = this->monitor();
43 return monitor->header();
44 }
45 if (has_locker()) { // has a stack lock
46 BasicLock* locker = this->locker();
47 return locker->displaced_header();
48 }
49 // This should never happen:
50 fatal("bad header=" INTPTR_FORMAT, value());
51 return markWord(value());
52 }
53
54 void markWord::set_displaced_mark_helper(markWord m) const {
55 assert(has_displaced_mark_helper(), "check");
74 } else if (has_monitor()) { // last bits = 10
75 // have to check has_monitor() before is_locked()
76 st->print(" monitor(" INTPTR_FORMAT ")=", value());
77 if (print_monitor_info && !UseObjectMonitorTable) {
78 ObjectMonitor* mon = monitor();
79 if (mon == nullptr) {
80 st->print("null (this should never be seen!)");
81 } else {
82 mon->print_on(st);
83 }
84 }
85 } else if (is_locked()) { // last bits != 01 => 00
86 // thin locked
87 st->print(" locked(" INTPTR_FORMAT ")", value());
88 } else {
89 st->print(" mark(");
90 if (is_unlocked()) { // last bits = 01
91 st->print("is_unlocked");
92 if (has_no_hash()) {
93 st->print(" no_hash");
94 } else {
95 st->print(" hash=" INTPTR_FORMAT, hash());
96 }
97 } else {
98 st->print("??");
99 }
100 st->print(" age=%d)", age());
101 }
102 }
|
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 "oops/markWord.hpp"
27 #include "runtime/basicLock.inline.hpp"
28 #include "runtime/javaThread.hpp"
29 #include "runtime/objectMonitor.inline.hpp"
30 #include "utilities/ostream.hpp"
31
32 #ifdef _LP64
33 STATIC_ASSERT(markWord::klass_shift + markWord::klass_bits == 32);
34 // The hash (preceding klass bits) shall be a direct neighbor but not interleave
35 STATIC_ASSERT(markWord::klass_shift == markWord::hashctrl_bits + markWord::hashctrl_shift);
36 #endif
37
38 markWord markWord::displaced_mark_helper() const {
39 assert(has_displaced_mark_helper(), "check");
40 if (has_monitor()) {
41 // Has an inflated monitor. Must be checked before has_locker().
42 ObjectMonitor* monitor = this->monitor();
43 return monitor->header();
44 }
45 if (has_locker()) { // has a stack lock
46 BasicLock* locker = this->locker();
47 return locker->displaced_header();
48 }
49 // This should never happen:
50 fatal("bad header=" INTPTR_FORMAT, value());
51 return markWord(value());
52 }
53
54 void markWord::set_displaced_mark_helper(markWord m) const {
55 assert(has_displaced_mark_helper(), "check");
74 } else if (has_monitor()) { // last bits = 10
75 // have to check has_monitor() before is_locked()
76 st->print(" monitor(" INTPTR_FORMAT ")=", value());
77 if (print_monitor_info && !UseObjectMonitorTable) {
78 ObjectMonitor* mon = monitor();
79 if (mon == nullptr) {
80 st->print("null (this should never be seen!)");
81 } else {
82 mon->print_on(st);
83 }
84 }
85 } else if (is_locked()) { // last bits != 01 => 00
86 // thin locked
87 st->print(" locked(" INTPTR_FORMAT ")", value());
88 } else {
89 st->print(" mark(");
90 if (is_unlocked()) { // last bits = 01
91 st->print("is_unlocked");
92 if (has_no_hash()) {
93 st->print(" no_hash");
94 } else if (UseCompactObjectHeaders) {
95 st->print(" hash is-hashed=%s is-copied=%s", BOOL_TO_STR(is_hashed_not_expanded()), BOOL_TO_STR(
96 is_hashed_expanded()));
97 } else {
98 st->print(" hash=" INTPTR_FORMAT, hash());
99 }
100 } else {
101 st->print("??");
102 }
103 st->print(" age=%d)", age());
104 }
105 }
|