55 if (has_monitor()) {
56 // Has an inflated monitor. Must be checked before has_locker().
57 ObjectMonitor* monitor = this->monitor();
58 monitor->set_header(m);
59 return;
60 }
61 if (has_locker()) { // has a stack lock
62 BasicLock* locker = this->locker();
63 locker->set_displaced_header(m);
64 return;
65 }
66 // This should never happen:
67 fatal("bad header=" INTPTR_FORMAT, value());
68 }
69
70 void markWord::print_on(outputStream* st, bool print_monitor_info) const {
71 if (is_marked()) { // last bits = 11
72 st->print(" marked(" INTPTR_FORMAT ")", value());
73 } else if (has_monitor()) { // last bits = 10
74 // have to check has_monitor() before is_locked()
75 st->print(" monitor(" INTPTR_FORMAT ")=", value());
76 if (print_monitor_info && !UseObjectMonitorTable) {
77 ObjectMonitor* mon = monitor();
78 if (mon == nullptr) {
79 st->print("null (this should never be seen!)");
80 } else {
81 mon->print_on(st);
82 }
83 }
84 } else if (is_locked()) { // last bits != 01 => 00
85 // thin locked
86 st->print(" locked(" INTPTR_FORMAT ")", value());
87 } else {
88 st->print(" mark(");
89 if (is_unlocked()) { // last bits = 01
90 st->print("is_unlocked");
91 if (has_no_hash()) {
92 st->print(" no_hash");
93 } else {
94 st->print(" hash=" INTPTR_FORMAT, hash());
95 }
96 } else {
97 st->print("??");
98 }
99 st->print(" age=%d)", age());
100 }
101 }
|
55 if (has_monitor()) {
56 // Has an inflated monitor. Must be checked before has_locker().
57 ObjectMonitor* monitor = this->monitor();
58 monitor->set_header(m);
59 return;
60 }
61 if (has_locker()) { // has a stack lock
62 BasicLock* locker = this->locker();
63 locker->set_displaced_header(m);
64 return;
65 }
66 // This should never happen:
67 fatal("bad header=" INTPTR_FORMAT, value());
68 }
69
70 void markWord::print_on(outputStream* st, bool print_monitor_info) const {
71 if (is_marked()) { // last bits = 11
72 st->print(" marked(" INTPTR_FORMAT ")", value());
73 } else if (has_monitor()) { // last bits = 10
74 // have to check has_monitor() before is_locked()
75 // Valhalla: inline types/arrays can't be monitored
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 // Valhalla: inline types can not possess an object monitor
88 st->print(" locked(" INTPTR_FORMAT ")", value());
89 } else {
90 st->print(" mark(");
91 if (is_unlocked()) { // last bits = 01
92 st->print("is_unlocked");
93 if (is_inline_type()) {
94 st->print(" inline_type");
95 if (is_larval_state()) {
96 st->print("=larval");
97 }
98 }
99 if (has_no_hash()) {
100 st->print(" no_hash");
101 } else {
102 st->print(" hash=" INTPTR_FORMAT, hash());
103 }
104 #ifdef _LP64 // 64 bit encodings have array information
105 // flat or null-free do not imply each other
106 bool flat = is_flat_array();
107 bool null_free = is_null_free_array();
108 if (flat && !null_free) {
109 st->print(" flat_array");
110 } else if (!flat && null_free) {
111 st->print(" null_free_array");
112 } else if (flat && null_free) {
113 st->print(" flat_null_free_array");
114 }
115 #endif
116 } else {
117 st->print("??");
118 }
119 st->print(" age=%d)", age());
120 }
121 }
122
123 markWord markWord::flat_array_prototype(LayoutKind lk) {
124 switch(lk) {
125 case LayoutKind::ATOMIC_FLAT:
126 case LayoutKind::NON_ATOMIC_FLAT:
127 return markWord(null_free_flat_array_pattern);
128 break;
129 case LayoutKind::NULLABLE_ATOMIC_FLAT:
130 return markWord(nullable_flat_array_pattern);
131 break;
132 default:
133 ShouldNotReachHere();
134 }
135 }
|