Skip to content

Commit

Permalink
Merge upstream-jdk
Browse files Browse the repository at this point in the history
  • Loading branch information
corretto-github-robot committed Sep 29, 2023
2 parents 4440e1c + c45308a commit e4c5d1d
Show file tree
Hide file tree
Showing 65 changed files with 1,916 additions and 639 deletions.
3 changes: 2 additions & 1 deletion make/RunTests.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ ifeq ($(TEST_JOBS), 0)
c = c * $(TEST_JOBS_FACTOR_JDL); \
c = c * $(TEST_JOBS_FACTOR_MACHINE); \
if (c < 1) c = 1; \
printf "%.0f", c; \
c = c + 0.5; \
printf "%d", c; \
}')
endif

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@ void LIR_Assembler::emit_lock(LIR_OpLock* op) {
if (LockingMode == LM_MONITOR) {
if (op->info() != nullptr) {
add_debug_info_for_null_check_here(op->info());
__ null_check(obj);
__ null_check(obj, -1);
}
__ j(*op->stub()->entry());
} else if (op->code() == lir_lock) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/linux/os_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2840,7 +2840,7 @@ void os::pd_commit_memory_or_exit(char* addr, size_t size, bool exec,
#define MAP_FIXED_NOREPLACE MAP_FIXED_NOREPLACE_value
#else
// Sanity-check our assumed default value if we build with a new enough libc.
static_assert(MAP_FIXED_NOREPLACE == MAP_FIXED_NOREPLACE_value);
static_assert(MAP_FIXED_NOREPLACE == MAP_FIXED_NOREPLACE_value, "MAP_FIXED_NOREPLACE != MAP_FIXED_NOREPLACE_value");
#endif

int os::Linux::commit_memory_impl(char* addr, size_t size,
Expand Down
16 changes: 9 additions & 7 deletions src/hotspot/os/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2496,8 +2496,8 @@ LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
#if defined(_M_ARM64)
PCONTEXT ctx = exceptionInfo->ContextRecord;
address pc = (address)ctx->Sp;
assert(pc[0] == 0x83, "not an sdiv opcode"); //Fixme did i get the right opcode?
assert(ctx->X4 == min_jint, "unexpected idiv exception");
guarantee(pc[0] == 0x83, "not an sdiv opcode(0x83), the actual value = 0x%x", pc[0]); //Fixme did i get the right opcode?
guarantee(ctx->X4 == min_jint, "unexpected idiv exception, the actual value = %d while the expected is %d", ctx->X4, min_jint);
// set correct result values and continue after idiv instruction
ctx->Pc = (uint64_t)pc + 4; // idiv reg, reg, reg is 4 bytes
ctx->X4 = (uint64_t)min_jint; // result
Expand All @@ -2506,8 +2506,10 @@ LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
#elif defined(_M_AMD64)
PCONTEXT ctx = exceptionInfo->ContextRecord;
address pc = (address)ctx->Rip;
assert(pc[0] >= Assembler::REX && pc[0] <= Assembler::REX_WRXB && pc[1] == 0xF7 || pc[0] == 0xF7, "not an idiv opcode");
assert(pc[0] >= Assembler::REX && pc[0] <= Assembler::REX_WRXB && (pc[2] & ~0x7) == 0xF8 || (pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands");
guarantee(pc[0] >= Assembler::REX && pc[0] <= Assembler::REX_WRXB && pc[1] == 0xF7 || pc[0] == 0xF7,
"not an idiv opcode, pc[0] = 0x%x and pc[1] = 0x%x", pc[0], pc[1]);
guarantee(pc[0] >= Assembler::REX && pc[0] <= Assembler::REX_WRXB && (pc[2] & ~0x7) == 0xF8 || (pc[1] & ~0x7) == 0xF8,
"cannot handle non-register operands, pc[0] = 0x%x, pc[1] = 0x%x and pc[2] = 0x%x", pc[0], pc[1], pc[2]);
if (pc[0] == 0xF7) {
// set correct result values and continue after idiv instruction
ctx->Rip = (DWORD64)pc + 2; // idiv reg, reg is 2 bytes
Expand All @@ -2522,9 +2524,9 @@ LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
#else
PCONTEXT ctx = exceptionInfo->ContextRecord;
address pc = (address)ctx->Eip;
assert(pc[0] == 0xF7, "not an idiv opcode");
assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands");
assert(ctx->Eax == min_jint, "unexpected idiv exception");
guarantee(pc[0] == 0xF7, "not an idiv opcode(0xF7), the actual value = 0x%x", pc[1]);
guarantee((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands, the actual value = 0x%x", pc[1]);
guarantee(ctx->Eax == min_jint, "unexpected idiv exception, the actual value = %d while the expected is %d", ctx->Eax, min_jint);
// set correct result values and continue after idiv instruction
ctx->Eip = (DWORD)pc + 2; // idiv reg, reg is 2 bytes
ctx->Eax = (DWORD)min_jint; // result
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/classfile/stringTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class StringTableConfig : public StackObj {
StringTable::item_added();
return AllocateHeap(size, mtSymbol);
}
static void free_node(void* context, void* memory, Value const& value) {
static void free_node(void* context, void* memory, Value& value) {
value.release(StringTable::_oop_storage);
FreeHeap(memory);
StringTable::item_removed();
Expand Down
20 changes: 20 additions & 0 deletions src/hotspot/share/code/codeHeapState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,13 +1216,15 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular

void CodeHeapState::print_usedSpace(outputStream* out, CodeHeap* heap) {
if (!initialization_complete) {
print_aggregate_missing(out, nullptr);
return;
}

const char* heapName = get_heapName(heap);
get_HeapStatGlobals(out, heapName);

if ((StatArray == nullptr) || (TopSizeArray == nullptr) || (used_topSizeBlocks == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
Expand Down Expand Up @@ -1426,13 +1428,15 @@ void CodeHeapState::print_usedSpace(outputStream* out, CodeHeap* heap) {

void CodeHeapState::print_freeSpace(outputStream* out, CodeHeap* heap) {
if (!initialization_complete) {
print_aggregate_missing(out, nullptr);
return;
}

const char* heapName = get_heapName(heap);
get_HeapStatGlobals(out, heapName);

if ((StatArray == nullptr) || (FreeArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
Expand Down Expand Up @@ -1600,13 +1604,15 @@ void CodeHeapState::print_freeSpace(outputStream* out, CodeHeap* heap) {

void CodeHeapState::print_count(outputStream* out, CodeHeap* heap) {
if (!initialization_complete) {
print_aggregate_missing(out, nullptr);
return;
}

const char* heapName = get_heapName(heap);
get_HeapStatGlobals(out, heapName);

if ((StatArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
Expand Down Expand Up @@ -1758,13 +1764,15 @@ void CodeHeapState::print_count(outputStream* out, CodeHeap* heap) {

void CodeHeapState::print_space(outputStream* out, CodeHeap* heap) {
if (!initialization_complete) {
print_aggregate_missing(out, nullptr);
return;
}

const char* heapName = get_heapName(heap);
get_HeapStatGlobals(out, heapName);

if ((StatArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
Expand Down Expand Up @@ -1927,13 +1935,15 @@ void CodeHeapState::print_space(outputStream* out, CodeHeap* heap) {

void CodeHeapState::print_age(outputStream* out, CodeHeap* heap) {
if (!initialization_complete) {
print_aggregate_missing(out, nullptr);
return;
}

const char* heapName = get_heapName(heap);
get_HeapStatGlobals(out, heapName);

if ((StatArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
Expand Down Expand Up @@ -2039,13 +2049,15 @@ void CodeHeapState::print_age(outputStream* out, CodeHeap* heap) {

void CodeHeapState::print_names(outputStream* out, CodeHeap* heap) {
if (!initialization_complete) {
print_aggregate_missing(out, nullptr);
return;
}

const char* heapName = get_heapName(heap);
get_HeapStatGlobals(out, heapName);

if ((StatArray == nullptr) || (alloc_granules == 0)) {
print_aggregate_missing(out, heapName);
return;
}
BUFFEREDSTREAM_DECL(ast, out)
Expand Down Expand Up @@ -2343,6 +2355,14 @@ void CodeHeapState::print_line_delim(outputStream* out, bufferedStream* ast, cha
}
}

void CodeHeapState::print_aggregate_missing(outputStream* out, const char* heapName) {
if (heapName == nullptr) {
out->print_cr("No aggregated code heap data available. Run function aggregate first.");
} else {
out->print_cr("No aggregated data available for heap %s. Run function aggregate first.", heapName);
}
}

// Find out which blob type we have at hand.
// Return "noType" if anything abnormal is detected.
CodeHeapState::blobType CodeHeapState::get_cbType(CodeBlob* cb) {
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/code/codeHeapState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class CodeHeapState : public CHeapObj<mtCode> {
static void print_age_single(outputStream *ast, int age);
static void print_line_delim(outputStream* out, bufferedStream *sst, char* low_bound, unsigned int ix, unsigned int gpl);
static void print_line_delim(outputStream* out, outputStream *sst, char* low_bound, unsigned int ix, unsigned int gpl);
static void print_aggregate_missing(outputStream* out, const char* heapName);
static blobType get_cbType(CodeBlob* cb);
static bool blob_access_is_safe(CodeBlob* this_blob);
static bool nmethod_access_is_safe(nmethod* nm);
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/gc/g1/g1EvacStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ G1EvacStats::G1EvacStats(const char* description, size_t default_per_thread_plab
// Calculates plab size for current number of gc worker threads.
size_t G1EvacStats::desired_plab_size(uint no_of_gc_workers) const {
if (!ResizePLAB) {
return _default_plab_size;
// There is a circular dependency between the heap and PLAB initialization,
// so _default_plab_size can have an unaligned value.
return align_object_size(_default_plab_size);
}
return align_object_size(clamp(_desired_net_plab_size / no_of_gc_workers, min_size(), max_size()));
}
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/share/gc/serial/cardTableRS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "precompiled.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "gc/serial/cardTableRS.hpp"
#include "gc/shared/genCollectedHeap.hpp"
#include "gc/serial/serialHeap.hpp"
#include "gc/shared/generation.hpp"
#include "gc/shared/space.inline.hpp"
#include "memory/allocation.inline.hpp"
Expand Down Expand Up @@ -132,7 +132,7 @@ void CardTableRS::verify_used_region_at_save_marks(Space* sp) const {
#endif

void CardTableRS::maintain_old_to_young_invariant(Generation* old_gen, bool is_young_gen_empty) {
assert(GenCollectedHeap::heap()->is_old_gen(old_gen), "precondition");
assert(SerialHeap::heap()->is_old_gen(old_gen), "precondition");

if (is_young_gen_empty) {
clear_MemRegion(old_gen->prev_used_region());
Expand Down Expand Up @@ -193,13 +193,13 @@ class VerifyCTSpaceClosure: public SpaceClosure {
virtual void do_space(Space* s) { _ct->verify_space(s, _boundary); }
};

class VerifyCTGenClosure: public GenCollectedHeap::GenClosure {
class VerifyCTGenClosure: public SerialHeap::GenClosure {
CardTableRS* _ct;
public:
VerifyCTGenClosure(CardTableRS* ct) : _ct(ct) {}
void do_generation(Generation* gen) {
// Skip the youngest generation.
if (GenCollectedHeap::heap()->is_young_gen(gen)) {
if (SerialHeap::heap()->is_young_gen(gen)) {
return;
}
// Normally, we're interested in pointers to younger generations.
Expand Down Expand Up @@ -416,7 +416,7 @@ void CardTableRS::verify() {
// At present, we only know how to verify the card table RS for
// generational heaps.
VerifyCTGenClosure blk(this);
GenCollectedHeap::heap()->generation_iterate(&blk, false);
SerialHeap::heap()->generation_iterate(&blk, false);
}

CardTableRS::CardTableRS(MemRegion whole_heap) :
Expand All @@ -439,5 +439,5 @@ void CardTableRS::non_clean_card_iterate(TenuredSpace* sp,
}

bool CardTableRS::is_in_young(const void* p) const {
return GenCollectedHeap::heap()->is_in_young(p);
return SerialHeap::heap()->is_in_young(p);
}
13 changes: 6 additions & 7 deletions src/hotspot/share/gc/serial/defNewGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs,
{
MemRegion cmr((HeapWord*)_virtual_space.low(),
(HeapWord*)_virtual_space.high());
GenCollectedHeap* gch = GenCollectedHeap::heap();
SerialHeap* gch = SerialHeap::heap();

gch->rem_set()->resize_covered_region(cmr);

Expand Down Expand Up @@ -556,7 +556,7 @@ void DefNewGeneration::compute_new_size() {
return;
}

GenCollectedHeap* gch = GenCollectedHeap::heap();
SerialHeap* gch = SerialHeap::heap();

size_t old_size = gch->old_gen()->capacity();
size_t new_size_before = _virtual_space.committed_size();
Expand Down Expand Up @@ -692,7 +692,7 @@ HeapWord* DefNewGeneration::allocate_from_space(size_t size) {

log_trace(gc, alloc)("DefNewGeneration::allocate_from_space(" SIZE_FORMAT "): will_fail: %s heap_lock: %s free: " SIZE_FORMAT "%s%s returns %s",
size,
GenCollectedHeap::heap()->incremental_collection_will_fail(false /* don't consult_young */) ?
SerialHeap::heap()->incremental_collection_will_fail(false /* don't consult_young */) ?
"true" : "false",
Heap_lock->is_locked() ? "locked" : "unlocked",
from()->free(),
Expand All @@ -716,7 +716,7 @@ void DefNewGeneration::adjust_desired_tenuring_threshold() {
_tenuring_threshold = age_table()->compute_tenuring_threshold(desired_survivor_size);

if (UsePerfData) {
GCPolicyCounters* gc_counters = GenCollectedHeap::heap()->counters();
GCPolicyCounters* gc_counters = SerialHeap::heap()->counters();
gc_counters->tenuring_threshold()->set_value(_tenuring_threshold);
gc_counters->desired_survivor_size()->set_value(desired_survivor_size * oopSize);
}
Expand Down Expand Up @@ -1009,8 +1009,7 @@ bool DefNewGeneration::collection_attempt_is_safe() {
return false;
}
if (_old_gen == nullptr) {
GenCollectedHeap* gch = GenCollectedHeap::heap();
_old_gen = gch->old_gen();
_old_gen = SerialHeap::heap()->old_gen();
}
return _old_gen->promotion_attempt_is_safe(used());
}
Expand All @@ -1023,7 +1022,7 @@ void DefNewGeneration::gc_epilogue(bool full) {
// been done. Generally the young generation is empty at
// a minimum at the end of a collection. If it is not, then
// the heap is approaching full.
GenCollectedHeap* gch = GenCollectedHeap::heap();
SerialHeap* gch = SerialHeap::heap();
if (full) {
DEBUG_ONLY(seen_incremental_collection_failed = false;)
if (!collection_attempt_is_safe() && !_eden_space->is_empty()) {
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/serial/defNewGeneration.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "gc/serial/defNewGeneration.hpp"

#include "gc/serial/cardTableRS.hpp"
#include "gc/shared/genCollectedHeap.hpp"
#include "gc/shared/space.inline.hpp"
#include "oops/access.inline.hpp"
#include "utilities/devirtualizer.inline.hpp"
Expand Down
Loading

0 comments on commit e4c5d1d

Please sign in to comment.