38 assert(has_displaced_mark_helper(), "check");
39 // Make sure we have an inflated monitor.
40 guarantee(has_monitor(), "bad header=" INTPTR_FORMAT, value());
41 ObjectMonitor* monitor = this->monitor();
42 return monitor->header();
43 }
44
45 void markWord::set_displaced_mark_helper(markWord m) const {
46 assert(has_displaced_mark_helper(), "check");
47 // Make sure we have an inflated monitor.
48 guarantee(has_monitor(), "bad header=" INTPTR_FORMAT, value());
49 ObjectMonitor* monitor = this->monitor();
50 monitor->set_header(m);
51 }
52
53 void markWord::print_on(outputStream* st, bool print_monitor_info) const {
54 if (is_marked()) { // last bits = 11
55 st->print(" marked(" INTPTR_FORMAT ")", value());
56 } else if (has_monitor()) { // last bits = 10
57 // have to check has_monitor() before is_locked()
58 st->print(" monitor(" INTPTR_FORMAT ")=", value());
59 if (print_monitor_info && !UseObjectMonitorTable) {
60 ObjectMonitor* mon = monitor();
61 if (mon == nullptr) {
62 st->print("null (this should never be seen!)");
63 } else {
64 mon->print_on(st);
65 }
66 }
67 } else if (is_locked()) { // last bits != 01 => 00
68 // thin locked
69 st->print(" locked(" INTPTR_FORMAT ")", value());
70 } else {
71 st->print(" mark(");
72 if (is_unlocked()) { // last bits = 01
73 st->print("is_unlocked");
74 if (has_no_hash()) {
75 st->print(" no_hash");
76 } else {
77 st->print(" hash=" INTPTR_FORMAT, hash());
78 }
79 } else {
80 st->print("??");
81 }
82 st->print(" age=%d)", age());
83 }
84 }
|
38 assert(has_displaced_mark_helper(), "check");
39 // Make sure we have an inflated monitor.
40 guarantee(has_monitor(), "bad header=" INTPTR_FORMAT, value());
41 ObjectMonitor* monitor = this->monitor();
42 return monitor->header();
43 }
44
45 void markWord::set_displaced_mark_helper(markWord m) const {
46 assert(has_displaced_mark_helper(), "check");
47 // Make sure we have an inflated monitor.
48 guarantee(has_monitor(), "bad header=" INTPTR_FORMAT, value());
49 ObjectMonitor* monitor = this->monitor();
50 monitor->set_header(m);
51 }
52
53 void markWord::print_on(outputStream* st, bool print_monitor_info) const {
54 if (is_marked()) { // last bits = 11
55 st->print(" marked(" INTPTR_FORMAT ")", value());
56 } else if (has_monitor()) { // last bits = 10
57 // have to check has_monitor() before is_locked()
58 // Valhalla: inline types/arrays can't be monitored
59 st->print(" monitor(" INTPTR_FORMAT ")=", value());
60 if (print_monitor_info && !UseObjectMonitorTable) {
61 ObjectMonitor* mon = monitor();
62 if (mon == nullptr) {
63 st->print("null (this should never be seen!)");
64 } else {
65 mon->print_on(st);
66 }
67 }
68 } else if (is_locked()) { // last bits != 01 => 00
69 // thin locked
70 // Valhalla: inline types can not possess an object monitor
71 st->print(" locked(" INTPTR_FORMAT ")", value());
72 } else {
73 st->print(" mark(");
74 if (is_unlocked()) { // last bits = 01
75 st->print("is_unlocked");
76 if (is_inline_type()) {
77 st->print(" inline_type");
78 if (is_larval_state()) {
79 st->print("=larval");
80 }
81 }
82 if (has_no_hash()) {
83 st->print(" no_hash");
84 } else {
85 st->print(" hash=" INTPTR_FORMAT, hash());
86 }
87 #ifdef _LP64 // 64 bit encodings have array information
88 // flat or null-free do not imply each other
89 bool flat = is_flat_array();
90 bool null_free = is_null_free_array();
91 if (flat && !null_free) {
92 st->print(" flat_array");
93 } else if (!flat && null_free) {
94 st->print(" null_free_array");
95 } else if (flat && null_free) {
96 st->print(" flat_null_free_array");
97 }
98 #endif
99 } else {
100 st->print("??");
101 }
102 st->print(" age=%d)", age());
103 }
104 }
105
106 markWord markWord::flat_array_prototype(LayoutKind lk) {
107 switch(lk) {
108 case LayoutKind::ATOMIC_FLAT:
109 case LayoutKind::NON_ATOMIC_FLAT:
110 return markWord(null_free_flat_array_pattern);
111 break;
112 case LayoutKind::NULLABLE_ATOMIC_FLAT:
113 return markWord(nullable_flat_array_pattern);
114 break;
115 default:
116 ShouldNotReachHere();
117 }
118 }
|