< prev index next >

src/hotspot/share/memory/heapShared.hpp

Print this page




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_MEMORY_HEAPSHARED_HPP
  26 #define SHARE_VM_MEMORY_HEAPSHARED_HPP
  27 
  28 #include "classfile/systemDictionary.hpp"
  29 #include "memory/universe.hpp"
  30 #include "oops/objArrayKlass.hpp"
  31 #include "oops/oop.hpp"
  32 #include "oops/typeArrayKlass.hpp"

  33 #include "utilities/growableArray.hpp"
  34 
  35 #if INCLUDE_CDS_JAVA_HEAP
  36 // A dump time sub-graph info for Klass _k. It includes the entry points
  37 // (static fields in _k's mirror) of the archived sub-graphs reachable
  38 // from _k's mirror. It also contains a list of Klasses of the objects
  39 // within the sub-graphs.
  40 class KlassSubGraphInfo: public CHeapObj<mtClass> {
  41  private:
  42   KlassSubGraphInfo* _next;
  43   // The class that contains the static field(s) as the entry point(s)
  44   // of archived object sub-graph(s).
  45   Klass* _k;
  46   // A list of classes need to be loaded and initialized before the archived
  47   // object sub-graphs can be accessed at runtime.
  48   GrowableArray<Klass*>* _subgraph_object_klasses;
  49   // A list of _k's static fields as the entry points of archived sub-graphs.
  50   // For each entry field, it is a pair of field_offset and field_value.
  51   GrowableArray<juint>*  _subgraph_entry_fields;
  52 


 106 #if INCLUDE_CDS_JAVA_HEAP
 107   // This is a list of subgraph infos built at dump time while
 108   // archiving object subgraphs.
 109   static KlassSubGraphInfo* _subgraph_info_list;
 110 
 111   // Contains a list of ArchivedKlassSubGraphInfoRecords that is stored
 112   // in the archive file and reloaded at runtime.
 113   static int _num_archived_subgraph_info_records;
 114   static Array<ArchivedKlassSubGraphInfoRecord>* _archived_subgraph_info_records;
 115 
 116   // Archive object sub-graph starting from the given static field
 117   // in Klass k's mirror.
 118   static void archive_reachable_objects_from_static_field(
 119     Klass* k, int field_ofset, BasicType field_type, TRAPS);
 120 
 121   static KlassSubGraphInfo* find_subgraph_info(Klass *k);
 122   static KlassSubGraphInfo* get_subgraph_info(Klass *k);
 123   static int num_of_subgraph_infos();
 124 
 125   static size_t build_archived_subgraph_info_records(int num_records);





 126 #endif // INCLUDE_CDS_JAVA_HEAP
 127  public:
 128   static char* read_archived_subgraph_infos(char* buffer) NOT_CDS_JAVA_HEAP_RETURN_(buffer);
 129   static void write_archived_subgraph_infos() NOT_CDS_JAVA_HEAP_RETURN;
 130   static void initialize_from_archived_subgraph(Klass* k) NOT_CDS_JAVA_HEAP_RETURN;
 131 











 132   static void init_archivable_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
 133   static void archive_module_graph_objects(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;




 134 };
 135 #endif // SHARE_VM_MEMORY_HEAPSHARED_HPP


  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_MEMORY_HEAPSHARED_HPP
  26 #define SHARE_VM_MEMORY_HEAPSHARED_HPP
  27 
  28 #include "classfile/systemDictionary.hpp"
  29 #include "memory/universe.hpp"
  30 #include "oops/objArrayKlass.hpp"
  31 #include "oops/oop.hpp"
  32 #include "oops/typeArrayKlass.hpp"
  33 #include "utilities/bitMap.hpp"
  34 #include "utilities/growableArray.hpp"
  35 
  36 #if INCLUDE_CDS_JAVA_HEAP
  37 // A dump time sub-graph info for Klass _k. It includes the entry points
  38 // (static fields in _k's mirror) of the archived sub-graphs reachable
  39 // from _k's mirror. It also contains a list of Klasses of the objects
  40 // within the sub-graphs.
  41 class KlassSubGraphInfo: public CHeapObj<mtClass> {
  42  private:
  43   KlassSubGraphInfo* _next;
  44   // The class that contains the static field(s) as the entry point(s)
  45   // of archived object sub-graph(s).
  46   Klass* _k;
  47   // A list of classes need to be loaded and initialized before the archived
  48   // object sub-graphs can be accessed at runtime.
  49   GrowableArray<Klass*>* _subgraph_object_klasses;
  50   // A list of _k's static fields as the entry points of archived sub-graphs.
  51   // For each entry field, it is a pair of field_offset and field_value.
  52   GrowableArray<juint>*  _subgraph_entry_fields;
  53 


 107 #if INCLUDE_CDS_JAVA_HEAP
 108   // This is a list of subgraph infos built at dump time while
 109   // archiving object subgraphs.
 110   static KlassSubGraphInfo* _subgraph_info_list;
 111 
 112   // Contains a list of ArchivedKlassSubGraphInfoRecords that is stored
 113   // in the archive file and reloaded at runtime.
 114   static int _num_archived_subgraph_info_records;
 115   static Array<ArchivedKlassSubGraphInfoRecord>* _archived_subgraph_info_records;
 116 
 117   // Archive object sub-graph starting from the given static field
 118   // in Klass k's mirror.
 119   static void archive_reachable_objects_from_static_field(
 120     Klass* k, int field_ofset, BasicType field_type, TRAPS);
 121 
 122   static KlassSubGraphInfo* find_subgraph_info(Klass *k);
 123   static KlassSubGraphInfo* get_subgraph_info(Klass *k);
 124   static int num_of_subgraph_infos();
 125 
 126   static size_t build_archived_subgraph_info_records(int num_records);
 127 
 128   // Used by decode_with_archived_oop_encoding_mode
 129   static address _narrow_oop_base;
 130   static int     _narrow_oop_shift;
 131 
 132 #endif // INCLUDE_CDS_JAVA_HEAP
 133  public:
 134   static char* read_archived_subgraph_infos(char* buffer) NOT_CDS_JAVA_HEAP_RETURN_(buffer);
 135   static void write_archived_subgraph_infos() NOT_CDS_JAVA_HEAP_RETURN;
 136   static void initialize_from_archived_subgraph(Klass* k) NOT_CDS_JAVA_HEAP_RETURN;
 137 
 138   // NarrowOops stored in the CDS archive may use a different encoding scheme
 139   // than Universe::narrow_oop_{base,shift} -- see FileMapInfo::map_heap_regions_impl.
 140   // To decode them, do not use CompressedOops::decode_not_null. Use this
 141   // function instead.
 142   inline static oop decode_with_archived_oop_encoding_mode(narrowOop v) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 143 
 144   static void init_narrow_oop_decoding(address base, int shift) NOT_CDS_JAVA_HEAP_RETURN;
 145 
 146   static void patch_archived_heap_embedded_pointers(MemRegion mem, address  oopmap,
 147                                                     size_t oopmap_in_bits) NOT_CDS_JAVA_HEAP_RETURN;
 148 
 149   static void init_archivable_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
 150   static void archive_module_graph_objects(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
 151 
 152 #if INCLUDE_CDS_JAVA_HEAP
 153   static ResourceBitMap calculate_oopmap(MemRegion region);
 154 #endif
 155 };
 156 #endif // SHARE_VM_MEMORY_HEAPSHARED_HPP
< prev index next >