< prev index next >

test/hotspot/gtest/oops/test_markWord.cpp

Print this page
rev 56776 : v2.00 -> v2.07 (CR7/v2.07/10-for-jdk14) patches combined into one; merge with 8230876.patch (2019.10.17) and jdk-14+21.


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




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



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

 149 }
 150 #endif // PRODUCT


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