256 #ifndef PRODUCT 257 bool ClassLoaderData::ChunkedHandleList::owner_of(oop* oop_handle) { 258 Chunk* chunk = _head; 259 while (chunk != NULL) { 260 if (&(chunk->_data[0]) <= oop_handle && oop_handle < &(chunk->_data[chunk->_size])) { 261 return true; 262 } 263 chunk = chunk->_next; 264 } 265 return false; 266 } 267 #endif // PRODUCT 268 269 void ClassLoaderData::clear_claim(int claim) { 270 for (;;) { 271 int old_claim = Atomic::load(&_claim); 272 if ((old_claim & claim) == 0) { 273 return; 274 } 275 int new_claim = old_claim & ~claim; 276 if (Atomic::cmpxchg(new_claim, &_claim, old_claim) == old_claim) { 277 return; 278 } 279 } 280 } 281 282 bool ClassLoaderData::try_claim(int claim) { 283 for (;;) { 284 int old_claim = Atomic::load(&_claim); 285 if ((old_claim & claim) == claim) { 286 return false; 287 } 288 int new_claim = old_claim | claim; 289 if (Atomic::cmpxchg(new_claim, &_claim, old_claim) == old_claim) { 290 return true; 291 } 292 } 293 } 294 295 // Unsafe anonymous classes have their own ClassLoaderData that is marked to keep alive 296 // while the class is being parsed, and if the class appears on the module fixup list. 297 // Due to the uniqueness that no other class shares the unsafe anonymous class' name or 298 // ClassLoaderData, no other non-GC thread has knowledge of the unsafe anonymous class while 299 // it is being defined, therefore _keep_alive is not volatile or atomic. 300 void ClassLoaderData::inc_keep_alive() { 301 if (is_unsafe_anonymous()) { 302 assert(_keep_alive > 0, "Invalid keep alive increment count"); 303 _keep_alive++; 304 } 305 } 306 307 void ClassLoaderData::dec_keep_alive() { 308 if (is_unsafe_anonymous()) { 309 assert(_keep_alive > 0, "Invalid keep alive decrement count"); | 256 #ifndef PRODUCT 257 bool ClassLoaderData::ChunkedHandleList::owner_of(oop* oop_handle) { 258 Chunk* chunk = _head; 259 while (chunk != NULL) { 260 if (&(chunk->_data[0]) <= oop_handle && oop_handle < &(chunk->_data[chunk->_size])) { 261 return true; 262 } 263 chunk = chunk->_next; 264 } 265 return false; 266 } 267 #endif // PRODUCT 268 269 void ClassLoaderData::clear_claim(int claim) { 270 for (;;) { 271 int old_claim = Atomic::load(&_claim); 272 if ((old_claim & claim) == 0) { 273 return; 274 } 275 int new_claim = old_claim & ~claim; 276 if (Atomic::cmpxchg(&_claim, old_claim, new_claim) == old_claim) { 277 return; 278 } 279 } 280 } 281 282 bool ClassLoaderData::try_claim(int claim) { 283 for (;;) { 284 int old_claim = Atomic::load(&_claim); 285 if ((old_claim & claim) == claim) { 286 return false; 287 } 288 int new_claim = old_claim | claim; 289 if (Atomic::cmpxchg(&_claim, old_claim, new_claim) == old_claim) { 290 return true; 291 } 292 } 293 } 294 295 // Unsafe anonymous classes have their own ClassLoaderData that is marked to keep alive 296 // while the class is being parsed, and if the class appears on the module fixup list. 297 // Due to the uniqueness that no other class shares the unsafe anonymous class' name or 298 // ClassLoaderData, no other non-GC thread has knowledge of the unsafe anonymous class while 299 // it is being defined, therefore _keep_alive is not volatile or atomic. 300 void ClassLoaderData::inc_keep_alive() { 301 if (is_unsafe_anonymous()) { 302 assert(_keep_alive > 0, "Invalid keep alive increment count"); 303 _keep_alive++; 304 } 305 } 306 307 void ClassLoaderData::dec_keep_alive() { 308 if (is_unsafe_anonymous()) { 309 assert(_keep_alive > 0, "Invalid keep alive decrement count"); |