< prev index next > src/hotspot/share/cds/heapShared.hpp
Print this page
#ifndef SHARE_CDS_HEAPSHARED_HPP
#define SHARE_CDS_HEAPSHARED_HPP
#include "cds/aotMetaspace.hpp"
+ #include "cds/cds_globals.hpp"
#include "cds/dumpTimeClassInfo.hpp"
#include "classfile/compactHashtable.hpp"
#include "classfile/javaClasses.hpp"
#include "gc/shared/gc_globals.hpp"
#include "memory/allocation.hpp"
#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;
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;
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.
// 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,
// - Universe::<xxx>_exception_instance()
static KlassSubGraphInfo* _dump_time_special_subgraph; // for collecting info during dump time
static ArchivedKlassSubGraphInfoRecord* _run_time_special_subgraph; // for initializing classes during run time.
static GrowableArrayCHeap<oop, mtClassShared>* _pending_roots;
+ static GrowableArrayCHeap<const char*, mtClassShared>* _context; // for debugging unarchivable objects
static OopHandle _scratch_basic_type_mirrors[T_VOID+1];
static MetaspaceObjToOopHandleTable* _scratch_objects_table;
static void init_seen_objects_table() {
assert(_seen_objects_table == nullptr, "must be");
assert(_seen_objects_table != nullptr, "must be");
delete _seen_objects_table;
_seen_objects_table = nullptr;
}
+ class ContextMark;
+
// Statistics (for one round of start_recording_subgraph ... done_recording_subgraph)
static size_t _num_new_walked_objs;
static size_t _num_new_archived_objs;
static size_t _num_old_recorded_klasses;
static PendingOop _object_being_archived;
static bool walk_one_object(PendingOopStack* stack, int level, KlassSubGraphInfo* subgraph_info,
oop orig_obj, oop referrer);
public:
+ static void exit_on_error();
static void reset_archived_object_states(TRAPS);
static void create_archived_object_cache() {
_archived_object_cache =
new (mtClass)ArchivedObjectCache(INITIAL_TABLE_SIZE, MAX_TABLE_SIZE);
}
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);
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);
+ static void track_scratch_object(oop orig_obj, oop scratch_obj);
+
// Scratch objects for archiving Klass::java_mirror()
static void set_scratch_java_mirror(Klass* k, oop mirror);
static void remove_scratch_objects(Klass* k);
static bool is_metadata_field(oop src_obj, int offset);
template <typename T> static void do_metadata_offsets(oop src_obj, T callback);
// 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;
#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 >