< prev index next >

test/hotspot/gtest/oops/test_markOop.cpp

Print this page
rev 56635 : v2.00 -> v2.05 (CR5/v2.05/8-for-jdk13) patches combined into one; merge with 8229212.patch; merge with jdk-14+11; merge with 8230184.patch; merge with 8230876.patch; merge with jdk-14+15; merge with jdk-14+18.


 101   markWord prototype_header = obj->klass()->prototype_header();
 102   markWord mark = obj->mark();
 103   markWord biased_mark = markWord::encode((JavaThread*) THREAD, mark.age(), prototype_header.bias_epoch());
 104   obj->set_mark(biased_mark);
 105   // Look for the biased_locker in markWord, not prototype_header.
 106 #ifdef _LP64
 107   assert_not_test_pattern(h_obj, "mark(is_biased biased_locker=0x0000000000000000");
 108 #else
 109   assert_not_test_pattern(h_obj, "mark(is_biased biased_locker=0x00000000");
 110 #endif
 111 
 112   // Same thread tries to lock it again.
 113   {
 114     ObjectLocker ol(h_obj, THREAD);
 115     assert_test_pattern(h_obj, "locked");
 116   }
 117 
 118   // This is no longer biased, because ObjectLocker revokes the bias.
 119   assert_test_pattern(h_obj, "is_neutral no_hash");
 120 




 121   // Wait gets the lock inflated.
 122   {
 123     ObjectLocker ol(h_obj, THREAD);
 124 
 125     Semaphore done(0);
 126     LockerThread* st;
 127     st = new LockerThread(&done, h_obj());
 128     st->doit();
 129 
 130     ol.wait(THREAD);
 131     assert_test_pattern(h_obj, "monitor");
 132     done.wait_with_safepoint_check(THREAD);  // wait till the thread is done.
 133   }
 134 



 135   // Make the object older. Not all GCs use this field.
 136   Universe::heap()->collect(GCCause::_java_lang_system_gc);
 137   if (UseParallelGC) {
 138     assert_test_pattern(h_obj, "is_neutral no_hash age 1");
 139   }
 140 
 141   // Hash the object then print it.
 142   intx hash = h_obj->identity_hash();
 143   assert_test_pattern(h_obj, "is_neutral hash=0x");

 144 }
 145 #endif // PRODUCT


 101   markWord prototype_header = obj->klass()->prototype_header();
 102   markWord mark = obj->mark();
 103   markWord biased_mark = markWord::encode((JavaThread*) THREAD, mark.age(), prototype_header.bias_epoch());
 104   obj->set_mark(biased_mark);
 105   // Look for the biased_locker in markWord, not prototype_header.
 106 #ifdef _LP64
 107   assert_not_test_pattern(h_obj, "mark(is_biased biased_locker=0x0000000000000000");
 108 #else
 109   assert_not_test_pattern(h_obj, "mark(is_biased biased_locker=0x00000000");
 110 #endif
 111 
 112   // Same thread tries to lock it again.
 113   {
 114     ObjectLocker ol(h_obj, THREAD);
 115     assert_test_pattern(h_obj, "locked");
 116   }
 117 
 118   // This is no longer biased, because ObjectLocker revokes the bias.
 119   assert_test_pattern(h_obj, "is_neutral no_hash");
 120 
 121   // Hash the object then print it.
 122   intx hash = h_obj->identity_hash();
 123   assert_test_pattern(h_obj, "is_neutral hash=0x");
 124 
 125   // Wait gets the lock inflated.
 126   {
 127     ObjectLocker ol(h_obj, THREAD);
 128 
 129     Semaphore done(0);
 130     LockerThread* st;
 131     st = new LockerThread(&done, h_obj());
 132     st->doit();
 133 
 134     ol.wait(THREAD);
 135     assert_test_pattern(h_obj, "monitor");
 136     done.wait_with_safepoint_check(THREAD);  // wait till the thread is done.
 137   }
 138 
 139   if (!AsyncDeflateIdleMonitors) {
 140     // With AsyncDeflateIdleMonitors, the collect() call below
 141     // does not guarantee monitor deflation.
 142     // Make the object older. Not all GCs use this field.
 143     Universe::heap()->collect(GCCause::_java_lang_system_gc);
 144     if (UseParallelGC) {
 145       assert_test_pattern(h_obj, "is_neutral no_hash age 1");
 146     }
 147 
 148     // Hash the object then print it.
 149     intx hash = h_obj->identity_hash();
 150     assert_test_pattern(h_obj, "is_neutral hash=0x");
 151   }
 152 }
 153 #endif // PRODUCT
< prev index next >