src/hotspot/share/oops/symbol.cpp
changeset 54133 829bf950287e
parent 53731 ee45b48c9e4a
child 54347 235883996bc7
equal deleted inserted replaced
54132:2ab55d39fb5b 54133:829bf950287e
   262       // refcount changed, try again.
   262       // refcount changed, try again.
   263     }
   263     }
   264   }
   264   }
   265 }
   265 }
   266 
   266 
       
   267 void Symbol::make_permanent() {
       
   268   uint32_t found = _length_and_refcount;
       
   269   while (true) {
       
   270     uint32_t old_value = found;
       
   271     int refc = extract_refcount(old_value);
       
   272     if (refc == PERM_REFCOUNT) {
       
   273       return;  // refcount is permanent, permanent is sticky
       
   274     } else if (refc == 0) {
       
   275 #ifdef ASSERT
       
   276       print();
       
   277       fatal("refcount underflow");
       
   278 #endif
       
   279       return;
       
   280     } else {
       
   281       int len = extract_length(old_value);
       
   282       found = Atomic::cmpxchg(pack_length_and_refcount(len, PERM_REFCOUNT), &_length_and_refcount, old_value);
       
   283       if (found == old_value) {
       
   284         return;  // successfully updated.
       
   285       }
       
   286       // refcount changed, try again.
       
   287     }
       
   288   }
       
   289 }
       
   290 
   267 void Symbol::metaspace_pointers_do(MetaspaceClosure* it) {
   291 void Symbol::metaspace_pointers_do(MetaspaceClosure* it) {
   268   if (log_is_enabled(Trace, cds)) {
   292   if (log_is_enabled(Trace, cds)) {
   269     LogStream trace_stream(Log(cds)::trace());
   293     LogStream trace_stream(Log(cds)::trace());
   270     trace_stream.print("Iter(Symbol): %p ", this);
   294     trace_stream.print("Iter(Symbol): %p ", this);
   271     print_value_on(&trace_stream);
   295     print_value_on(&trace_stream);