< prev index next >

src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp

Print this page




1933   case T_FLOAT  :
1934     // Result is in v0 we'll save as needed
1935     break;
1936   case T_ARRAY:                 // Really a handle
1937   case T_OBJECT:                // Really a handle
1938       break; // can't de-handlize until after safepoint check
1939   case T_VOID: break;
1940   case T_LONG: break;
1941   default       : ShouldNotReachHere();
1942   }
1943 
1944   // Switch thread to "native transition" state before reading the synchronization state.
1945   // This additional state is necessary because reading and testing the synchronization
1946   // state is not atomic w.r.t. GC, as this scenario demonstrates:
1947   //     Java thread A, in _thread_in_native state, loads _not_synchronized and is preempted.
1948   //     VM thread changes sync state to synchronizing and suspends threads for GC.
1949   //     Thread A is resumed to finish this native method, but doesn't block here since it
1950   //     didn't see any synchronization is progress, and escapes.
1951   __ mov(rscratch1, _thread_in_native_trans);
1952 
1953   if(os::is_MP()) {
1954     if (UseMembar) {
1955       __ strw(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
1956 
1957       // Force this write out before the read below
1958       __ dmb(Assembler::ISH);
1959     } else {
1960       __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
1961       __ stlrw(rscratch1, rscratch2);
1962 
1963       // Write serialization page so VM thread can do a pseudo remote membar.
1964       // We use the current thread pointer to calculate a thread specific
1965       // offset to write to within the page. This minimizes bus traffic
1966       // due to cache line collision.
1967       __ serialize_memory(rthread, r2);
1968     }
1969   } else {
1970     __ strw(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
1971   }
1972 
1973   // check for safepoint operation in progress and/or pending suspend requests
1974   Label safepoint_in_progress, safepoint_in_progress_done;
1975   {
1976     __ safepoint_poll_acquire(safepoint_in_progress);
1977     __ ldrw(rscratch1, Address(rthread, JavaThread::suspend_flags_offset()));
1978     __ cbnzw(rscratch1, safepoint_in_progress);
1979     __ bind(safepoint_in_progress_done);
1980   }
1981 
1982   // change thread state
1983   Label after_transition;
1984   __ mov(rscratch1, _thread_in_Java);
1985   __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
1986   __ stlrw(rscratch1, rscratch2);
1987   __ bind(after_transition);
1988 
1989   Label reguard;
1990   Label reguard_done;




1933   case T_FLOAT  :
1934     // Result is in v0 we'll save as needed
1935     break;
1936   case T_ARRAY:                 // Really a handle
1937   case T_OBJECT:                // Really a handle
1938       break; // can't de-handlize until after safepoint check
1939   case T_VOID: break;
1940   case T_LONG: break;
1941   default       : ShouldNotReachHere();
1942   }
1943 
1944   // Switch thread to "native transition" state before reading the synchronization state.
1945   // This additional state is necessary because reading and testing the synchronization
1946   // state is not atomic w.r.t. GC, as this scenario demonstrates:
1947   //     Java thread A, in _thread_in_native state, loads _not_synchronized and is preempted.
1948   //     VM thread changes sync state to synchronizing and suspends threads for GC.
1949   //     Thread A is resumed to finish this native method, but doesn't block here since it
1950   //     didn't see any synchronization is progress, and escapes.
1951   __ mov(rscratch1, _thread_in_native_trans);
1952 

1953   if (UseMembar) {
1954     __ strw(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
1955 
1956     // Force this write out before the read below
1957     __ dmb(Assembler::ISH);
1958   } else {
1959     __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
1960     __ stlrw(rscratch1, rscratch2);
1961 
1962     // Write serialization page so VM thread can do a pseudo remote membar.
1963     // We use the current thread pointer to calculate a thread specific
1964     // offset to write to within the page. This minimizes bus traffic
1965     // due to cache line collision.
1966     __ serialize_memory(rthread, r2);



1967   }
1968 
1969   // check for safepoint operation in progress and/or pending suspend requests
1970   Label safepoint_in_progress, safepoint_in_progress_done;
1971   {
1972     __ safepoint_poll_acquire(safepoint_in_progress);
1973     __ ldrw(rscratch1, Address(rthread, JavaThread::suspend_flags_offset()));
1974     __ cbnzw(rscratch1, safepoint_in_progress);
1975     __ bind(safepoint_in_progress_done);
1976   }
1977 
1978   // change thread state
1979   Label after_transition;
1980   __ mov(rscratch1, _thread_in_Java);
1981   __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
1982   __ stlrw(rscratch1, rscratch2);
1983   __ bind(after_transition);
1984 
1985   Label reguard;
1986   Label reguard_done;


< prev index next >