Skip to content

Commit 4c2d907

Browse files
author
Datadog Syncup Service
committed
Merge branch 'upstream-master'
2 parents f448f03 + a9b0f9c commit 4c2d907

File tree

95 files changed

+1342
-545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1342
-545
lines changed

src/hotspot/os/windows/os_windows.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1947,7 +1947,10 @@ void os::win32::print_windows_version(outputStream* st) {
19471947
// - 2016 GA 10/2016 build: 14393
19481948
// - 2019 GA 11/2018 build: 17763
19491949
// - 2022 GA 08/2021 build: 20348
1950-
if (build_number > 20347) {
1950+
// - 2025 Preview build : 26040
1951+
if (build_number > 26039) {
1952+
st->print("Server 2025");
1953+
} else if (build_number > 20347) {
19511954
st->print("Server 2022");
19521955
} else if (build_number > 17762) {
19531956
st->print("Server 2019");

src/hotspot/share/cds/archiveHeapWriter.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,16 @@ void ArchiveHeapWriter::copy_roots_to_buffer(GrowableArrayCHeap<oop, mtClassShar
248248
_heap_root_segments = segments;
249249
}
250250

251+
// The goal is to sort the objects in increasing order of:
252+
// - objects that have only oop pointers
253+
// - objects that have both native and oop pointers
254+
// - objects that have only native pointers
255+
// - objects that have no pointers
251256
static int oop_sorting_rank(oop o) {
252257
bool has_oop_ptr, has_native_ptr;
253258
HeapShared::get_pointer_info(o, has_oop_ptr, has_native_ptr);
254259

255-
if (!has_oop_ptr) {
260+
if (has_oop_ptr) {
256261
if (!has_native_ptr) {
257262
return 0;
258263
} else {
@@ -267,11 +272,6 @@ static int oop_sorting_rank(oop o) {
267272
}
268273
}
269274

270-
// The goal is to sort the objects in increasing order of:
271-
// - objects that have no pointers
272-
// - objects that have only native pointers
273-
// - objects that have both native and oop pointers
274-
// - objects that have only oop pointers
275275
int ArchiveHeapWriter::compare_objs_by_oop_fields(HeapObjOrder* a, HeapObjOrder* b) {
276276
int rank_a = a->_rank;
277277
int rank_b = b->_rank;

src/hotspot/share/cds/filemap.cpp

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,39 +1581,38 @@ static size_t write_bitmap(const CHeapBitMap* map, char* output, size_t offset)
15811581
return offset + size_in_bytes;
15821582
}
15831583

1584-
// The start of the archived heap has many primitive arrays (String
1585-
// bodies) that are not marked by the oop/ptr maps. So we must have
1586-
// lots of leading zeros.
1587-
size_t FileMapInfo::remove_bitmap_leading_zeros(CHeapBitMap* map) {
1588-
size_t old_zeros = map->find_first_set_bit(0);
1584+
// The sorting code groups the objects with non-null oop/ptrs together.
1585+
// Relevant bitmaps then have lots of leading and trailing zeros, which
1586+
// we do not have to store.
1587+
size_t FileMapInfo::remove_bitmap_zeros(CHeapBitMap* map) {
1588+
BitMap::idx_t first_set = map->find_first_set_bit(0);
1589+
BitMap::idx_t last_set = map->find_last_set_bit(0);
15891590
size_t old_size = map->size();
15901591

15911592
// Slice and resize bitmap
1592-
map->truncate(old_zeros, map->size());
1593+
map->truncate(first_set, last_set + 1);
15931594

1594-
DEBUG_ONLY(
1595-
size_t new_zeros = map->find_first_set_bit(0);
1596-
assert(new_zeros == 0, "Should have removed leading zeros");
1597-
)
1595+
assert(map->at(0), "First bit should be set");
1596+
assert(map->at(map->size() - 1), "Last bit should be set");
15981597
assert(map->size() <= old_size, "sanity");
1599-
return old_zeros;
1598+
1599+
return first_set;
16001600
}
16011601

16021602
char* FileMapInfo::write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap, ArchiveHeapInfo* heap_info,
16031603
size_t &size_in_bytes) {
1604-
size_t removed_rw_zeros = remove_bitmap_leading_zeros(rw_ptrmap);
1605-
size_t removed_ro_zeros = remove_bitmap_leading_zeros(ro_ptrmap);
1606-
header()->set_rw_ptrmap_start_pos(removed_rw_zeros);
1607-
header()->set_ro_ptrmap_start_pos(removed_ro_zeros);
1604+
size_t removed_rw_leading_zeros = remove_bitmap_zeros(rw_ptrmap);
1605+
size_t removed_ro_leading_zeros = remove_bitmap_zeros(ro_ptrmap);
1606+
header()->set_rw_ptrmap_start_pos(removed_rw_leading_zeros);
1607+
header()->set_ro_ptrmap_start_pos(removed_ro_leading_zeros);
16081608
size_in_bytes = rw_ptrmap->size_in_bytes() + ro_ptrmap->size_in_bytes();
16091609

16101610
if (heap_info->is_used()) {
1611-
// Remove leading zeros
1612-
size_t removed_oop_zeros = remove_bitmap_leading_zeros(heap_info->oopmap());
1613-
size_t removed_ptr_zeros = remove_bitmap_leading_zeros(heap_info->ptrmap());
1614-
1615-
header()->set_heap_oopmap_start_pos(removed_oop_zeros);
1616-
header()->set_heap_ptrmap_start_pos(removed_ptr_zeros);
1611+
// Remove leading and trailing zeros
1612+
size_t removed_oop_leading_zeros = remove_bitmap_zeros(heap_info->oopmap());
1613+
size_t removed_ptr_leading_zeros = remove_bitmap_zeros(heap_info->ptrmap());
1614+
header()->set_heap_oopmap_start_pos(removed_oop_leading_zeros);
1615+
header()->set_heap_ptrmap_start_pos(removed_ptr_leading_zeros);
16171616

16181617
size_in_bytes += heap_info->oopmap()->size_in_bytes();
16191618
size_in_bytes += heap_info->ptrmap()->size_in_bytes();

src/hotspot/share/cds/filemap.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ class FileMapInfo : public CHeapObj<mtInternal> {
445445
void write_header();
446446
void write_region(int region, char* base, size_t size,
447447
bool read_only, bool allow_exec);
448-
size_t remove_bitmap_leading_zeros(CHeapBitMap* map);
448+
size_t remove_bitmap_zeros(CHeapBitMap* map);
449449
char* write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap, ArchiveHeapInfo* heap_info,
450450
size_t &size_in_bytes);
451451
size_t write_heap_region(ArchiveHeapInfo* heap_info);

src/hotspot/share/gc/g1/g1ParScanThreadState.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ class G1ParScanThreadState : public CHeapObj<mtGC> {
8787
// Indicates whether in the last generation (old) there is no more space
8888
// available for allocation.
8989
bool _old_gen_is_full;
90-
// Size (in elements) of a partial objArray task chunk.
91-
size_t _partial_objarray_chunk_size;
9290
PartialArrayStateAllocator* _partial_array_state_allocator;
9391
PartialArrayTaskStepper _partial_array_stepper;
9492
StringDedup::Requests _string_dedup_requests;

src/hotspot/share/gc/shared/oopStorage.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,26 @@ void OopStorage::BasicParState::report_num_dead() const {
11351135

11361136
const char* OopStorage::name() const { return _name; }
11371137

1138+
bool OopStorage::print_containing(const oop* addr, outputStream* st) {
1139+
if (addr != nullptr) {
1140+
Block* block = find_block_or_null(addr);
1141+
if (block != nullptr && block->print_containing(addr, st)) {
1142+
st->print(" in oop storage \"%s\"", name());
1143+
return true;
1144+
}
1145+
}
1146+
return false;
1147+
}
1148+
1149+
bool OopStorage::Block::print_containing(const oop* addr, outputStream* st) {
1150+
if (contains(addr)) {
1151+
st->print(PTR_FORMAT " is a pointer %u/%zu into block %zu",
1152+
p2i(addr), get_index(addr), ARRAY_SIZE(_data), _active_index);
1153+
return true;
1154+
}
1155+
return false;
1156+
}
1157+
11381158
#ifndef PRODUCT
11391159

11401160
void OopStorage::print_on(outputStream* st) const {

src/hotspot/share/gc/shared/oopStorage.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ class OopStorage : public CHeapObjBase {
213213
// Debugging and logging support.
214214
const char* name() const;
215215
void print_on(outputStream* st) const PRODUCT_RETURN;
216+
bool print_containing(const oop* addr, outputStream* st);
216217

217218
// Provides access to storage internals, for unit testing.
218219
// Declare, but not define, the public class OopStorage::TestAccess.

src/hotspot/share/gc/shared/oopStorage.inline.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ class OopStorage::Block /* No base class, to avoid messing up alignment. */ {
196196

197197
template<typename F> bool iterate(F f);
198198
template<typename F> bool iterate(F f) const;
199+
200+
bool print_containing(const oop* addr, outputStream* st);
199201
}; // class Block
200202

201203
inline OopStorage::Block* OopStorage::AllocationList::head() {

src/hotspot/share/gc/shared/oopStorageSet.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,23 @@ template OopStorage* OopStorageSet::get_storage(StrongId);
8282
template OopStorage* OopStorageSet::get_storage(WeakId);
8383
template OopStorage* OopStorageSet::get_storage(Id);
8484

85+
bool OopStorageSet::print_containing(const void* addr, outputStream* st) {
86+
if (addr != nullptr) {
87+
const void* aligned_addr = align_down(addr, alignof(oop));
88+
for (OopStorage* storage : Range<Id>()) {
89+
if (storage->print_containing((oop*) aligned_addr, st)) {
90+
if (aligned_addr != addr) {
91+
st->print_cr(" (unaligned)");
92+
} else {
93+
st->cr();
94+
}
95+
return true;
96+
}
97+
}
98+
}
99+
return false;
100+
}
101+
85102
#ifdef ASSERT
86103

87104
void OopStorageSet::verify_initialized(uint index) {

src/hotspot/share/gc/shared/oopStorageSet.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#define SHARE_GC_SHARED_OOPSTORAGESET_HPP
2727

2828
#include "nmt/memTag.hpp"
29+
#include "oops/oop.hpp"
2930
#include "utilities/debug.hpp"
3031
#include "utilities/enumIterator.hpp"
3132
#include "utilities/globalDefinitions.hpp"
@@ -89,6 +90,8 @@ class OopStorageSet : public AllStatic {
8990
template <typename Closure>
9091
static void strong_oops_do(Closure* cl);
9192

93+
// Debugging: print location info, if in storage.
94+
static bool print_containing(const void* addr, outputStream* st);
9295
};
9396

9497
ENUMERATOR_VALUE_RANGE(OopStorageSet::StrongId,

0 commit comments

Comments
 (0)