src/share/vm/oops/instanceKlass.hpp

changeset 5755
0f37d1badced
parent 5732
b2e698d2276c
parent 5749
4f9a42c33738
child 5836
3374b92de2d9
     1.1 --- a/src/share/vm/oops/instanceKlass.hpp	Fri Sep 20 11:09:26 2013 -0700
     1.2 +++ b/src/share/vm/oops/instanceKlass.hpp	Fri Sep 20 12:58:35 2013 -0700
     1.3 @@ -1126,21 +1126,11 @@
     1.4  
     1.5  
     1.6  // A collection point for interesting information about the previous
     1.7 -// version(s) of an InstanceKlass. This class uses weak references to
     1.8 -// the information so that the information may be collected as needed
     1.9 -// by the system. If the information is shared, then a regular
    1.10 -// reference must be used because a weak reference would be seen as
    1.11 -// collectible. A GrowableArray of PreviousVersionNodes is attached
    1.12 -// to the InstanceKlass as needed. See PreviousVersionWalker below.
    1.13 +// version(s) of an InstanceKlass.  A GrowableArray of PreviousVersionNodes
    1.14 +// is attached to the InstanceKlass as needed. See PreviousVersionWalker below.
    1.15  class PreviousVersionNode : public CHeapObj<mtClass> {
    1.16   private:
    1.17 -  // A shared ConstantPool is never collected so we'll always have
    1.18 -  // a reference to it so we can update items in the cache. We'll
    1.19 -  // have a weak reference to a non-shared ConstantPool until all
    1.20 -  // of the methods (EMCP or obsolete) have been collected; the
    1.21 -  // non-shared ConstantPool becomes collectible at that point.
    1.22 -  ConstantPool*    _prev_constant_pool;  // regular or weak reference
    1.23 -  bool    _prev_cp_is_weak;     // true if not a shared ConstantPool
    1.24 +  ConstantPool*    _prev_constant_pool;
    1.25  
    1.26    // If the previous version of the InstanceKlass doesn't have any
    1.27    // EMCP methods, then _prev_EMCP_methods will be NULL. If all the
    1.28 @@ -1149,8 +1139,8 @@
    1.29    GrowableArray<Method*>* _prev_EMCP_methods;
    1.30  
    1.31  public:
    1.32 -  PreviousVersionNode(ConstantPool* prev_constant_pool, bool prev_cp_is_weak,
    1.33 -    GrowableArray<Method*>* prev_EMCP_methods);
    1.34 +  PreviousVersionNode(ConstantPool* prev_constant_pool,
    1.35 +                      GrowableArray<Method*>* prev_EMCP_methods);
    1.36    ~PreviousVersionNode();
    1.37    ConstantPool* prev_constant_pool() const {
    1.38      return _prev_constant_pool;
    1.39 @@ -1161,59 +1151,26 @@
    1.40  };
    1.41  
    1.42  
    1.43 -// A Handle-ized version of PreviousVersionNode.
    1.44 -class PreviousVersionInfo : public ResourceObj {
    1.45 - private:
    1.46 -  constantPoolHandle   _prev_constant_pool_handle;
    1.47 -  // If the previous version of the InstanceKlass doesn't have any
    1.48 -  // EMCP methods, then _prev_EMCP_methods will be NULL. Since the
    1.49 -  // methods cannot be collected while we hold a handle,
    1.50 -  // _prev_EMCP_methods should never have a length of zero.
    1.51 -  GrowableArray<methodHandle>* _prev_EMCP_method_handles;
    1.52 -
    1.53 -public:
    1.54 -  PreviousVersionInfo(PreviousVersionNode *pv_node);
    1.55 -  ~PreviousVersionInfo();
    1.56 -  constantPoolHandle prev_constant_pool_handle() const {
    1.57 -    return _prev_constant_pool_handle;
    1.58 -  }
    1.59 -  GrowableArray<methodHandle>* prev_EMCP_method_handles() const {
    1.60 -    return _prev_EMCP_method_handles;
    1.61 -  }
    1.62 -};
    1.63 -
    1.64 -
    1.65 -// Helper object for walking previous versions. This helper cleans up
    1.66 -// the Handles that it allocates when the helper object is destroyed.
    1.67 -// The PreviousVersionInfo object returned by next_previous_version()
    1.68 -// is only valid until a subsequent call to next_previous_version() or
    1.69 -// the helper object is destroyed.
    1.70 +// Helper object for walking previous versions.
    1.71  class PreviousVersionWalker : public StackObj {
    1.72   private:
    1.73 +  Thread*                               _thread;
    1.74    GrowableArray<PreviousVersionNode *>* _previous_versions;
    1.75    int                                   _current_index;
    1.76 -  // Fields for cleaning up when we are done walking the previous versions:
    1.77 -  // A HandleMark for the PreviousVersionInfo handles:
    1.78 -  HandleMark                            _hm;
    1.79  
    1.80 -  // It would be nice to have a ResourceMark field in this helper also,
    1.81 -  // but the ResourceMark code says to be careful to delete handles held
    1.82 -  // in GrowableArrays _before_ deleting the GrowableArray. Since we
    1.83 -  // can't guarantee the order in which the fields are destroyed, we
    1.84 -  // have to let the creator of the PreviousVersionWalker object do
    1.85 -  // the right thing. Also, adding a ResourceMark here causes an
    1.86 -  // include loop.
    1.87 +  // A pointer to the current node object so we can handle the deletes.
    1.88 +  PreviousVersionNode*                  _current_p;
    1.89  
    1.90 -  // A pointer to the current info object so we can handle the deletes.
    1.91 -  PreviousVersionInfo *                 _current_p;
    1.92 +  // The constant pool handle keeps all the methods in this class from being
    1.93 +  // deallocated from the metaspace during class unloading.
    1.94 +  constantPoolHandle                    _current_constant_pool_handle;
    1.95  
    1.96   public:
    1.97 -  PreviousVersionWalker(InstanceKlass *ik);
    1.98 -  ~PreviousVersionWalker();
    1.99 +  PreviousVersionWalker(Thread* thread, InstanceKlass *ik);
   1.100  
   1.101    // Return the interesting information for the next previous version
   1.102    // of the klass. Returns NULL if there are no more previous versions.
   1.103 -  PreviousVersionInfo* next_previous_version();
   1.104 +  PreviousVersionNode* next_previous_version();
   1.105  };
   1.106  
   1.107  

mercurial