< prev index next >

test/hotspot/gtest/oops/test_markOop.cpp

Print this page
rev 55000 : [mq]: dcubed.monitor_deflate_conc.v2.04


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




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



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

 143 }
 144 #endif // PRODUCT


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