Skip to content

Commit

Permalink
Merge branch 'upstream-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Datadog Syncup Service committed Nov 8, 2024
2 parents ea285c9 + 7d6a2f3 commit e51136a
Show file tree
Hide file tree
Showing 94 changed files with 1,803 additions and 681 deletions.
18 changes: 1 addition & 17 deletions src/hotspot/cpu/ppc/c2_init_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,5 @@
// Processor dependent initialization of C2 compiler for ppc.

void Compile::pd_compiler2_init() {

// Power7 and later.
if (PowerArchitecturePPC64 > 6) {
if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
FLAG_SET_ERGO(UsePopCountInstruction, true);
}
}

if (!VM_Version::has_isel() && FLAG_IS_DEFAULT(ConditionalMoveLimit)) {
FLAG_SET_ERGO(ConditionalMoveLimit, 0);
}

if (OptimizeFill) {
warning("OptimizeFill is not supported on this CPU.");
FLAG_SET_DEFAULT(OptimizeFill, false);
}

guarantee(CodeEntryAlignment >= InteriorEntryAlignment, "");
}
22 changes: 22 additions & 0 deletions src/hotspot/cpu/ppc/vm_version_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ void VM_Version::initialize() {
FLAG_SET_ERGO(TrapBasedRangeChecks, false);
}

// Power7 and later.
if (PowerArchitecturePPC64 > 6) {
if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
FLAG_SET_ERGO(UsePopCountInstruction, true);
}
}

if (!VM_Version::has_isel() && FLAG_IS_DEFAULT(ConditionalMoveLimit)) {
FLAG_SET_ERGO(ConditionalMoveLimit, 0);
}

if (PowerArchitecturePPC64 >= 8) {
if (FLAG_IS_DEFAULT(SuperwordUseVSX)) {
FLAG_SET_ERGO(SuperwordUseVSX, true);
Expand Down Expand Up @@ -169,6 +180,17 @@ void VM_Version::initialize() {
FLAG_SET_DEFAULT(UseByteReverseInstructions, false);
}
}

if (OptimizeFill) {
warning("OptimizeFill is not supported on this CPU.");
FLAG_SET_DEFAULT(OptimizeFill, false);
}

if (OptoScheduling) {
// The OptoScheduling information is not maintained in ppd.ad.
warning("OptoScheduling is not supported on this CPU.");
FLAG_SET_DEFAULT(OptoScheduling, false);
}
#endif

// Create and print feature-string.
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/s390/s390.ad
Original file line number Diff line number Diff line change
Expand Up @@ -2547,7 +2547,7 @@ operand uimmI8() %{
// operand type int
// Unsigned Integer Immediate: 9-bit
operand SSlenDW() %{
predicate(Immediate::is_uimm8(n->get_long()-1));
predicate(Immediate::is_uimm8((julong)n->get_long()-1));
match(ConL);
op_cost(1);
format %{ %}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/aix/os_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ static void query_multipage_support() {

// Can we use mmap with 64K pages? (Should be available with AIX7.3 TL1)
{
void* p = mmap(NULL, 64*K, PROT_READ | PROT_WRITE, MAP_ANON_64K | MAP_ANONYMOUS | MAP_SHARED, -1, 0);
void* p = mmap(nullptr, 64*K, PROT_READ | PROT_WRITE, MAP_ANON_64K | MAP_ANONYMOUS | MAP_SHARED, -1, 0);
assert(p != (void*) -1, "mmap failed");
if (p != (void*) -1) {
g_multipage_support.can_use_64K_mmap_pages = (64*K == os::Aix::query_pagesize(p));
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/os/linux/cgroupSubsystem_linux.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -167,7 +167,7 @@ static bool find_ro_opt(char* mount_opts) {
char* token;
char* mo_ptr = mount_opts;
// mount options are comma-separated (man proc).
while ((token = strsep(&mo_ptr, ",")) != NULL) {
while ((token = strsep(&mo_ptr, ",")) != nullptr) {
if (strcmp(token, "ro") == 0) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/posix/os_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ void* os::dll_lookup(void* handle, const char* name) {
void* ret = ::dlsym(handle, name);
if (ret == nullptr) {
const char* tmp = ::dlerror();
// It is possible that we found a NULL symbol, hence no error.
// It is possible that we found a null symbol, hence no error.
if (tmp != nullptr) {
log_debug(os)("Symbol %s not found in dll: %s", name, tmp);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4150,7 +4150,7 @@ void getWindowsInstallationType(char* buffer, int bufferSize) {
}

// Query the value
if (RegQueryValueExA(hKey, valueName, NULL, NULL, (LPBYTE)buffer, &valueLength) != ERROR_SUCCESS) {
if (RegQueryValueExA(hKey, valueName, nullptr, nullptr, (LPBYTE)buffer, &valueLength) != ERROR_SUCCESS) {
RegCloseKey(hKey);
buffer[0] = '\0';
return;
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/share/cds/archiveUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,8 @@ void WriteClosure::do_ptr(void** p) {
void ReadClosure::do_ptr(void** p) {
assert(*p == nullptr, "initializing previous initialized pointer.");
intptr_t obj = nextPtr();
assert((intptr_t)obj >= 0 || (intptr_t)obj < -100,
"hit tag while initializing ptrs.");
*p = (void*)obj != nullptr ? (void*)(SharedBaseAddress + obj) : (void*)obj;
assert(obj >= 0, "sanity.");
*p = (obj != 0) ? (void*)(_base_address + obj) : (void*)obj;
}

void ReadClosure::do_u4(u4* p) {
Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/share/cds/archiveUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,14 @@ class WriteClosure : public SerializeClosure {
class ReadClosure : public SerializeClosure {
private:
intptr_t** _ptr_array;

intptr_t _base_address;
inline intptr_t nextPtr() {
return *(*_ptr_array)++;
}

public:
ReadClosure(intptr_t** ptr_array) { _ptr_array = ptr_array; }
ReadClosure(intptr_t** ptr_array, intptr_t base_address) :
_ptr_array(ptr_array), _base_address(base_address) {}

void do_ptr(void** p);
void do_u4(u4* p);
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/cds/filemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ void FileMapHeader::print(outputStream* st) {
st->print_cr("- compressed_oops: %d", _compressed_oops);
st->print_cr("- compressed_class_ptrs: %d", _compressed_class_ptrs);
st->print_cr("- cloned_vtables_offset: " SIZE_FORMAT_X, _cloned_vtables_offset);
st->print_cr("- early_serialized_data_offset: " SIZE_FORMAT_X, _early_serialized_data_offset);
st->print_cr("- serialized_data_offset: " SIZE_FORMAT_X, _serialized_data_offset);
st->print_cr("- jvm_ident: %s", _jvm_ident);
st->print_cr("- shared_path_table_offset: " SIZE_FORMAT_X, _shared_path_table_offset);
Expand Down
5 changes: 5 additions & 0 deletions src/hotspot/share/cds/filemap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class FileMapHeader: private CDSFileMapHeaderBase {
bool _compressed_oops; // save the flag UseCompressedOops
bool _compressed_class_ptrs; // save the flag UseCompressedClassPointers
size_t _cloned_vtables_offset; // The address of the first cloned vtable
size_t _early_serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize()
size_t _serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize()
bool _has_non_jar_in_classpath; // non-jar file entry exists in classpath
unsigned int _common_app_classpath_prefix_size; // size of the common prefix of app class paths
Expand Down Expand Up @@ -261,6 +262,7 @@ class FileMapHeader: private CDSFileMapHeaderBase {
uintx max_heap_size() const { return _max_heap_size; }
CompressedOops::Mode narrow_oop_mode() const { return _narrow_oop_mode; }
char* cloned_vtables() const { return from_mapped_offset(_cloned_vtables_offset); }
char* early_serialized_data() const { return from_mapped_offset(_early_serialized_data_offset); }
char* serialized_data() const { return from_mapped_offset(_serialized_data_offset); }
const char* jvm_ident() const { return _jvm_ident; }
char* requested_base_address() const { return _requested_base_address; }
Expand All @@ -283,6 +285,7 @@ class FileMapHeader: private CDSFileMapHeaderBase {

void set_has_platform_or_app_classes(bool v) { _has_platform_or_app_classes = v; }
void set_cloned_vtables(char* p) { set_as_offset(p, &_cloned_vtables_offset); }
void set_early_serialized_data(char* p) { set_as_offset(p, &_early_serialized_data_offset); }
void set_serialized_data(char* p) { set_as_offset(p, &_serialized_data_offset); }
void set_mapped_base_address(char* p) { _mapped_base_address = p; }
void set_heap_root_segments(HeapRootSegments segments) { _heap_root_segments = segments; }
Expand Down Expand Up @@ -396,6 +399,8 @@ class FileMapInfo : public CHeapObj<mtInternal> {

char* cloned_vtables() const { return header()->cloned_vtables(); }
void set_cloned_vtables(char* p) const { header()->set_cloned_vtables(p); }
char* early_serialized_data() const { return header()->early_serialized_data(); }
void set_early_serialized_data(char* p) const { header()->set_early_serialized_data(p); }
char* serialized_data() const { return header()->serialized_data(); }
void set_serialized_data(char* p) const { header()->set_serialized_data(p); }

Expand Down
76 changes: 66 additions & 10 deletions src/hotspot/share/cds/metaspaceShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,43 @@ void MetaspaceShared::read_extra_data(JavaThread* current, const char* filename)
}
}

// Read/write a data stream for restoring/preserving metadata pointers and
// miscellaneous data from/to the shared archive file.
// About "serialize" --
//
// This is (probably a badly named) way to read/write a data stream of pointers and
// miscellaneous data from/to the shared archive file. The usual code looks like this:
//
// // These two global C++ variables are initialized during dump time.
// static int _archived_int;
// static MetaspaceObj* archived_ptr;
//
// void MyClass::serialize(SerializeClosure* soc) {
// soc->do_int(&_archived_int);
// soc->do_int(&_archived_ptr);
// }
//
// At dumptime, these two variables are stored into the CDS archive.
// At runtime, these two variables are loaded from the CDS archive.
// In addition, the pointer is relocated as necessary.
//
// Some of the xxx::serialize() functions may have side effects and assume that
// the archive is already mapped. For example, SymbolTable::serialize_shared_table_header()
// unconditionally makes the set of archived symbols available. Therefore, we put most
// of these xxx::serialize() functions inside MetaspaceShared::serialize(), which
// is called AFTER we made the decision to map the archive.
//
// However, some of the "serialized" data are used to decide whether an archive should
// be mapped or not (e.g., for checking if the -Djdk.module.main property is compatible
// with the archive). The xxx::serialize() functions for these data must be put inside
// MetaspaceShared::early_serialize(). Such functions must not produce side effects that
// assume we will always decides to map the archive.

void MetaspaceShared::early_serialize(SerializeClosure* soc) {
int tag = 0;
soc->do_tag(--tag);
CDS_JAVA_HEAP_ONLY(Modules::serialize(soc);)
CDS_JAVA_HEAP_ONLY(Modules::serialize_addmods_names(soc);)
soc->do_tag(666);
}

void MetaspaceShared::serialize(SerializeClosure* soc) {
int tag = 0;
Expand Down Expand Up @@ -402,8 +437,6 @@ void MetaspaceShared::serialize(SerializeClosure* soc) {
SystemDictionaryShared::serialize_vm_classes(soc);
soc->do_tag(--tag);

CDS_JAVA_HEAP_ONLY(Modules::serialize(soc);)
CDS_JAVA_HEAP_ONLY(Modules::serialize_addmods_names(soc);)
CDS_JAVA_HEAP_ONLY(ClassLoaderDataShared::serialize(soc);)

LambdaFormInvokers::serialize(soc);
Expand Down Expand Up @@ -455,6 +488,7 @@ class VM_PopulateDumpSharedSpace : public VM_Operation {
log_info(cds)("Dumping symbol table ...");
SymbolTable::write_to_archive(symbols);
}
char* dump_early_read_only_tables();
char* dump_read_only_tables();

public:
Expand Down Expand Up @@ -494,17 +528,29 @@ class StaticArchiveBuilder : public ArchiveBuilder {
}
};

char* VM_PopulateDumpSharedSpace::dump_early_read_only_tables() {
ArchiveBuilder::OtherROAllocMark mark;

// Write module name into archive
CDS_JAVA_HEAP_ONLY(Modules::dump_main_module_name();)
// Write module names from --add-modules into archive
CDS_JAVA_HEAP_ONLY(Modules::dump_addmods_names();)

DumpRegion* ro_region = ArchiveBuilder::current()->ro_region();
char* start = ro_region->top();
WriteClosure wc(ro_region);
MetaspaceShared::early_serialize(&wc);
return start;
}

char* VM_PopulateDumpSharedSpace::dump_read_only_tables() {
ArchiveBuilder::OtherROAllocMark mark;

SystemDictionaryShared::write_to_archive();

// Write lambform lines into archive
LambdaFormInvokers::dump_static_archive_invokers();
// Write module name into archive
CDS_JAVA_HEAP_ONLY(Modules::dump_main_module_name();)
// Write module names from --add-modules into archive
CDS_JAVA_HEAP_ONLY(Modules::dump_addmods_names();)

// Write the other data to the output array.
DumpRegion* ro_region = ArchiveBuilder::current()->ro_region();
char* start = ro_region->top();
Expand Down Expand Up @@ -543,6 +589,7 @@ void VM_PopulateDumpSharedSpace::doit() {
log_info(cds)("Make classes shareable");
_builder.make_klasses_shareable();

char* early_serialized_data = dump_early_read_only_tables();
char* serialized_data = dump_read_only_tables();

SystemDictionaryShared::adjust_lambda_proxy_class_dictionary();
Expand All @@ -556,6 +603,7 @@ void VM_PopulateDumpSharedSpace::doit() {
assert(static_archive != nullptr, "SharedArchiveFile not set?");
_map_info = new FileMapInfo(static_archive, true);
_map_info->populate_header(MetaspaceShared::core_region_alignment());
_map_info->set_early_serialized_data(early_serialized_data);
_map_info->set_serialized_data(serialized_data);
_map_info->set_cloned_vtables(CppVtables::vtables_serialized_base());
}
Expand Down Expand Up @@ -1473,6 +1521,14 @@ MapArchiveResult MetaspaceShared::map_archive(FileMapInfo* mapinfo, char* mapped
return MAP_ARCHIVE_OTHER_FAILURE;
}

if (mapinfo->is_static()) {
// Currently, only static archive uses early serialized data.
char* buffer = mapinfo->early_serialized_data();
intptr_t* array = (intptr_t*)buffer;
ReadClosure rc(&array, (intptr_t)mapped_base_address);
early_serialize(&rc);
}

mapinfo->set_is_mapped(true);
return MAP_ARCHIVE_SUCCESS;
}
Expand Down Expand Up @@ -1509,7 +1565,7 @@ void MetaspaceShared::initialize_shared_spaces() {
// shared string/symbol tables.
char* buffer = static_mapinfo->serialized_data();
intptr_t* array = (intptr_t*)buffer;
ReadClosure rc(&array);
ReadClosure rc(&array, (intptr_t)SharedBaseAddress);
serialize(&rc);

// Finish up archived heap initialization. These must be
Expand All @@ -1526,7 +1582,7 @@ void MetaspaceShared::initialize_shared_spaces() {
FileMapInfo *dynamic_mapinfo = FileMapInfo::dynamic_info();
if (dynamic_mapinfo != nullptr) {
intptr_t* buffer = (intptr_t*)dynamic_mapinfo->serialized_data();
ReadClosure rc(&buffer);
ReadClosure rc(&buffer, (intptr_t)SharedBaseAddress);
ArchiveBuilder::serialize_dynamic_archivable_items(&rc);
DynamicArchive::setup_array_klasses();
dynamic_mapinfo->close();
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/cds/metaspaceShared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class MetaspaceShared : AllStatic {
static void unrecoverable_writing_error(const char* message = nullptr);
static void writing_error(const char* message = nullptr);

static void early_serialize(SerializeClosure* sc) NOT_CDS_RETURN;
static void serialize(SerializeClosure* sc) NOT_CDS_RETURN;

// JVM/TI RedefineClasses() support:
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/classfile/classLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ static char decode_percent_encoded(const char *str, size_t& index) {
hex[1] = str[index + 2];
hex[2] = '\0';
index += 2;
return (char) strtol(hex, NULL, 16);
return (char) strtol(hex, nullptr, 16);
}
return str[index];
}
Expand Down
6 changes: 6 additions & 0 deletions src/hotspot/share/classfile/modules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ void Modules::serialize(SerializeClosure* soc) {
}
log_info(cds)("optimized module handling: %s", CDSConfig::is_using_optimized_module_handling() ? "enabled" : "disabled");
log_info(cds)("full module graph: %s", CDSConfig::is_using_full_module_graph() ? "enabled" : "disabled");

// Don't hold onto the pointer, in case we might decide to unmap the archive.
_archived_main_module_name = nullptr;
}
}

Expand Down Expand Up @@ -641,6 +644,9 @@ void Modules::serialize_addmods_names(SerializeClosure* soc) {
}
log_info(cds)("optimized module handling: %s", CDSConfig::is_using_optimized_module_handling() ? "enabled" : "disabled");
log_info(cds)("full module graph: %s", CDSConfig::is_using_full_module_graph() ? "enabled" : "disabled");

// Don't hold onto the pointer, in case we might decide to unmap the archive.
_archived_addmods_names = nullptr;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/gc/g1/g1AnalyticsSequences.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class G1Predictions;
// Container for TruncatedSeqs that need separate predictors by GC phase.
class G1PhaseDependentSeq {
TruncatedSeq _young_only_seq;
double _initial_value;
TruncatedSeq _mixed_seq;

NONCOPYABLE(G1PhaseDependentSeq);
Expand Down
Loading

0 comments on commit e51136a

Please sign in to comment.