hotspot/src/share/vm/oops/instanceRefKlass.cpp
changeset 12780 689210d5dd05
parent 12379 2cf45b79ce3a
child 13728 882756847a04
equal deleted inserted replaced
12779:06778de5193e 12780:689210d5dd05
   513 }
   513 }
   514 
   514 
   515 void instanceRefKlass::acquire_pending_list_lock(BasicLock *pending_list_basic_lock) {
   515 void instanceRefKlass::acquire_pending_list_lock(BasicLock *pending_list_basic_lock) {
   516   // we may enter this with pending exception set
   516   // we may enter this with pending exception set
   517   PRESERVE_EXCEPTION_MARK;  // exceptions are never thrown, needed for TRAPS argument
   517   PRESERVE_EXCEPTION_MARK;  // exceptions are never thrown, needed for TRAPS argument
       
   518 
       
   519   // Create a HandleMark in case we retry a GC multiple times.
       
   520   // Each time we attempt the GC, we allocate the handle below
       
   521   // to hold the pending list lock. We want to free this handle.
       
   522   HandleMark hm;
       
   523 
   518   Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock());
   524   Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock());
   519   ObjectSynchronizer::fast_enter(h_lock, pending_list_basic_lock, false, THREAD);
   525   ObjectSynchronizer::fast_enter(h_lock, pending_list_basic_lock, false, THREAD);
   520   assert(ObjectSynchronizer::current_thread_holds_lock(
   526   assert(ObjectSynchronizer::current_thread_holds_lock(
   521            JavaThread::current(), h_lock),
   527            JavaThread::current(), h_lock),
   522          "Locking should have succeeded");
   528          "Locking should have succeeded");
   525 
   531 
   526 void instanceRefKlass::release_and_notify_pending_list_lock(
   532 void instanceRefKlass::release_and_notify_pending_list_lock(
   527   BasicLock *pending_list_basic_lock) {
   533   BasicLock *pending_list_basic_lock) {
   528   // we may enter this with pending exception set
   534   // we may enter this with pending exception set
   529   PRESERVE_EXCEPTION_MARK;  // exceptions are never thrown, needed for TRAPS argument
   535   PRESERVE_EXCEPTION_MARK;  // exceptions are never thrown, needed for TRAPS argument
   530   //
   536 
       
   537   // Create a HandleMark in case we retry a GC multiple times.
       
   538   // Each time we attempt the GC, we allocate the handle below
       
   539   // to hold the pending list lock. We want to free this handle.
       
   540   HandleMark hm;
       
   541 
   531   Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock());
   542   Handle h_lock(THREAD, java_lang_ref_Reference::pending_list_lock());
   532   assert(ObjectSynchronizer::current_thread_holds_lock(
   543   assert(ObjectSynchronizer::current_thread_holds_lock(
   533            JavaThread::current(), h_lock),
   544            JavaThread::current(), h_lock),
   534          "Lock should be held");
   545          "Lock should be held");
   535   // Notify waiters on pending lists lock if there is any reference.
   546   // Notify waiters on pending lists lock if there is any reference.