hotspot/src/share/vm/classfile/classLoaderData.cpp
changeset 40358 48774f26918a
parent 40339 943ab4612166
child 40655 9f644073d3a0
equal deleted inserted replaced
40356:df5e8cabdf10 40358:48774f26918a
   124 // while the class is being parsed, and if the class appears on the module fixup list.
   124 // while the class is being parsed, and if the class appears on the module fixup list.
   125 // Due to the uniqueness that no other class shares the anonymous class' name or
   125 // Due to the uniqueness that no other class shares the anonymous class' name or
   126 // ClassLoaderData, no other non-GC thread has knowledge of the anonymous class while
   126 // ClassLoaderData, no other non-GC thread has knowledge of the anonymous class while
   127 // it is being defined, therefore _keep_alive is not volatile or atomic.
   127 // it is being defined, therefore _keep_alive is not volatile or atomic.
   128 void ClassLoaderData::inc_keep_alive() {
   128 void ClassLoaderData::inc_keep_alive() {
   129   assert(_keep_alive >= 0, "Invalid keep alive count");
   129   if (is_anonymous()) {
   130   _keep_alive++;
   130     assert(_keep_alive >= 0, "Invalid keep alive increment count");
       
   131     _keep_alive++;
       
   132   }
   131 }
   133 }
   132 
   134 
   133 void ClassLoaderData::dec_keep_alive() {
   135 void ClassLoaderData::dec_keep_alive() {
   134   assert(_keep_alive > 0, "Invalid keep alive count");
   136   if (is_anonymous()) {
   135   _keep_alive--;
   137     assert(_keep_alive > 0, "Invalid keep alive decrement count");
       
   138     _keep_alive--;
       
   139   }
   136 }
   140 }
   137 
   141 
   138 void ClassLoaderData::oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim) {
   142 void ClassLoaderData::oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim) {
   139   if (must_claim && !claim()) {
   143   if (must_claim && !claim()) {
   140     return;
   144     return;