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 Oct 2, 2024
2 parents a643109 + efe3573 commit 477b979
Show file tree
Hide file tree
Showing 112 changed files with 2,425 additions and 501 deletions.
62 changes: 27 additions & 35 deletions src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,10 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len,
Register table0, Register table1, Register table2, Register table3,
Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5, Register tmp6) {
assert_different_registers(crc, buf, len, table0, table1, table2, table3, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6);
Label L_by16_loop, L_vector_entry, L_unroll_loop, L_unroll_loop_entry, L_by4, L_by4_loop, L_by1, L_by1_loop, L_exit;
Label L_vector_entry,
L_unroll_loop,
L_by4_loop_entry, L_by4_loop,
L_by1_loop, L_exit;

const int64_t single_table_size = 256;
const int64_t unroll = 16;
Expand All @@ -1585,21 +1588,17 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len,
bge(len, tmp1, L_vector_entry);
}
#endif // COMPILER2
subw(len, len, unroll_words);
bge(len, zr, L_unroll_loop_entry);

addiw(len, len, unroll_words-4);
bge(len, zr, L_by4_loop);
addiw(len, len, 4);
bgt(len, zr, L_by1_loop);
j(L_exit);
mv(tmp1, unroll_words);
blt(len, tmp1, L_by4_loop_entry);

const Register loop_buf_end = tmp3;

align(CodeEntryAlignment);
bind(L_unroll_loop_entry);
const Register buf_end = tmp3;
add(buf_end, buf, len); // buf_end will be used as endpoint for loop below
// Entry for L_unroll_loop
add(loop_buf_end, buf, len); // loop_buf_end will be used as endpoint for loop below
andi(len, len, unroll_words-1); // len = (len % unroll_words)
sub(len, len, unroll_words); // Length after all iterations
sub(loop_buf_end, loop_buf_end, len);
bind(L_unroll_loop);
for (int i = 0; i < unroll; i++) {
ld(tmp1, Address(buf, i*wordSize));
Expand All @@ -1608,57 +1607,50 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len,
}

addi(buf, buf, unroll_words);
ble(buf, buf_end, L_unroll_loop);
addiw(len, len, unroll_words-4);
bge(len, zr, L_by4_loop);
addiw(len, len, 4);
bgt(len, zr, L_by1_loop);
j(L_exit);

blt(buf, loop_buf_end, L_unroll_loop);

bind(L_by4_loop_entry);
mv(tmp1, 4);
blt(len, tmp1, L_by1_loop);
add(loop_buf_end, buf, len); // loop_buf_end will be used as endpoint for loop below
andi(len, len, 3);
sub(loop_buf_end, loop_buf_end, len);
bind(L_by4_loop);
lwu(tmp1, Address(buf));
update_word_crc32(crc, tmp1, tmp2, tmp4, tmp6, table0, table1, table2, table3, false);
subw(len, len, 4);
addi(buf, buf, 4);
bge(len, zr, L_by4_loop);
addiw(len, len, 4);
ble(len, zr, L_exit);
blt(buf, loop_buf_end, L_by4_loop);

bind(L_by1_loop);
beqz(len, L_exit);

subw(len, len, 1);
lwu(tmp1, Address(buf));
andi(tmp2, tmp1, right_8_bits);
update_byte_crc32(crc, tmp2, table0);
ble(len, zr, L_exit);
beqz(len, L_exit);

subw(len, len, 1);
srli(tmp2, tmp1, 8);
andi(tmp2, tmp2, right_8_bits);
update_byte_crc32(crc, tmp2, table0);
ble(len, zr, L_exit);
beqz(len, L_exit);

subw(len, len, 1);
srli(tmp2, tmp1, 16);
andi(tmp2, tmp2, right_8_bits);
update_byte_crc32(crc, tmp2, table0);
ble(len, zr, L_exit);

srli(tmp2, tmp1, 24);
andi(tmp2, tmp2, right_8_bits);
update_byte_crc32(crc, tmp2, table0);

#ifdef COMPILER2
// put vector code here, otherwise "offset is too large" error occurs.
if (UseRVV) {
j(L_exit); // only need to jump exit when UseRVV == true, it's a jump from end of block `L_by1_loop`.
// only need to jump exit when UseRVV == true, it's a jump from end of block `L_by1_loop`.
j(L_exit);

bind(L_vector_entry);
vector_update_crc32(crc, buf, len, tmp1, tmp2, tmp3, tmp4, tmp6, table0, table3);

addiw(len, len, -4);
bge(len, zr, L_by4_loop);
addiw(len, len, 4);
bgt(len, zr, L_by1_loop);
bgtz(len, L_by4_loop_entry);
}
#endif // COMPILER2

Expand Down
17 changes: 4 additions & 13 deletions src/hotspot/cpu/riscv/stubGenerator_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6092,26 +6092,17 @@ static const int64_t right_3_bits = right_n_bits(3);

address start = __ pc();

// input parameters
const Register crc = c_rarg0; // crc
const Register buf = c_rarg1; // source java byte array address
const Register len = c_rarg2; // length
const Register table0 = c_rarg3; // crc_table address
const Register table1 = c_rarg4;
const Register table2 = c_rarg5;
const Register table3 = c_rarg6;

const Register tmp1 = c_rarg7;
const Register tmp2 = t2;
const Register tmp3 = x28; // t3
const Register tmp4 = x29; // t4
const Register tmp5 = x30; // t5
const Register tmp6 = x31; // t6

BLOCK_COMMENT("Entry:");
__ enter(); // required for proper stackwalking of RuntimeStub frame

__ kernel_crc32(crc, buf, len, table0, table1, table2,
table3, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6);
__ kernel_crc32(crc, buf, len,
c_rarg3, c_rarg4, c_rarg5, c_rarg6, // tmp's for tables
c_rarg7, t2, x28, x29, x30, x31); // misc tmps

__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret();
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
*/

#include "precompiled.hpp"
#include "gc/shared/gcLogPrecious.hpp"
#include "gc/z/zAddress.inline.hpp"
#include "gc/z/zErrno.hpp"
#include "gc/z/zGlobals.hpp"
#include "gc/z/zInitialize.hpp"
#include "gc/z/zLargePages.inline.hpp"
#include "gc/z/zPhysicalMemory.inline.hpp"
#include "gc/z/zPhysicalMemoryBacking_bsd.hpp"
Expand Down Expand Up @@ -82,7 +82,7 @@ ZPhysicalMemoryBacking::ZPhysicalMemoryBacking(size_t max_capacity)
_base = (uintptr_t)os::reserve_memory(max_capacity);
if (_base == 0) {
// Failed
log_error_pd(gc)("Failed to reserve address space for backing memory");
ZInitialize::error("Failed to reserve address space for backing memory");
return;
}

Expand Down
30 changes: 16 additions & 14 deletions src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "gc/z/zArray.inline.hpp"
#include "gc/z/zErrno.hpp"
#include "gc/z/zGlobals.hpp"
#include "gc/z/zInitialize.hpp"
#include "gc/z/zLargePages.inline.hpp"
#include "gc/z/zMountPoint_linux.hpp"
#include "gc/z/zNUMA.inline.hpp"
Expand Down Expand Up @@ -129,14 +130,15 @@ ZPhysicalMemoryBacking::ZPhysicalMemoryBacking(size_t max_capacity)
// Create backing file
_fd = create_fd(ZFILENAME_HEAP);
if (_fd == -1) {
ZInitialize::error("Failed to create heap backing file");
return;
}

// Truncate backing file
while (ftruncate(_fd, max_capacity) == -1) {
if (errno != EINTR) {
ZErrno err;
log_error_p(gc)("Failed to truncate backing file (%s)", err.to_string());
ZInitialize::error("Failed to truncate backing file (%s)", err.to_string());
return;
}
}
Expand All @@ -145,7 +147,7 @@ ZPhysicalMemoryBacking::ZPhysicalMemoryBacking(size_t max_capacity)
struct statfs buf;
if (fstatfs(_fd, &buf) == -1) {
ZErrno err;
log_error_p(gc)("Failed to determine filesystem type for backing file (%s)", err.to_string());
ZInitialize::error("Failed to determine filesystem type for backing file (%s)", err.to_string());
return;
}

Expand All @@ -158,39 +160,39 @@ ZPhysicalMemoryBacking::ZPhysicalMemoryBacking(size_t max_capacity)

// Make sure the filesystem type matches requested large page type
if (ZLargePages::is_transparent() && !is_tmpfs()) {
log_error_p(gc)("-XX:+UseTransparentHugePages can only be enabled when using a %s filesystem",
ZFILESYSTEM_TMPFS);
ZInitialize::error("-XX:+UseTransparentHugePages can only be enabled when using a %s filesystem",
ZFILESYSTEM_TMPFS);
return;
}

if (ZLargePages::is_transparent() && !tmpfs_supports_transparent_huge_pages()) {
log_error_p(gc)("-XX:+UseTransparentHugePages on a %s filesystem not supported by kernel",
ZFILESYSTEM_TMPFS);
ZInitialize::error("-XX:+UseTransparentHugePages on a %s filesystem not supported by kernel",
ZFILESYSTEM_TMPFS);
return;
}

if (ZLargePages::is_explicit() && !is_hugetlbfs()) {
log_error_p(gc)("-XX:+UseLargePages (without -XX:+UseTransparentHugePages) can only be enabled "
"when using a %s filesystem", ZFILESYSTEM_HUGETLBFS);
ZInitialize::error("-XX:+UseLargePages (without -XX:+UseTransparentHugePages) can only be enabled "
"when using a %s filesystem", ZFILESYSTEM_HUGETLBFS);
return;
}

if (!ZLargePages::is_explicit() && is_hugetlbfs()) {
log_error_p(gc)("-XX:+UseLargePages must be enabled when using a %s filesystem",
ZFILESYSTEM_HUGETLBFS);
ZInitialize::error("-XX:+UseLargePages must be enabled when using a %s filesystem",
ZFILESYSTEM_HUGETLBFS);
return;
}

// Make sure the filesystem block size is compatible
if (ZGranuleSize % _block_size != 0) {
log_error_p(gc)("Filesystem backing the heap has incompatible block size (" SIZE_FORMAT ")",
_block_size);
ZInitialize::error("Filesystem backing the heap has incompatible block size (" SIZE_FORMAT ")",
_block_size);
return;
}

if (is_hugetlbfs() && _block_size != ZGranuleSize) {
log_error_p(gc)("%s filesystem has unexpected block size " SIZE_FORMAT " (expected " SIZE_FORMAT ")",
ZFILESYSTEM_HUGETLBFS, _block_size, ZGranuleSize);
ZInitialize::error("%s filesystem has unexpected block size " SIZE_FORMAT " (expected " SIZE_FORMAT ")",
ZFILESYSTEM_HUGETLBFS, _block_size, ZGranuleSize);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/adlc/formssel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4357,7 +4357,7 @@ bool MatchRule::is_vector() const {
"RoundDoubleModeV","RotateLeftV" , "RotateRightV", "LoadVector","StoreVector",
"LoadVectorGather", "StoreVectorScatter", "LoadVectorGatherMasked", "StoreVectorScatterMasked",
"VectorTest", "VectorLoadMask", "VectorStoreMask", "VectorBlend", "VectorInsert",
"VectorRearrange","VectorLoadShuffle", "VectorLoadConst",
"VectorRearrange", "VectorLoadShuffle", "VectorLoadConst",
"VectorCastB2X", "VectorCastS2X", "VectorCastI2X",
"VectorCastL2X", "VectorCastF2X", "VectorCastD2X", "VectorCastF2HF", "VectorCastHF2F",
"VectorUCastB2X", "VectorUCastS2X", "VectorUCastI2X",
Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/ci/ciEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1616,7 +1616,10 @@ void ciEnv::dump_replay_data_helper(outputStream* out) {
for (int i = 0; i < objects->length(); i++) {
objects->at(i)->dump_replay_data(out);
}
dump_compile_data(out);

if (this->task() != nullptr) {
dump_compile_data(out);
}
out->flush();
}

Expand Down
21 changes: 21 additions & 0 deletions src/hotspot/share/classfile/vmIntrinsics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,15 @@ class methodHandle;
"Ljdk/internal/vm/vector/VectorSupport$Vector;") \
do_name(vector_shuffle_to_vector_name, "shuffleToVector") \
\
do_intrinsic(_VectorWrapShuffleIndexes, jdk_internal_vm_vector_VectorSupport, vector_wrap_shuffle_indexes_name, \
vector_wrap_shuffle_indexes_sig, F_S) \
do_signature(vector_wrap_shuffle_indexes_sig, "(Ljava/lang/Class;" \
"Ljava/lang/Class;" \
"Ljdk/internal/vm/vector/VectorSupport$VectorShuffle;" \
"ILjdk/internal/vm/vector/VectorSupport$WrapShuffleIndexesOperation;)" \
"Ljdk/internal/vm/vector/VectorSupport$VectorShuffle;") \
do_name(vector_wrap_shuffle_indexes_name, "wrapShuffleIndexes") \
\
do_intrinsic(_VectorLoadOp, jdk_internal_vm_vector_VectorSupport, vector_load_op_name, vector_load_op_sig, F_S) \
do_signature(vector_load_op_sig, "(Ljava/lang/Class;" \
"Ljava/lang/Class;" \
Expand Down Expand Up @@ -1129,6 +1138,18 @@ class methodHandle;
"Ljdk/internal/vm/vector/VectorSupport$Vector;") \
do_name(vector_rearrange_name, "rearrangeOp") \
\
do_intrinsic(_VectorSelectFrom, jdk_internal_vm_vector_VectorSupport, vector_select_from_name, vector_select_from_sig, F_S) \
do_signature(vector_select_from_sig, "(Ljava/lang/Class;" \
"Ljava/lang/Class;" \
"Ljava/lang/Class;" \
"I" \
"Ljdk/internal/vm/vector/VectorSupport$Vector;" \
"Ljdk/internal/vm/vector/VectorSupport$Vector;" \
"Ljdk/internal/vm/vector/VectorSupport$VectorMask;" \
"Ljdk/internal/vm/vector/VectorSupport$VectorSelectFromOp;)" \
"Ljdk/internal/vm/vector/VectorSupport$Vector;") \
do_name(vector_select_from_name, "selectFromOp") \
\
do_intrinsic(_VectorExtract, jdk_internal_vm_vector_VectorSupport, vector_extract_name, vector_extract_sig, F_S) \
do_signature(vector_extract_sig, "(Ljava/lang/Class;" \
"Ljava/lang/Class;" \
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/gc/parallel/psScavenge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
#include "oops/oop.hpp"
#include "utilities/stack.hpp"

class ReferenceProcessor;
class ParallelScavengeHeap;
class ParallelScavengeTracer;
class PSIsAliveClosure;
class STWGCTimer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,8 @@ bool ShenandoahBarrierSetC2::is_gc_pre_barrier_node(Node* node) const {
}

bool ShenandoahBarrierSetC2::is_gc_barrier_node(Node* node) const {
return is_shenandoah_lrb_call(node) ||
return (node->Opcode() == Op_ShenandoahLoadReferenceBarrier) ||
is_shenandoah_lrb_call(node) ||
is_shenandoah_wb_pre_call(node) ||
is_shenandoah_clone_call(node);
}
Expand Down
6 changes: 5 additions & 1 deletion src/hotspot/share/gc/z/zCollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "memory/universe.hpp"
#include "oops/stackChunkOop.hpp"
#include "runtime/continuationJavaClasses.hpp"
#include "runtime/java.hpp"
#include "runtime/jniHandles.inline.hpp"
#include "runtime/stackWatermarkSet.hpp"
#include "services/memoryUsage.hpp"
Expand All @@ -60,7 +61,7 @@ ZCollectedHeap* ZCollectedHeap::heap() {

ZCollectedHeap::ZCollectedHeap()
: _barrier_set(),
_initialize(&_barrier_set),
_initializer(&_barrier_set),
_heap(),
_driver_minor(new ZDriverMinor()),
_driver_major(new ZDriverMajor()),
Expand All @@ -78,11 +79,14 @@ const char* ZCollectedHeap::name() const {

jint ZCollectedHeap::initialize() {
if (!_heap.is_initialized()) {
vm_shutdown_during_initialization(ZInitialize::error_message());
return JNI_ENOMEM;
}

Universe::set_verify_data(~(ZAddressHeapBase - 1) | 0x7, ZAddressHeapBase);

ZInitialize::finish();

return JNI_OK;
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/z/zCollectedHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ZCollectedHeap : public CollectedHeap {

private:
ZBarrierSet _barrier_set;
ZInitialize _initialize;
ZInitializer _initializer;
ZHeap _heap;
ZDriverMinor* _driver_minor;
ZDriverMajor* _driver_major;
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/z/zHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "gc/z/zHeap.inline.hpp"
#include "gc/z/zHeapIterator.hpp"
#include "gc/z/zHeuristics.hpp"
#include "gc/z/zInitialize.hpp"
#include "gc/z/zPage.inline.hpp"
#include "gc/z/zPageTable.inline.hpp"
#include "gc/z/zResurrection.hpp"
Expand Down Expand Up @@ -74,7 +75,7 @@ ZHeap::ZHeap()

// Prime cache
if (!_page_allocator.prime_cache(_old.workers(), InitialHeapSize)) {
log_error_p(gc)("Failed to allocate initial Java heap (" SIZE_FORMAT "M)", InitialHeapSize / M);
ZInitialize::error("Failed to allocate initial Java heap (" SIZE_FORMAT "M)", InitialHeapSize / M);
return;
}

Expand Down
Loading

0 comments on commit 477b979

Please sign in to comment.