1.1 --- a/src/share/vm/oops/instanceKlass.hpp Tue Apr 08 09:51:25 2014 +0200 1.2 +++ b/src/share/vm/oops/instanceKlass.hpp Mon Jan 08 08:32:04 2018 -0800 1.3 @@ -88,7 +88,6 @@ 1.4 class fieldDescriptor; 1.5 class DepChange; 1.6 class nmethodBucket; 1.7 -class PreviousVersionNode; 1.8 class JvmtiCachedClassFieldMap; 1.9 class MemberNameTable; 1.10 1.11 @@ -235,7 +234,8 @@ 1.12 _misc_is_anonymous = 1 << 3, // has embedded _host_klass field 1.13 _misc_is_contended = 1 << 4, // marked with contended annotation 1.14 _misc_has_default_methods = 1 << 5, // class/superclass/implemented interfaces has default methods 1.15 - _misc_declares_default_methods = 1 << 6 // directly declares default methods (any access) 1.16 + _misc_declares_default_methods = 1 << 6, // directly declares default methods (any access) 1.17 + _misc_has_been_redefined = 1 << 7 // class has been redefined 1.18 }; 1.19 u2 _misc_flags; 1.20 u2 _minor_version; // minor version number of class file 1.21 @@ -250,9 +250,8 @@ 1.22 nmethodBucket* _dependencies; // list of dependent nmethods 1.23 nmethod* _osr_nmethods_head; // Head of list of on-stack replacement nmethods for this class 1.24 BreakpointInfo* _breakpoints; // bpt lists, managed by Method* 1.25 - // Array of interesting part(s) of the previous version(s) of this 1.26 - // InstanceKlass. See PreviousVersionWalker below. 1.27 - GrowableArray<PreviousVersionNode *>* _previous_versions; 1.28 + // Linked instanceKlasses of previous versions 1.29 + InstanceKlass* _previous_versions; 1.30 // JVMTI fields can be moved to their own structure - see 6315920 1.31 // JVMTI: cached class file, before retransformable agent modified it in CFLH 1.32 JvmtiCachedClassFileData* _cached_class_file; 1.33 @@ -669,21 +668,31 @@ 1.34 } 1.35 1.36 // RedefineClasses() support for previous versions: 1.37 - void add_previous_version(instanceKlassHandle ikh, BitMap *emcp_methods, 1.38 - int emcp_method_count); 1.39 - // If the _previous_versions array is non-NULL, then this klass 1.40 - // has been redefined at least once even if we aren't currently 1.41 - // tracking a previous version. 1.42 - bool has_been_redefined() const { return _previous_versions != NULL; } 1.43 - bool has_previous_version() const; 1.44 + void add_previous_version(instanceKlassHandle ikh, int emcp_method_count); 1.45 + 1.46 + InstanceKlass* previous_versions() const { return _previous_versions; } 1.47 + 1.48 + bool has_been_redefined() const { 1.49 + return (_misc_flags & _misc_has_been_redefined) != 0; 1.50 + } 1.51 + void set_has_been_redefined() { 1.52 + _misc_flags |= _misc_has_been_redefined; 1.53 + } 1.54 + 1.55 void init_previous_versions() { 1.56 _previous_versions = NULL; 1.57 } 1.58 - GrowableArray<PreviousVersionNode *>* previous_versions() const { 1.59 - return _previous_versions; 1.60 + 1.61 + 1.62 + InstanceKlass* get_klass_version(int version) { 1.63 + for (InstanceKlass* ik = this; ik != NULL; ik = ik->previous_versions()) { 1.64 + if (ik->constants()->version() == version) { 1.65 + return ik; 1.66 + } 1.67 + } 1.68 + return NULL; 1.69 } 1.70 1.71 - InstanceKlass* get_klass_version(int version); 1.72 static void purge_previous_versions(InstanceKlass* ik); 1.73 1.74 // JVMTI: Support for caching a class file before it is modified by an agent that can do retransformation 1.75 @@ -1124,6 +1133,10 @@ 1.76 1.77 // Free CHeap allocated fields. 1.78 void release_C_heap_structures(); 1.79 + 1.80 + // RedefineClasses support 1.81 + void link_previous_versions(InstanceKlass* pv) { _previous_versions = pv; } 1.82 + void mark_newly_obsolete_methods(Array<Method*>* old_methods, int emcp_method_count); 1.83 public: 1.84 // CDS support - remove and restore oops from metadata. Oops are not shared. 1.85 virtual void remove_unshareable_info(); 1.86 @@ -1222,62 +1235,6 @@ 1.87 }; 1.88 1.89 1.90 -// If breakpoints are more numerous than just JVMTI breakpoints, 1.91 -// consider compressing this data structure. 1.92 -// It is currently a simple linked list defined in method.hpp. 1.93 - 1.94 -class BreakpointInfo; 1.95 - 1.96 - 1.97 -// A collection point for interesting information about the previous 1.98 -// version(s) of an InstanceKlass. A GrowableArray of PreviousVersionNodes 1.99 -// is attached to the InstanceKlass as needed. See PreviousVersionWalker below. 1.100 -class PreviousVersionNode : public CHeapObj<mtClass> { 1.101 - private: 1.102 - ConstantPool* _prev_constant_pool; 1.103 - 1.104 - // If the previous version of the InstanceKlass doesn't have any 1.105 - // EMCP methods, then _prev_EMCP_methods will be NULL. If all the 1.106 - // EMCP methods have been collected, then _prev_EMCP_methods can 1.107 - // have a length of zero. 1.108 - GrowableArray<Method*>* _prev_EMCP_methods; 1.109 - 1.110 -public: 1.111 - PreviousVersionNode(ConstantPool* prev_constant_pool, 1.112 - GrowableArray<Method*>* prev_EMCP_methods); 1.113 - ~PreviousVersionNode(); 1.114 - ConstantPool* prev_constant_pool() const { 1.115 - return _prev_constant_pool; 1.116 - } 1.117 - GrowableArray<Method*>* prev_EMCP_methods() const { 1.118 - return _prev_EMCP_methods; 1.119 - } 1.120 -}; 1.121 - 1.122 - 1.123 -// Helper object for walking previous versions. 1.124 -class PreviousVersionWalker : public StackObj { 1.125 - private: 1.126 - Thread* _thread; 1.127 - GrowableArray<PreviousVersionNode *>* _previous_versions; 1.128 - int _current_index; 1.129 - 1.130 - // A pointer to the current node object so we can handle the deletes. 1.131 - PreviousVersionNode* _current_p; 1.132 - 1.133 - // The constant pool handle keeps all the methods in this class from being 1.134 - // deallocated from the metaspace during class unloading. 1.135 - constantPoolHandle _current_constant_pool_handle; 1.136 - 1.137 - public: 1.138 - PreviousVersionWalker(Thread* thread, InstanceKlass *ik); 1.139 - 1.140 - // Return the interesting information for the next previous version 1.141 - // of the klass. Returns NULL if there are no more previous versions. 1.142 - PreviousVersionNode* next_previous_version(); 1.143 -}; 1.144 - 1.145 - 1.146 // 1.147 // nmethodBucket is used to record dependent nmethods for 1.148 // deoptimization. nmethod dependencies are actually <klass, method>