< prev index next >

src/hotspot/share/cds/heapShared.hpp

Print this page
@@ -38,11 +38,10 @@
  #include "oops/oopsHierarchy.hpp"
  #include "utilities/growableArray.hpp"
  #include "utilities/hashTable.hpp"
  
  #if INCLUDE_CDS_JAVA_HEAP
- class DumpedInternedStrings;
  class FileMapInfo;
  class KlassSubGraphInfo;
  class MetaspaceObjToOopHandleTable;
  class ResourceBitMap;
  

@@ -174,11 +173,11 @@
    static bool is_too_large_to_archive(oop obj);
  
    static void initialize_streaming() NOT_CDS_JAVA_HEAP_RETURN;
    static void enable_gc() NOT_CDS_JAVA_HEAP_RETURN;
    static void materialize_thread_object() NOT_CDS_JAVA_HEAP_RETURN;
-   static void add_to_dumped_interned_strings(oop string) NOT_CDS_JAVA_HEAP_RETURN;
+   static void archive_interned_string(oop string);
    static void finalize_initialization(FileMapInfo* static_mapinfo) NOT_CDS_JAVA_HEAP_RETURN;
  
  private:
  #if INCLUDE_CDS_JAVA_HEAP
    static HeapArchiveMode _heap_load_mode;

@@ -194,16 +193,11 @@
    static void count_allocation(size_t size);
    static void print_stats();
  public:
    static void debug_trace();
    static unsigned oop_hash(oop const& p);
-   static unsigned oop_handle_hash(OopHandle const& oh);
-   static unsigned oop_handle_hash_raw(OopHandle const& oh);
    static bool oop_handle_equals(const OopHandle& a, const OopHandle& b);
-   static unsigned string_oop_hash(oop const& string) {
-     return java_lang_String::hash_code(string);
-   }
  
    class CopyKlassSubGraphInfoToArchive;
  
    class CachedOopInfo {
      // Used by CDSHeapVerifier.

@@ -215,31 +209,41 @@
      // One or more fields in this object are pointing to non-null oops.
      bool _has_oop_pointers;
  
      // One or more fields in this object are pointing to MetaspaceObj
      bool _has_native_pointers;
+ 
+     // >= 0 if this oop has been append to the list of roots
+     int _root_index;
    public:
      CachedOopInfo(OopHandle orig_referrer, bool has_oop_pointers)
        : _orig_referrer(orig_referrer),
          _buffer_offset(0),
          _has_oop_pointers(has_oop_pointers),
-         _has_native_pointers(false) {}
+         _has_native_pointers(false),
+         _root_index(-1) {}
      oop orig_referrer() const;
      void set_buffer_offset(size_t offset) { _buffer_offset = offset; }
      size_t buffer_offset()          const { return _buffer_offset;   }
      bool has_oop_pointers()         const { return _has_oop_pointers; }
      bool has_native_pointers()      const { return _has_native_pointers; }
      void set_has_native_pointers()        { _has_native_pointers = true; }
+     int  root_index()               const { return _root_index; }
+     void set_root_index(int i)            { _root_index = i; }
    };
  
  private:
    static const int INITIAL_TABLE_SIZE = 15889; // prime number
    static const int MAX_TABLE_SIZE     = 1000000;
+   static bool _use_identity_hash_for_archived_object_cache;
+ 
+   static unsigned archived_object_cache_hash(OopHandle const& oh);
+ 
    typedef ResizeableHashTable<OopHandle, CachedOopInfo,
        AnyObj::C_HEAP,
        mtClassShared,
-       HeapShared::oop_handle_hash_raw,
+       HeapShared::archived_object_cache_hash,
        HeapShared::oop_handle_equals> ArchivedObjectCache;
    static ArchivedObjectCache* _archived_object_cache;
  
    class DumpTimeKlassSubGraphInfoTable
      : public HashTable<Klass*, KlassSubGraphInfo,

@@ -392,10 +396,11 @@
    }
    static void destroy_archived_object_cache() {
      delete _archived_object_cache;
      _archived_object_cache = nullptr;
    }
+   static void make_archived_object_cache_gc_safe();
    static ArchivedObjectCache* archived_object_cache() {
      return _archived_object_cache;
    }
  
    static CachedOopInfo* get_cached_oop_info(oop orig_obj);

@@ -404,10 +409,11 @@
  
    static bool archive_reachable_objects_from(int level,
                                               KlassSubGraphInfo* subgraph_info,
                                               oop orig_obj);
  
+   static bool is_interned_string(oop obj);
    static bool is_dumped_interned_string(oop o);
  
    // Scratch objects for archiving Klass::java_mirror()
    static void set_scratch_java_mirror(Klass* k, oop mirror);
    static void remove_scratch_objects(Klass* k);

@@ -435,21 +441,24 @@
    // Other types of roots are also cleared similarly when they become referenced.
  
    // Dump-time only. Returns the index of the root, which can be used at run time to read
    // the root using get_root(index, ...).
    static int append_root(oop obj);
+ 
+   // AOT-compile time only.
+   // Returns -1 if obj is not in the heap root set.
+   static int get_root_index(oop obj) NOT_CDS_JAVA_HEAP_RETURN_(-1);
+ 
    static GrowableArrayCHeap<oop, mtClassShared>* pending_roots() { return _pending_roots; }
  
    // Dump-time and runtime
    static objArrayOop root_segment(int segment_idx);
    static oop get_root(int index, bool clear=false);
  
    // Run-time only
    static void clear_root(int index);
- 
    static void get_segment_indexes(int index, int& segment_index, int& internal_index);
- 
    static void setup_test_class(const char* test_class_name) PRODUCT_RETURN;
  #endif // INCLUDE_CDS_JAVA_HEAP
  
   public:
    static void finish_materialize_objects() NOT_CDS_JAVA_HEAP_RETURN;

@@ -480,10 +489,11 @@
  #endif
  
    static void initialize_java_lang_invoke(TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
    static void init_classes_for_special_subgraph(Handle loader, TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
  
+   static bool is_core_java_lang_invoke_klass(InstanceKlass* ik) NOT_CDS_JAVA_HEAP_RETURN_(false);
    static bool is_lambda_form_klass(InstanceKlass* ik) NOT_CDS_JAVA_HEAP_RETURN_(false);
    static bool is_lambda_proxy_klass(InstanceKlass* ik) NOT_CDS_JAVA_HEAP_RETURN_(false);
    static bool is_string_concat_klass(InstanceKlass* ik) NOT_CDS_JAVA_HEAP_RETURN_(false);
    static bool is_archivable_hidden_klass(InstanceKlass* ik) NOT_CDS_JAVA_HEAP_RETURN_(false);
  
< prev index next >