Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hotspot/os/linux/gc/x/xPhysicalMemoryBacking_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ bool XPhysicalMemoryBacking::commit_inner(size_t offset, size_t length) const {
}

static int offset_to_node(size_t offset) {
const GrowableArray<int>* mapping = os::Linux::numa_nindex_to_node();
const GrowableArrayCHeap<int, mtInternal>* mapping = os::Linux::numa_nindex_to_node();
const size_t nindex = (offset >> XGranuleSizeShift) % mapping->length();
return mapping->at((int)nindex);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ bool ZPhysicalMemoryBacking::commit_inner(zoffset offset, size_t length) const {
}

static int offset_to_node(zoffset offset) {
const GrowableArray<int>* mapping = os::Linux::numa_nindex_to_node();
const GrowableArrayCHeap<int, mtInternal>* mapping = os::Linux::numa_nindex_to_node();
const size_t nindex = (untype(offset) >> ZGranuleSizeShift) % mapping->length();
return mapping->at((int)nindex);
}
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/os/linux/os_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3145,10 +3145,10 @@ bool os::Linux::libnuma_init() {
set_numa_interleave_bitmask(_numa_get_interleave_mask());
set_numa_membind_bitmask(_numa_get_membind());
// Create an index -> node mapping, since nodes are not always consecutive
_nindex_to_node = new (mtInternal) GrowableArray<int>(0, mtInternal);
_nindex_to_node = new GrowableArrayCHeap<int, mtInternal>(0);
rebuild_nindex_to_node_map();
// Create a cpu -> node mapping
_cpu_to_node = new (mtInternal) GrowableArray<int>(0, mtInternal);
_cpu_to_node = new GrowableArrayCHeap<int, mtInternal>(0);
rebuild_cpu_to_node_map();
return true;
}
Expand Down Expand Up @@ -3307,8 +3307,8 @@ int os::Linux::get_node_by_cpu(int cpu_id) {
return -1;
}

GrowableArray<int>* os::Linux::_cpu_to_node;
GrowableArray<int>* os::Linux::_nindex_to_node;
GrowableArrayCHeap<int, mtInternal>* os::Linux::_cpu_to_node;
GrowableArrayCHeap<int, mtInternal>* os::Linux::_nindex_to_node;
os::Linux::sched_getcpu_func_t os::Linux::_sched_getcpu;
os::Linux::numa_node_to_cpus_func_t os::Linux::_numa_node_to_cpus;
os::Linux::numa_node_to_cpus_v2_func_t os::Linux::_numa_node_to_cpus_v2;
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/os/linux/os_linux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class os::Linux {

static bool _supports_fast_thread_cpu_time;

static GrowableArray<int>* _cpu_to_node;
static GrowableArray<int>* _nindex_to_node;
static GrowableArrayCHeap<int, mtInternal>* _cpu_to_node;
static GrowableArrayCHeap<int, mtInternal>* _nindex_to_node;

static julong available_memory_in_container();

Expand All @@ -71,8 +71,8 @@ class os::Linux {

static void rebuild_cpu_to_node_map();
static void rebuild_nindex_to_node_map();
static GrowableArray<int>* cpu_to_node() { return _cpu_to_node; }
static GrowableArray<int>* nindex_to_node() { return _nindex_to_node; }
static GrowableArrayCHeap<int, mtInternal>* cpu_to_node() { return _cpu_to_node; }
static GrowableArrayCHeap<int, mtInternal>* nindex_to_node() { return _nindex_to_node; }

static void print_process_memory_info(outputStream* st);
static void print_system_memory_info(outputStream* st);
Expand Down Expand Up @@ -384,7 +384,7 @@ class os::Linux {
}
}

static const GrowableArray<int>* numa_nindex_to_node() {
static const GrowableArrayCHeap<int, mtInternal>* numa_nindex_to_node() {
return _nindex_to_node;
}

Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/cds/archiveBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ArchiveBuilder::OtherROAllocMark::~OtherROAllocMark() {

ArchiveBuilder::SourceObjList::SourceObjList() : _ptrmap(16 * K, mtClassShared) {
_total_bytes = 0;
_objs = new (mtClassShared) GrowableArray<SourceObjInfo*>(128 * K, mtClassShared);
_objs = new GrowableArrayCHeap<SourceObjInfo*, mtClassShared>(128 * K);
}

ArchiveBuilder::SourceObjList::~SourceObjList() {
Expand Down Expand Up @@ -166,8 +166,8 @@ ArchiveBuilder::ArchiveBuilder() :
_estimated_metaspaceobj_bytes(0),
_estimated_hashtable_bytes(0)
{
_klasses = new (mtClassShared) GrowableArray<Klass*>(4 * K, mtClassShared);
_symbols = new (mtClassShared) GrowableArray<Symbol*>(256 * K, mtClassShared);
_klasses = new GrowableArrayCHeap<Klass*, mtClassShared>(4 * K);
_symbols = new GrowableArrayCHeap<Symbol*, mtClassShared>(256 * K);

assert(_current == nullptr, "must be");
_current = this;
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/share/cds/archiveBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ class ArchiveBuilder : public StackObj {

class SourceObjList {
uintx _total_bytes;
GrowableArray<SourceObjInfo*>* _objs; // Source objects to be archived
GrowableArrayCHeap<SourceObjInfo*, mtClassShared>* _objs; // Source objects to be archived
CHeapBitMap _ptrmap; // Marks the addresses of the pointer fields
// in the source objects
public:
SourceObjList();
~SourceObjList();

GrowableArray<SourceObjInfo*>* objs() const { return _objs; }
GrowableArrayCHeap<SourceObjInfo*, mtClassShared>* objs() const { return _objs; }

void append(SourceObjInfo* src_info);
void remember_embedded_pointer(SourceObjInfo* pointing_obj, MetaspaceClosure::Ref* ref);
Expand All @@ -210,8 +210,8 @@ class ArchiveBuilder : public StackObj {
SourceObjList _ro_src_objs; // objs to put in ro region
ResizeableResourceHashtable<address, SourceObjInfo, AnyObj::C_HEAP, mtClassShared> _src_obj_table;
ResizeableResourceHashtable<address, address, AnyObj::C_HEAP, mtClassShared> _buffered_to_src_table;
GrowableArray<Klass*>* _klasses;
GrowableArray<Symbol*>* _symbols;
GrowableArrayCHeap<Klass*, mtClassShared>* _klasses;
GrowableArrayCHeap<Symbol*, mtClassShared>* _symbols;

// statistics
DumpAllocStats _alloc_stats;
Expand Down Expand Up @@ -401,8 +401,8 @@ class ArchiveBuilder : public StackObj {
}

// All klasses and symbols that will be copied into the archive
GrowableArray<Klass*>* klasses() const { return _klasses; }
GrowableArray<Symbol*>* symbols() const { return _symbols; }
GrowableArrayCHeap<Klass*, mtClassShared>* klasses() const { return _klasses; }
GrowableArrayCHeap<Symbol*, mtClassShared>* symbols() const { return _symbols; }

static bool is_active() {
return (_current != nullptr);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/cds/classListParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ ClassListParser::ClassListParser(const char* file, ParseMode parse_mode) : _id2k
}
_line_no = 0;
_token = _line;
_interfaces = new (mtClass) GrowableArray<int>(10, mtClass);
_indy_items = new (mtClass) GrowableArray<const char*>(9, mtClass);
_interfaces = new GrowableArrayCHeap<int, mtClass>(10);
_indy_items = new GrowableArrayCHeap<const char*, mtClass>(9);
_parse_mode = parse_mode;

// _instance should only be accessed by the thread that created _instance.
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/cds/classListParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ class ClassListParser : public StackObj {
int _line_len; // Original length of the input line.
int _line_no; // Line number for current line being parsed
const char* _class_name;
GrowableArray<const char*>* _indy_items; // items related to invoke dynamic for archiving lambda proxy classes
GrowableArrayCHeap<const char*, mtClass>* _indy_items; // items related to invoke dynamic for archiving lambda proxy classes
int _id;
int _super;
GrowableArray<int>* _interfaces;
GrowableArrayCHeap<int, mtClass>* _interfaces;
bool _interfaces_specified;
const char* _source;
bool _lambda_form_line;
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/share/cds/dumpTimeClassInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ size_t DumpTimeClassInfo::runtime_info_bytesize() const {
void DumpTimeClassInfo::add_verification_constraint(InstanceKlass* k, Symbol* name,
Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object) {
if (_verifier_constraints == nullptr) {
_verifier_constraints = new (mtClass) GrowableArray<DTVerifierConstraint>(4, mtClass);
_verifier_constraints = new GrowableArrayCHeap<DTVerifierConstraint, mtClass>(4);
}
if (_verifier_constraint_flags == nullptr) {
_verifier_constraint_flags = new (mtClass) GrowableArray<char>(4, mtClass);
_verifier_constraint_flags = new GrowableArrayCHeap<char, mtClass>(4);
}
GrowableArray<DTVerifierConstraint>* vc_array = _verifier_constraints;
GrowableArrayCHeap<DTVerifierConstraint, mtClass>* vc_array = _verifier_constraints;
for (int i = 0; i < vc_array->length(); i++) {
if (vc_array->at(i).equals(name, from_name)) {
return;
Expand All @@ -65,7 +65,7 @@ void DumpTimeClassInfo::add_verification_constraint(InstanceKlass* k, Symbol* na
DTVerifierConstraint cons(name, from_name);
vc_array->append(cons);

GrowableArray<char>* vcflags_array = _verifier_constraint_flags;
GrowableArrayCHeap<char, mtClass>* vcflags_array = _verifier_constraint_flags;
char c = 0;
c |= from_field_is_protected ? SystemDictionaryShared::FROM_FIELD_IS_PROTECTED : 0;
c |= from_is_array ? SystemDictionaryShared::FROM_IS_ARRAY : 0;
Expand Down Expand Up @@ -96,7 +96,7 @@ void DumpTimeClassInfo::record_linking_constraint(Symbol* name, Handle loader1,
assert(loader1 != loader2, "sanity");
LogTarget(Info, class, loader, constraints) log;
if (_loader_constraints == nullptr) {
_loader_constraints = new (mtClass) GrowableArray<DTLoaderConstraint>(4, mtClass);
_loader_constraints = new GrowableArrayCHeap<DTLoaderConstraint, mtClass>(4);
}
char lt1 = get_loader_type_by(loader1());
char lt2 = get_loader_type_by(loader2());
Expand Down Expand Up @@ -128,7 +128,7 @@ void DumpTimeClassInfo::record_linking_constraint(Symbol* name, Handle loader1,

void DumpTimeClassInfo::add_enum_klass_static_field(int archived_heap_root_index) {
if (_enum_klass_static_fields == nullptr) {
_enum_klass_static_fields = new (mtClass) GrowableArray<int>(20, mtClass);
_enum_klass_static_fields = new GrowableArrayCHeap<int, mtClass>(20);
}
_enum_klass_static_fields->append(archived_heap_root_index);
}
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/share/cds/dumpTimeClassInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ class DumpTimeClassInfo: public CHeapObj<mtClass> {
int _id;
int _clsfile_size;
int _clsfile_crc32;
GrowableArray<DTVerifierConstraint>* _verifier_constraints;
GrowableArray<char>* _verifier_constraint_flags;
GrowableArray<DTLoaderConstraint>* _loader_constraints;
GrowableArray<int>* _enum_klass_static_fields;
GrowableArrayCHeap<DTVerifierConstraint, mtClass>* _verifier_constraints;
GrowableArrayCHeap<char, mtClass>* _verifier_constraint_flags;
GrowableArrayCHeap<DTLoaderConstraint, mtClass>* _loader_constraints;
GrowableArrayCHeap<int, mtClass>* _enum_klass_static_fields;

DumpTimeClassInfo() {
_klass = nullptr;
Expand Down Expand Up @@ -159,7 +159,7 @@ class DumpTimeClassInfo: public CHeapObj<mtClass> {

private:
template <typename T>
static int array_length_or_zero(GrowableArray<T>* array) {
static int array_length_or_zero(GrowableArrayCHeap<T, mtClass>* array) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argument could be GrowableArrayView<T>*, removing the coupling on the memory type.

Also, pre-existing: the argument should be const.

if (array == nullptr) {
return 0;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/cds/dynamicArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,12 @@ class VM_PopulateDynamicDumpSharedSpace: public VM_GC_Sync_Operation {

// _array_klasses and _dynamic_archive_array_klasses only hold the array klasses
// which have element klass in the static archive.
GrowableArray<ObjArrayKlass*>* DynamicArchive::_array_klasses = nullptr;
GrowableArrayCHeap<ObjArrayKlass*, mtClassShared>* DynamicArchive::_array_klasses = nullptr;
Array<ObjArrayKlass*>* DynamicArchive::_dynamic_archive_array_klasses = nullptr;

void DynamicArchive::append_array_klass(ObjArrayKlass* ak) {
if (_array_klasses == nullptr) {
_array_klasses = new (mtClassShared) GrowableArray<ObjArrayKlass*>(50, mtClassShared);
_array_klasses = new GrowableArrayCHeap<ObjArrayKlass*, mtClassShared>(50);
}
_array_klasses->append(ak);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/cds/dynamicArchive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DynamicArchiveHeader : public FileMapHeader {

class DynamicArchive : AllStatic {
private:
static GrowableArray<ObjArrayKlass*>* _array_klasses;
static GrowableArrayCHeap<ObjArrayKlass*, mtClassShared>* _array_klasses;
static Array<ObjArrayKlass*>* _dynamic_archive_array_klasses;
public:
static void check_for_dynamic_dump();
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/cds/filemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ void FileMapInfo::record_non_existent_class_path_entry(const char* path) {
assert(CDSConfig::is_dumping_archive(), "sanity");
log_info(class, path)("non-existent Class-Path entry %s", path);
if (_non_existent_class_paths == nullptr) {
_non_existent_class_paths = new (mtClass) GrowableArray<const char*>(10, mtClass);
_non_existent_class_paths = new GrowableArrayCHeap<const char*, mtClass>(10);
}
_non_existent_class_paths->append(os::strdup(path));
}
Expand Down Expand Up @@ -2246,7 +2246,7 @@ bool FileMapInfo::_heap_pointers_need_patching = false;
SharedPathTable FileMapInfo::_shared_path_table;
bool FileMapInfo::_validating_shared_path_table = false;
bool FileMapInfo::_memory_mapping_failed = false;
GrowableArray<const char*>* FileMapInfo::_non_existent_class_paths = nullptr;
GrowableArrayCHeap<const char*, mtClass>* FileMapInfo::_non_existent_class_paths = nullptr;

// Open the shared archive file, read and validate the header
// information (version, boot classpath, etc.). If initialization
Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/cds/filemap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class ClassLoaderData;
class ClassPathEntry;
class outputStream;

template<class E> class GrowableArray;
template<class E, MEMFLAGS F> class GrowableArrayCHeap;

class SharedClassPathEntry : public MetaspaceObj {
enum {
modules_image_entry,
Expand Down Expand Up @@ -342,7 +345,7 @@ class FileMapInfo : public CHeapObj<mtInternal> {
static FileMapInfo* _dynamic_archive_info;
static bool _heap_pointers_need_patching;
static bool _memory_mapping_failed;
static GrowableArray<const char*>* _non_existent_class_paths;
static GrowableArrayCHeap<const char*, mtClass>* _non_existent_class_paths;

public:
FileMapHeader *header() const { return _header; }
Expand Down
14 changes: 6 additions & 8 deletions src/hotspot/share/cds/heapShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ void HeapShared::archive_java_mirrors() {
}
}

GrowableArray<Klass*>* klasses = ArchiveBuilder::current()->klasses();
GrowableArrayCHeap<Klass*, mtClassShared>* klasses = ArchiveBuilder::current()->klasses();
assert(klasses != nullptr, "sanity");
for (int i = 0; i < klasses->length(); i++) {
Klass* orig_k = klasses->at(i);
Expand Down Expand Up @@ -621,8 +621,7 @@ KlassSubGraphInfo* HeapShared::get_subgraph_info(Klass* k) {
void KlassSubGraphInfo::add_subgraph_entry_field(int static_field_offset, oop v) {
assert(CDSConfig::is_dumping_heap(), "dump time only");
if (_subgraph_entry_fields == nullptr) {
_subgraph_entry_fields =
new (mtClass) GrowableArray<int>(10, mtClass);
_subgraph_entry_fields = new GrowableArrayCHeap<int, mtClass>(10);
}
_subgraph_entry_fields->append(static_field_offset);
_subgraph_entry_fields->append(HeapShared::append_root(v));
Expand All @@ -635,8 +634,7 @@ void KlassSubGraphInfo::add_subgraph_object_klass(Klass* orig_k) {
Klass* buffered_k = ArchiveBuilder::get_buffered_klass(orig_k);

if (_subgraph_object_klasses == nullptr) {
_subgraph_object_klasses =
new (mtClass) GrowableArray<Klass*>(50, mtClass);
_subgraph_object_klasses = new GrowableArrayCHeap<Klass*, mtClass>(50);
}

assert(ArchiveBuilder::current()->is_in_buffer_space(buffered_k), "must be a shared class");
Expand Down Expand Up @@ -751,7 +749,7 @@ void ArchivedKlassSubGraphInfoRecord::init(KlassSubGraphInfo* info) {
}

// populate the entry fields
GrowableArray<int>* entry_fields = info->subgraph_entry_fields();
GrowableArrayCHeap<int, mtClass>* entry_fields = info->subgraph_entry_fields();
if (entry_fields != nullptr) {
int num_entry_fields = entry_fields->length();
assert(num_entry_fields % 2 == 0, "sanity");
Expand All @@ -763,7 +761,7 @@ void ArchivedKlassSubGraphInfoRecord::init(KlassSubGraphInfo* info) {
}

// the Klasses of the objects in the sub-graphs
GrowableArray<Klass*>* subgraph_object_klasses = info->subgraph_object_klasses();
GrowableArrayCHeap<Klass*, mtClass>* subgraph_object_klasses = info->subgraph_object_klasses();
if (subgraph_object_klasses != nullptr) {
int num_subgraphs_klasses = subgraph_object_klasses->length();
_subgraph_object_klasses =
Expand Down Expand Up @@ -1341,7 +1339,7 @@ void HeapShared::verify_reachable_objects_from(oop obj) {
// Make sure that these are only instances of the very few specific types
// that we can handle.
void HeapShared::check_default_subgraph_classes() {
GrowableArray<Klass*>* klasses = _default_subgraph_info->subgraph_object_klasses();
GrowableArrayCHeap<Klass*, mtClass>* klasses = _default_subgraph_info->subgraph_object_klasses();
int num = klasses->length();
for (int i = 0; i < num; i++) {
Klass* subgraph_k = klasses->at(i);
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/cds/heapShared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ class KlassSubGraphInfo: public CHeapObj<mtClass> {
Klass* _k;
// A list of classes need to be loaded and initialized before the archived
// object sub-graphs can be accessed at runtime.
GrowableArray<Klass*>* _subgraph_object_klasses;
GrowableArrayCHeap<Klass*, mtClass>* _subgraph_object_klasses;
// A list of _k's static fields as the entry points of archived sub-graphs.
// For each entry field, it is a tuple of field_offset, field_value
GrowableArray<int>* _subgraph_entry_fields;
GrowableArrayCHeap<int, mtClass>* _subgraph_entry_fields;

// Does this KlassSubGraphInfo belong to the archived full module graph
bool _is_full_module_graph;
Expand Down Expand Up @@ -94,10 +94,10 @@ class KlassSubGraphInfo: public CHeapObj<mtClass> {
};

Klass* klass() { return _k; }
GrowableArray<Klass*>* subgraph_object_klasses() {
GrowableArrayCHeap<Klass*, mtClass>* subgraph_object_klasses() {
return _subgraph_object_klasses;
}
GrowableArray<int>* subgraph_entry_fields() {
GrowableArrayCHeap<int, mtClass>* subgraph_entry_fields() {
return _subgraph_entry_fields;
}
void add_subgraph_entry_field(int static_field_offset, oop v);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/cds/lambdaProxyClassDictionary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ class LambdaProxyClassKey {

class DumpTimeLambdaProxyClassInfo {
public:
GrowableArray<InstanceKlass*>* _proxy_klasses;
GrowableArrayCHeap<InstanceKlass*, mtClassShared>* _proxy_klasses;
DumpTimeLambdaProxyClassInfo() : _proxy_klasses(nullptr) {}
DumpTimeLambdaProxyClassInfo& operator=(const DumpTimeLambdaProxyClassInfo&) = delete;
~DumpTimeLambdaProxyClassInfo();

void add_proxy_klass(InstanceKlass* proxy_klass) {
if (_proxy_klasses == nullptr) {
_proxy_klasses = new (mtClassShared) GrowableArray<InstanceKlass*>(5, mtClassShared);
_proxy_klasses = new GrowableArrayCHeap<InstanceKlass*, mtClassShared>(5);
}
assert(_proxy_klasses != nullptr, "sanity");
_proxy_klasses->append(proxy_klass);
Expand Down
Loading