62 hashShift = db.lookupLongConstant("markOopDesc::hash_shift").longValue();
63 lockMask = db.lookupLongConstant("markOopDesc::lock_mask").longValue();
64 lockMaskInPlace = db.lookupLongConstant("markOopDesc::lock_mask_in_place").longValue();
65 biasedLockMask = db.lookupLongConstant("markOopDesc::biased_lock_mask").longValue();
66 biasedLockMaskInPlace = db.lookupLongConstant("markOopDesc::biased_lock_mask_in_place").longValue();
67 biasedLockBitInPlace = db.lookupLongConstant("markOopDesc::biased_lock_bit_in_place").longValue();
68 ageMask = db.lookupLongConstant("markOopDesc::age_mask").longValue();
69 ageMaskInPlace = db.lookupLongConstant("markOopDesc::age_mask_in_place").longValue();
70 hashMask = db.lookupLongConstant("markOopDesc::hash_mask").longValue();
71 hashMaskInPlace = db.lookupLongConstant("markOopDesc::hash_mask_in_place").longValue();
72 biasedLockAlignment = db.lookupLongConstant("markOopDesc::biased_lock_alignment").longValue();
73 lockedValue = db.lookupLongConstant("markOopDesc::locked_value").longValue();
74 unlockedValue = db.lookupLongConstant("markOopDesc::unlocked_value").longValue();
75 monitorValue = db.lookupLongConstant("markOopDesc::monitor_value").longValue();
76 markedValue = db.lookupLongConstant("markOopDesc::marked_value").longValue();
77 biasedLockPattern = db.lookupLongConstant("markOopDesc::biased_lock_pattern").longValue();
78 noHash = db.lookupLongConstant("markOopDesc::no_hash").longValue();
79 noHashInPlace = db.lookupLongConstant("markOopDesc::no_hash_in_place").longValue();
80 noLockInPlace = db.lookupLongConstant("markOopDesc::no_lock_in_place").longValue();
81 maxAge = db.lookupLongConstant("markOopDesc::max_age").longValue();
82 }
83
84 // Field accessors
85 private static CIntegerField markField;
86
87 // Constants -- read from VM
88 private static long ageBits;
89 private static long lockBits;
90 private static long biasedLockBits;
91 private static long maxHashBits;
92 private static long hashBits;
93
94 private static long lockShift;
95 private static long biasedLockShift;
96 private static long ageShift;
97 private static long hashShift;
98
99 private static long lockMask;
100 private static long lockMaskInPlace;
101 private static long biasedLockMask;
103 private static long biasedLockBitInPlace;
104 private static long ageMask;
105 private static long ageMaskInPlace;
106 private static long hashMask;
107 private static long hashMaskInPlace;
108 private static long biasedLockAlignment;
109
110 private static long lockedValue;
111 private static long unlockedValue;
112 private static long monitorValue;
113 private static long markedValue;
114 private static long biasedLockPattern;
115
116 private static long noHash;
117
118 private static long noHashInPlace;
119 private static long noLockInPlace;
120
121 private static long maxAge;
122
123 public Mark(Address addr) {
124 super(addr);
125 }
126
127 public long value() {
128 return markField.getValue(addr);
129 }
130
131 public Address valueAsAddress() {
132 return addr.getAddressAt(markField.getOffset());
133 }
134
135 // Biased locking accessors
136 // These must be checked by all code which calls into the
137 // ObjectSynchoronizer and other code. The biasing is not understood
138 // by the lower-level CAS-based locking code, although the runtime
139 // fixes up biased locks to be compatible with it when a bias is
140 // revoked.
141 public boolean hasBiasPattern() {
142 return (Bits.maskBitsLong(value(), biasedLockMaskInPlace) == biasedLockPattern);
273 if (isLocked()) {
274 tty.print("locked(0x" +
275 Long.toHexString(value()) + ")->");
276 displacedMarkHelper().printOn(tty);
277 } else {
278 if (Assert.ASSERTS_ENABLED) {
279 Assert.that(isUnlocked(), "just checking");
280 }
281 tty.print("mark(");
282 tty.print("hash " + Long.toHexString(hash()) + ",");
283 tty.print("age " + age() + ")");
284 }
285 }
286
287 // FIXME
288 // // Prepare address of oop for placement into mark
289 // inline static markOop encode_pointer_as_mark(void* p) { return markOop(p)->set_marked(); }
290 //
291 // // Recover address of oop from encoded form used in mark
292 // inline void* decode_pointer() { return clear_lock_bits(); }
293 }
|
62 hashShift = db.lookupLongConstant("markOopDesc::hash_shift").longValue();
63 lockMask = db.lookupLongConstant("markOopDesc::lock_mask").longValue();
64 lockMaskInPlace = db.lookupLongConstant("markOopDesc::lock_mask_in_place").longValue();
65 biasedLockMask = db.lookupLongConstant("markOopDesc::biased_lock_mask").longValue();
66 biasedLockMaskInPlace = db.lookupLongConstant("markOopDesc::biased_lock_mask_in_place").longValue();
67 biasedLockBitInPlace = db.lookupLongConstant("markOopDesc::biased_lock_bit_in_place").longValue();
68 ageMask = db.lookupLongConstant("markOopDesc::age_mask").longValue();
69 ageMaskInPlace = db.lookupLongConstant("markOopDesc::age_mask_in_place").longValue();
70 hashMask = db.lookupLongConstant("markOopDesc::hash_mask").longValue();
71 hashMaskInPlace = db.lookupLongConstant("markOopDesc::hash_mask_in_place").longValue();
72 biasedLockAlignment = db.lookupLongConstant("markOopDesc::biased_lock_alignment").longValue();
73 lockedValue = db.lookupLongConstant("markOopDesc::locked_value").longValue();
74 unlockedValue = db.lookupLongConstant("markOopDesc::unlocked_value").longValue();
75 monitorValue = db.lookupLongConstant("markOopDesc::monitor_value").longValue();
76 markedValue = db.lookupLongConstant("markOopDesc::marked_value").longValue();
77 biasedLockPattern = db.lookupLongConstant("markOopDesc::biased_lock_pattern").longValue();
78 noHash = db.lookupLongConstant("markOopDesc::no_hash").longValue();
79 noHashInPlace = db.lookupLongConstant("markOopDesc::no_hash_in_place").longValue();
80 noLockInPlace = db.lookupLongConstant("markOopDesc::no_lock_in_place").longValue();
81 maxAge = db.lookupLongConstant("markOopDesc::max_age").longValue();
82
83 /* Constants in markOop used by CMS. */
84 cmsBits = db.lookupLongConstant("markOopDesc::cms_bits").longValue();
85 cmsShift = db.lookupLongConstant("markOopDesc::cms_shift").longValue();
86 cmsMask = db.lookupLongConstant("markOopDesc::cms_mask").longValue();
87 cmsMaskInPlace = db.lookupLongConstant("markOopDesc::cms_mask_in_place").longValue();
88 cmsFreeChunkPattern = db.lookupLongConstant("markOopDesc::cms_free_chunk_pattern").longValue();
89 cmsNoCoalescePattern= db.lookupLongConstant("markOopDesc::cms_no_coalesce_pattern").longValue();
90 sizeShift = db.lookupLongConstant("markOopDesc::size_shift").longValue();
91 sizeBits = db.lookupLongConstant("markOopDesc::size_bits").longValue();
92 sizeMask = db.lookupLongConstant("markOopDesc::size_mask").longValue();
93 sizeMaskInPlace = db.lookupLongConstant("markOopDesc::size_mask_in_place").longValue();
94 }
95
96 // Field accessors
97 private static CIntegerField markField;
98
99 // Constants -- read from VM
100 private static long ageBits;
101 private static long lockBits;
102 private static long biasedLockBits;
103 private static long maxHashBits;
104 private static long hashBits;
105
106 private static long lockShift;
107 private static long biasedLockShift;
108 private static long ageShift;
109 private static long hashShift;
110
111 private static long lockMask;
112 private static long lockMaskInPlace;
113 private static long biasedLockMask;
115 private static long biasedLockBitInPlace;
116 private static long ageMask;
117 private static long ageMaskInPlace;
118 private static long hashMask;
119 private static long hashMaskInPlace;
120 private static long biasedLockAlignment;
121
122 private static long lockedValue;
123 private static long unlockedValue;
124 private static long monitorValue;
125 private static long markedValue;
126 private static long biasedLockPattern;
127
128 private static long noHash;
129
130 private static long noHashInPlace;
131 private static long noLockInPlace;
132
133 private static long maxAge;
134
135 /* Constants in markOop used by CMS. */
136 private static long cmsBits;
137 private static long cmsShift;
138 private static long cmsMask;
139 private static long cmsMaskInPlace;
140 private static long cmsFreeChunkPattern;
141 private static long cmsNoCoalescePattern;
142 private static long sizeShift;
143 private static long sizeBits;
144 private static long sizeMask;
145 private static long sizeMaskInPlace;
146
147 public Mark(Address addr) {
148 super(addr);
149 }
150
151 public long value() {
152 return markField.getValue(addr);
153 }
154
155 public Address valueAsAddress() {
156 return addr.getAddressAt(markField.getOffset());
157 }
158
159 // Biased locking accessors
160 // These must be checked by all code which calls into the
161 // ObjectSynchoronizer and other code. The biasing is not understood
162 // by the lower-level CAS-based locking code, although the runtime
163 // fixes up biased locks to be compatible with it when a bias is
164 // revoked.
165 public boolean hasBiasPattern() {
166 return (Bits.maskBitsLong(value(), biasedLockMaskInPlace) == biasedLockPattern);
297 if (isLocked()) {
298 tty.print("locked(0x" +
299 Long.toHexString(value()) + ")->");
300 displacedMarkHelper().printOn(tty);
301 } else {
302 if (Assert.ASSERTS_ENABLED) {
303 Assert.that(isUnlocked(), "just checking");
304 }
305 tty.print("mark(");
306 tty.print("hash " + Long.toHexString(hash()) + ",");
307 tty.print("age " + age() + ")");
308 }
309 }
310
311 // FIXME
312 // // Prepare address of oop for placement into mark
313 // inline static markOop encode_pointer_as_mark(void* p) { return markOop(p)->set_marked(); }
314 //
315 // // Recover address of oop from encoded form used in mark
316 // inline void* decode_pointer() { return clear_lock_bits(); }
317
318 // Copy markOop methods for CMS here.
319 private long cmsEncoding() {
320 return Bits.maskBitsLong(value() >> cmsShift, cmsMask);
321 }
322 public boolean isCmsFreeChunk() {
323 return isUnlocked() &&
324 (cmsEncoding() & cmsFreeChunkPattern) == cmsFreeChunkPattern;
325 }
326 public long getSize() { return (long)(value() >> sizeShift); }
327 }
|