hotspot/src/share/vm/memory/compactingPermGenGen.cpp
changeset 360 21d113ecbf6a
parent 220 e6ef4818c49d
child 670 ddf3e9583f2f
equal deleted inserted replaced
357:f4edb0d9f109 360:21d113ecbf6a
    47 // An OopClosure helper: Recursively adjust all pointers in an object
    47 // An OopClosure helper: Recursively adjust all pointers in an object
    48 // and all objects by referenced it. Clear marks on objects in order
    48 // and all objects by referenced it. Clear marks on objects in order
    49 // to prevent visiting any object twice.
    49 // to prevent visiting any object twice.
    50 
    50 
    51 class RecursiveAdjustSharedObjectClosure : public OopClosure {
    51 class RecursiveAdjustSharedObjectClosure : public OopClosure {
    52 public:
    52  protected:
    53   void do_oop(oop* o) {
    53   template <class T> inline void do_oop_work(T* p) {
    54     oop obj = *o;
    54     oop obj = oopDesc::load_decode_heap_oop_not_null(p);
    55     if (obj->is_shared_readwrite()) {
    55     if (obj->is_shared_readwrite()) {
    56       if (obj->mark()->is_marked()) {
    56       if (obj->mark()->is_marked()) {
    57         obj->init_mark();         // Don't revisit this object.
    57         obj->init_mark();         // Don't revisit this object.
    58         obj->oop_iterate(this);   // Recurse - adjust objects referenced.
    58         obj->oop_iterate(this);   // Recurse - adjust objects referenced.
    59         obj->adjust_pointers();   // Adjust this object's references.
    59         obj->adjust_pointers();   // Adjust this object's references.
    69             cp->oop_iterate(this);
    69             cp->oop_iterate(this);
    70           }
    70           }
    71         }
    71         }
    72       }
    72       }
    73     }
    73     }
    74   };
    74   }
       
    75  public:
       
    76   virtual void do_oop(oop* p)       { RecursiveAdjustSharedObjectClosure::do_oop_work(p); }
       
    77   virtual void do_oop(narrowOop* p) { RecursiveAdjustSharedObjectClosure::do_oop_work(p); }
    75 };
    78 };
    76 
    79 
    77 
    80 
    78 // We need to go through all placeholders in the system dictionary and
    81 // We need to go through all placeholders in the system dictionary and
    79 // try to resolve them into shared classes. Other threads might be in
    82 // try to resolve them into shared classes. Other threads might be in
    84 // RecursiveAdjustSharedObjectClosure to the SystemDictionary. Note
    87 // RecursiveAdjustSharedObjectClosure to the SystemDictionary. Note
    85 // that we must not call find_shared_class with non-read-only symbols
    88 // that we must not call find_shared_class with non-read-only symbols
    86 // as doing so can cause hash codes to be computed, destroying
    89 // as doing so can cause hash codes to be computed, destroying
    87 // forwarding pointers.
    90 // forwarding pointers.
    88 class TraversePlaceholdersClosure : public OopClosure {
    91 class TraversePlaceholdersClosure : public OopClosure {
    89  public:
    92  protected:
    90   void do_oop(oop* o) {
    93   template <class T> inline void do_oop_work(T* p) {
    91     oop obj = *o;
    94     oop obj = oopDesc::load_decode_heap_oop_not_null(p);
    92     if (obj->klass() == Universe::symbolKlassObj() &&
    95     if (obj->klass() == Universe::symbolKlassObj() &&
    93         obj->is_shared_readonly()) {
    96         obj->is_shared_readonly()) {
    94       symbolHandle sym((symbolOop) obj);
    97       symbolHandle sym((symbolOop) obj);
    95       oop k = SystemDictionary::find_shared_class(sym);
    98       oop k = SystemDictionary::find_shared_class(sym);
    96       if (k != NULL) {
    99       if (k != NULL) {
    97         RecursiveAdjustSharedObjectClosure clo;
   100         RecursiveAdjustSharedObjectClosure clo;
    98         clo.do_oop(&k);
   101         clo.do_oop(&k);
    99       }
   102       }
   100     }
   103     }
   101   }
   104   }
       
   105  public:
       
   106   virtual void do_oop(oop* p)       { TraversePlaceholdersClosure::do_oop_work(p); }
       
   107   virtual void do_oop(narrowOop* p) { TraversePlaceholdersClosure::do_oop_work(p); }
       
   108 
   102 };
   109 };
   103 
   110 
   104 
   111 
   105 void CompactingPermGenGen::initialize_performance_counters() {
   112 void CompactingPermGenGen::initialize_performance_counters() {
   106 
   113