diff --git a/make/conf/github-actions.conf b/make/conf/github-actions.conf index f10095daa6c..daa191fc70e 100644 --- a/make/conf/github-actions.conf +++ b/make/conf/github-actions.conf @@ -29,13 +29,13 @@ GTEST_VERSION=1.14.0 JTREG_VERSION=7.3.1+1 LINUX_X64_BOOT_JDK_EXT=tar.gz -LINUX_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk20/bdc68b4b9cbc4ebcb30745c85038d91d/36/GPL/openjdk-20_linux-x64_bin.tar.gz -LINUX_X64_BOOT_JDK_SHA256=bb863b2d542976d1ae4b7b81af3e78b1e4247a64644350b552d298d8dc5980dc +LINUX_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk21/fd2272bbf8e04c3dbaee13770090416c/35/GPL/openjdk-21_linux-x64_bin.tar.gz +LINUX_X64_BOOT_JDK_SHA256=a30c454a9bef8f46d5f1bf3122830014a8fbe7ac03b5f8729bc3add4b92a1d0a MACOS_X64_BOOT_JDK_EXT=tar.gz -MACOS_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk20/bdc68b4b9cbc4ebcb30745c85038d91d/36/GPL/openjdk-20_macos-x64_bin.tar.gz -MACOS_X64_BOOT_JDK_SHA256=47cf960d9bb89dbe987535a389f7e26c42de7c984ef5108612d77c81aa8cc6a4 +MACOS_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk21/fd2272bbf8e04c3dbaee13770090416c/35/GPL/openjdk-21_macos-x64_bin.tar.gz +MACOS_X64_BOOT_JDK_SHA256=af32e84c11009f72f783fdcdc9917efc277893988f097e198e2576875d1e88c1 WINDOWS_X64_BOOT_JDK_EXT=zip -WINDOWS_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk20/bdc68b4b9cbc4ebcb30745c85038d91d/36/GPL/openjdk-20_windows-x64_bin.zip -WINDOWS_X64_BOOT_JDK_SHA256=c92fae5e42b9aecf444a66c8ec563c652f60b1e231dfdd33a4f5a3e3603058fb +WINDOWS_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk21/fd2272bbf8e04c3dbaee13770090416c/35/GPL/openjdk-21_windows-x64_bin.zip +WINDOWS_X64_BOOT_JDK_SHA256=5434faaf029e66e7ce6e75770ca384de476750984a7d2881ef7686894c4b4944 diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 043b935f361..f219d5653c3 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -390,8 +390,8 @@ var getJibProfilesCommon = function (input, data) { }; }; - common.boot_jdk_version = "20"; - common.boot_jdk_build_number = "36"; + common.boot_jdk_version = "21"; + common.boot_jdk_build_number = "35"; common.boot_jdk_home = input.get("boot_jdk", "install_path") + "/jdk-" + common.boot_jdk_version + (input.build_os == "macosx" ? ".jdk/Contents/Home" : ""); diff --git a/make/conf/version-numbers.conf b/make/conf/version-numbers.conf index 7d476de6e66..b902ba7624f 100644 --- a/make/conf/version-numbers.conf +++ b/make/conf/version-numbers.conf @@ -37,6 +37,6 @@ DEFAULT_VERSION_DATE=2024-03-19 DEFAULT_VERSION_CLASSFILE_MAJOR=66 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" DEFAULT_VERSION_CLASSFILE_MINOR=0 DEFAULT_VERSION_DOCS_API_SINCE=11 -DEFAULT_ACCEPTABLE_BOOT_VERSIONS="20 21 22" +DEFAULT_ACCEPTABLE_BOOT_VERSIONS="21 22" DEFAULT_JDK_SOURCE_TARGET_VERSION=22 DEFAULT_PROMOTED_VERSION_PRE=ea diff --git a/src/hotspot/cpu/aarch64/continuationFreezeThaw_aarch64.inline.hpp b/src/hotspot/cpu/aarch64/continuationFreezeThaw_aarch64.inline.hpp index de7eaa81697..d3b9e89773c 100644 --- a/src/hotspot/cpu/aarch64/continuationFreezeThaw_aarch64.inline.hpp +++ b/src/hotspot/cpu/aarch64/continuationFreezeThaw_aarch64.inline.hpp @@ -129,20 +129,11 @@ void FreezeBase::adjust_interpreted_frame_unextended_sp(frame& f) { } } -static inline void relativize_one(intptr_t* const vfp, intptr_t* const hfp, int offset) { - assert(*(hfp + offset) == *(vfp + offset), ""); - intptr_t* addr = hfp + offset; - intptr_t value = *(intptr_t**)addr - vfp; - *addr = value; -} - inline void FreezeBase::relativize_interpreted_frame_metadata(const frame& f, const frame& hf) { - intptr_t* vfp = f.fp(); - intptr_t* hfp = hf.fp(); - assert(hfp == hf.unextended_sp() + (f.fp() - f.unextended_sp()), ""); + assert(hf.fp() == hf.unextended_sp() + (f.fp() - f.unextended_sp()), ""); assert((f.at(frame::interpreter_frame_last_sp_offset) != 0) || (f.unextended_sp() == f.sp()), ""); - assert(f.fp() > (intptr_t*)f.at(frame::interpreter_frame_initial_sp_offset), ""); + assert(f.fp() > (intptr_t*)f.at_relative(frame::interpreter_frame_initial_sp_offset), ""); // on AARCH64, we may insert padding between the locals and the rest of the frame // (see TemplateInterpreterGenerator::generate_normal_entry, and AbstractInterpreter::layout_activation) @@ -152,7 +143,8 @@ inline void FreezeBase::relativize_interpreted_frame_metadata(const frame& f, co // Make sure that last_sp is already relativized. assert((intptr_t*)hf.at_relative(frame::interpreter_frame_last_sp_offset) == hf.unextended_sp(), ""); - relativize_one(vfp, hfp, frame::interpreter_frame_initial_sp_offset); // == block_top == block_bottom + // Make sure that monitor_block_top is already relativized. + assert(hf.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, ""); // extended_sp is already relativized by TemplateInterpreterGenerator::generate_normal_entry or // AbstractInterpreter::layout_activation @@ -285,18 +277,12 @@ inline void ThawBase::patch_pd(frame& f, const frame& caller) { patch_callee_link(caller, caller.fp()); } -static inline void derelativize_one(intptr_t* const fp, int offset) { - intptr_t* addr = fp + offset; - *addr = (intptr_t)(fp + *addr); -} - inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) { - intptr_t* vfp = f.fp(); - // Make sure that last_sp is kept relativized. assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), ""); - derelativize_one(vfp, frame::interpreter_frame_initial_sp_offset); + // Make sure that monitor_block_top is still relativized. + assert(f.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, ""); // Make sure that extended_sp is kept relativized. assert((intptr_t*)f.at_relative(frame::interpreter_frame_extended_sp_offset) < f.unextended_sp(), ""); diff --git a/src/hotspot/cpu/aarch64/continuationHelper_aarch64.inline.hpp b/src/hotspot/cpu/aarch64/continuationHelper_aarch64.inline.hpp index 98de530810b..2715ebef8f0 100644 --- a/src/hotspot/cpu/aarch64/continuationHelper_aarch64.inline.hpp +++ b/src/hotspot/cpu/aarch64/continuationHelper_aarch64.inline.hpp @@ -134,7 +134,7 @@ inline intptr_t* ContinuationHelper::InterpretedFrame::frame_top(const frame& f, // interpreter_frame_last_sp_offset, points to unextended_sp includes arguments in the frame // interpreter_frame_initial_sp_offset excludes expression stack slots int expression_stack_sz = expression_stack_size(f, mask); - intptr_t* res = *(intptr_t**)f.addr_at(frame::interpreter_frame_initial_sp_offset) - expression_stack_sz; + intptr_t* res = (intptr_t*)f.at_relative(frame::interpreter_frame_initial_sp_offset) - expression_stack_sz; assert(res == (intptr_t*)f.interpreter_frame_monitor_end() - expression_stack_sz, ""); assert(res >= f.unextended_sp(), "res: " INTPTR_FORMAT " initial_sp: " INTPTR_FORMAT " last_sp: " INTPTR_FORMAT " unextended_sp: " INTPTR_FORMAT " expression_stack_size: %d", diff --git a/src/hotspot/cpu/aarch64/frame_aarch64.cpp b/src/hotspot/cpu/aarch64/frame_aarch64.cpp index a63e90551ab..c5b2ff8a4c0 100644 --- a/src/hotspot/cpu/aarch64/frame_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/frame_aarch64.cpp @@ -342,7 +342,7 @@ BasicObjectLock* frame::interpreter_frame_monitor_begin() const { } BasicObjectLock* frame::interpreter_frame_monitor_end() const { - BasicObjectLock* result = (BasicObjectLock*) at(interpreter_frame_monitor_block_top_offset); + BasicObjectLock* result = (BasicObjectLock*) at_relative(interpreter_frame_monitor_block_top_offset); // make sure the pointer points inside the frame assert(sp() <= (intptr_t*) result, "monitor end should be above the stack pointer"); assert((intptr_t*) result < fp(), "monitor end should be strictly below the frame pointer"); @@ -350,7 +350,10 @@ BasicObjectLock* frame::interpreter_frame_monitor_end() const { } void frame::interpreter_frame_set_monitor_end(BasicObjectLock* value) { - *((BasicObjectLock**)addr_at(interpreter_frame_monitor_block_top_offset)) = value; + assert(is_interpreted_frame(), "interpreted frame expected"); + // set relativized monitor_block_top + ptr_at_put(interpreter_frame_monitor_block_top_offset, (intptr_t*)value - fp()); + assert(at_absolute(interpreter_frame_monitor_block_top_offset) <= interpreter_frame_monitor_block_top_offset, ""); } // Used by template based interpreter deoptimization diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp index 1b376a521fc..7706bf20fe1 100644 --- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp @@ -632,8 +632,10 @@ void InterpreterMacroAssembler::remove_activation( bind(restart); // We use c_rarg1 so that if we go slow path it will be the correct // register for unlock_object to pass to VM directly - ldr(c_rarg1, monitor_block_top); // points to current entry, starting - // with top-most entry + ldr(c_rarg1, monitor_block_top); // derelativize pointer + lea(c_rarg1, Address(rfp, c_rarg1, Address::lsl(Interpreter::logStackElementSize))); + // c_rarg1 points to current entry, starting with top-most entry + lea(r19, monitor_block_bot); // points to word before bottom of // monitor block b(entry); diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp index 9f944f6b33d..5635ef30540 100644 --- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp @@ -176,7 +176,8 @@ class InterpreterMacroAssembler: public MacroAssembler { void push(RegSet regs, Register stack) { ((MacroAssembler*)this)->push(regs, stack); } void empty_expression_stack() { - ldr(esp, Address(rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize)); + ldr(rscratch1, Address(rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize)); + lea(esp, Address(rfp, rscratch1, Address::lsl(LogBytesPerWord))); // null last_sp until next java call str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize)); } diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp index f918efc9b61..a6d981cf5f1 100644 --- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp @@ -369,6 +369,7 @@ address TemplateInterpreterGenerator::generate_StackOverflowError_handler() { __ ldr(rscratch1, Address(rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize)); + __ lea(rscratch1, Address(rfp, rscratch1, Address::lsl(Interpreter::logStackElementSize))); __ mov(rscratch2, sp); __ cmp(rscratch1, rscratch2); // maximal rsp for current rfp (stack // grows negative) @@ -816,7 +817,10 @@ void TemplateInterpreterGenerator::lock_method() { __ sub(rscratch1, sp, rfp); __ asr(rscratch1, rscratch1, Interpreter::logStackElementSize); __ str(rscratch1, Address(rfp, frame::interpreter_frame_extended_sp_offset * wordSize)); - __ str(esp, monitor_block_top); // set new monitor block top + __ sub(rscratch1, esp, rfp); + __ asr(rscratch1, rscratch1, Interpreter::logStackElementSize); + __ str(rscratch1, monitor_block_top); // set new monitor block top + // store object __ str(r0, Address(esp, BasicObjectLock::obj_offset())); __ mov(c_rarg1, esp); // object address @@ -837,14 +841,16 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { if (native_call) { __ sub(esp, sp, 14 * wordSize); __ mov(rbcp, zr); - __ stp(esp, zr, Address(__ pre(sp, -14 * wordSize))); + __ mov(rscratch1, frame::interpreter_frame_initial_sp_offset); + __ stp(rscratch1, zr, Address(__ pre(sp, -14 * wordSize))); // add 2 zero-initialized slots for native calls __ stp(zr, zr, Address(sp, 12 * wordSize)); } else { __ sub(esp, sp, 12 * wordSize); __ ldr(rscratch1, Address(rmethod, Method::const_offset())); // get ConstMethod __ add(rbcp, rscratch1, in_bytes(ConstMethod::codes_offset())); // get codebase - __ stp(esp, rbcp, Address(__ pre(sp, -12 * wordSize))); + __ mov(rscratch1, frame::interpreter_frame_initial_sp_offset); + __ stp(rscratch1, rbcp, Address(__ pre(sp, -12 * wordSize))); } if (ProfileInterpreter) { @@ -1258,6 +1264,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { const Address monitor_block_top(rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize); __ ldr(rscratch1, monitor_block_top); + __ lea(rscratch1, Address(rfp, rscratch1, Address::lsl(Interpreter::logStackElementSize))); __ cmp(esp, rscratch1); __ br(Assembler::EQ, L); __ stop("broken stack frame setup in interpreter 1"); @@ -1710,6 +1717,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { const Address monitor_block_top (rfp, frame::interpreter_frame_monitor_block_top_offset * wordSize); __ ldr(rscratch1, monitor_block_top); + __ lea(rscratch1, Address(rfp, rscratch1, Address::lsl(Interpreter::logStackElementSize))); __ cmp(esp, rscratch1); __ br(Assembler::EQ, L); __ stop("broken stack frame setup in interpreter 2"); diff --git a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp index 56b023ca098..c799c2a48fd 100644 --- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp @@ -3874,8 +3874,10 @@ void TemplateTable::monitorenter() // find a free slot in the monitor block (result in c_rarg1) { Label entry, loop, exit; - __ ldr(c_rarg3, monitor_block_top); // points to current entry, - // starting with top-most entry + __ ldr(c_rarg3, monitor_block_top); // derelativize pointer + __ lea(c_rarg3, Address(rfp, c_rarg3, Address::lsl(Interpreter::logStackElementSize))); + // c_rarg3 points to current entry, starting with top-most entry + __ lea(c_rarg2, monitor_block_bot); // points to word before bottom __ b(entry); @@ -3914,11 +3916,16 @@ void TemplateTable::monitorenter() __ asr(rscratch1, rscratch1, Interpreter::logStackElementSize); __ str(rscratch1, Address(rfp, frame::interpreter_frame_extended_sp_offset * wordSize)); - __ ldr(c_rarg1, monitor_block_bot); // c_rarg1: old expression stack bottom + __ ldr(c_rarg1, monitor_block_bot); // derelativize pointer + __ lea(c_rarg1, Address(rfp, c_rarg1, Address::lsl(Interpreter::logStackElementSize))); + // c_rarg1 points to the old expression stack bottom + __ sub(esp, esp, entry_size); // move expression stack top __ sub(c_rarg1, c_rarg1, entry_size); // move expression stack bottom __ mov(c_rarg3, esp); // set start value for copy loop - __ str(c_rarg1, monitor_block_bot); // set new monitor block bottom + __ sub(rscratch1, c_rarg1, rfp); // relativize pointer + __ asr(rscratch1, rscratch1, Interpreter::logStackElementSize); + __ str(rscratch1, monitor_block_bot); // set new monitor block bottom __ b(entry); // 2. move expression stack contents @@ -3975,8 +3982,10 @@ void TemplateTable::monitorexit() // find matching slot { Label entry, loop; - __ ldr(c_rarg1, monitor_block_top); // points to current entry, - // starting with top-most entry + __ ldr(c_rarg1, monitor_block_top); // derelativize pointer + __ lea(c_rarg1, Address(rfp, c_rarg1, Address::lsl(Interpreter::logStackElementSize))); + // c_rarg1 points to current entry, starting with top-most entry + __ lea(c_rarg2, monitor_block_bot); // points to word before bottom // of monitor block __ b(entry); diff --git a/src/hotspot/cpu/ppc/continuationFreezeThaw_ppc.inline.hpp b/src/hotspot/cpu/ppc/continuationFreezeThaw_ppc.inline.hpp index 888b0870fe6..3076c00c465 100644 --- a/src/hotspot/cpu/ppc/continuationFreezeThaw_ppc.inline.hpp +++ b/src/hotspot/cpu/ppc/continuationFreezeThaw_ppc.inline.hpp @@ -87,7 +87,9 @@ inline void FreezeBase::relativize_interpreted_frame_metadata(const frame& f, co // frame, because we freeze the padding (see recurse_freeze_interpreted_frame) // in order to keep the same relativized locals pointer, we don't need to change it here. - relativize_one(vfp, hfp, ijava_idx(monitors)); + // Make sure that monitors is already relativized. + assert(hf.at_absolute(ijava_idx(monitors)) <= -(frame::ijava_state_size / wordSize), ""); + relativize_one(vfp, hfp, ijava_idx(esp)); // top_frame_sp is already relativized @@ -542,7 +544,9 @@ static inline void derelativize_one(intptr_t* const fp, int offset) { inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) { intptr_t* vfp = f.fp(); - derelativize_one(vfp, ijava_idx(monitors)); + // Make sure that monitors is still relativized. + assert(f.at_absolute(ijava_idx(monitors)) <= -(frame::ijava_state_size / wordSize), ""); + derelativize_one(vfp, ijava_idx(esp)); // Keep top_frame_sp relativized. } diff --git a/src/hotspot/cpu/ppc/frame_ppc.cpp b/src/hotspot/cpu/ppc/frame_ppc.cpp index 12fe6a21e71..96a87ea9d11 100644 --- a/src/hotspot/cpu/ppc/frame_ppc.cpp +++ b/src/hotspot/cpu/ppc/frame_ppc.cpp @@ -456,7 +456,7 @@ frame::frame(void* sp, void* fp, void* pc) : frame((intptr_t*)sp, (address)pc) { // Pointer beyond the "oldest/deepest" BasicObjectLock on stack. BasicObjectLock* frame::interpreter_frame_monitor_end() const { - BasicObjectLock* result = (BasicObjectLock*) at(ijava_idx(monitors)); + BasicObjectLock* result = (BasicObjectLock*) at_relative(ijava_idx(monitors)); // make sure the pointer points inside the frame assert(sp() <= (intptr_t*) result, "monitor end should be above the stack pointer"); assert((intptr_t*) result < fp(), "monitor end should be strictly below the frame pointer: result: " INTPTR_FORMAT " fp: " INTPTR_FORMAT, p2i(result), p2i(fp())); diff --git a/src/hotspot/cpu/ppc/frame_ppc.inline.hpp b/src/hotspot/cpu/ppc/frame_ppc.inline.hpp index 6ab253d8d12..cb8f680902e 100644 --- a/src/hotspot/cpu/ppc/frame_ppc.inline.hpp +++ b/src/hotspot/cpu/ppc/frame_ppc.inline.hpp @@ -228,7 +228,12 @@ inline intptr_t* frame::interpreter_frame_esp() const { } // Convenient setters -inline void frame::interpreter_frame_set_monitor_end(BasicObjectLock* end) { get_ijava_state()->monitors = (intptr_t) end;} +inline void frame::interpreter_frame_set_monitor_end(BasicObjectLock* end) { + assert(is_interpreted_frame(), "interpreted frame expected"); + // set relativized monitors + get_ijava_state()->monitors = (intptr_t) ((intptr_t*)end - fp()); +} + inline void frame::interpreter_frame_set_cpcache(ConstantPoolCache* cp) { *interpreter_frame_cache_addr() = cp; } inline void frame::interpreter_frame_set_esp(intptr_t* esp) { get_ijava_state()->esp = (intptr_t) esp; } diff --git a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp index c5243900158..f1fe386a2e7 100644 --- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp @@ -2217,7 +2217,9 @@ void InterpreterMacroAssembler::save_interpreter_state(Register scratch) { ld(scratch, 0, R1_SP); std(R15_esp, _ijava_state_neg(esp), scratch); std(R14_bcp, _ijava_state_neg(bcp), scratch); - std(R26_monitor, _ijava_state_neg(monitors), scratch); + subf(R0, scratch, R26_monitor); + sradi(R0, R0, Interpreter::logStackElementSize); + std(R0, _ijava_state_neg(monitors), scratch); if (ProfileInterpreter) { std(R28_mdx, _ijava_state_neg(mdx), scratch); } // Other entries should be unchanged. } @@ -2248,6 +2250,9 @@ void InterpreterMacroAssembler::restore_interpreter_state(Register scratch, bool sldi(R18_locals, R18_locals, Interpreter::logStackElementSize); add(R18_locals, R18_locals, scratch); ld(R26_monitor, _ijava_state_neg(monitors), scratch); + // Derelativize monitors + sldi(R26_monitor, R26_monitor, Interpreter::logStackElementSize); + add(R26_monitor, R26_monitor, scratch); } #ifdef ASSERT { diff --git a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp index 3899ad30a8b..4fa6440f9f8 100644 --- a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp @@ -1055,7 +1055,8 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call, Regist // Also initialize them for non-native calls for better tool support (even though // you may not get the most recent version as described above). __ li(R0, 0); - __ std(R26_monitor, _ijava_state_neg(monitors), R1_SP); + __ li(R12_scratch2, -(frame::ijava_state_size / wordSize)); + __ std(R12_scratch2, _ijava_state_neg(monitors), R1_SP); __ std(R14_bcp, _ijava_state_neg(bcp), R1_SP); if (ProfileInterpreter) { __ std(R28_mdx, _ijava_state_neg(mdx), R1_SP); } __ std(R15_esp, _ijava_state_neg(esp), R1_SP); @@ -1288,7 +1289,9 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // Update monitor in state. __ ld(R11_scratch1, 0, R1_SP); - __ std(R26_monitor, _ijava_state_neg(monitors), R11_scratch1); + __ sub(R12_scratch2, R26_monitor, R11_scratch1); + __ sradi(R12_scratch2, R12_scratch2, Interpreter::logStackElementSize); + __ std(R12_scratch2, _ijava_state_neg(monitors), R11_scratch1); } // jvmti/jvmpi support diff --git a/src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp index 12df04749fa..11fde72bc04 100644 --- a/src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_LIRGenerator_riscv.cpp @@ -801,7 +801,7 @@ void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) { } void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) { - fatal("vectorizedMismatch intrinsic is not implemented on this platform"); + ShouldNotReachHere(); } // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f diff --git a/src/hotspot/cpu/riscv/continuationFreezeThaw_riscv.inline.hpp b/src/hotspot/cpu/riscv/continuationFreezeThaw_riscv.inline.hpp index 042b43bca7d..cea43511514 100644 --- a/src/hotspot/cpu/riscv/continuationFreezeThaw_riscv.inline.hpp +++ b/src/hotspot/cpu/riscv/continuationFreezeThaw_riscv.inline.hpp @@ -127,20 +127,11 @@ void FreezeBase::adjust_interpreted_frame_unextended_sp(frame& f) { } } -static inline void relativize_one(intptr_t* const vfp, intptr_t* const hfp, int offset) { - assert(*(hfp + offset) == *(vfp + offset), ""); - intptr_t* addr = hfp + offset; - intptr_t value = *(intptr_t**)addr - vfp; - *addr = value; -} - inline void FreezeBase::relativize_interpreted_frame_metadata(const frame& f, const frame& hf) { - intptr_t* vfp = f.fp(); - intptr_t* hfp = hf.fp(); - assert(hfp == hf.unextended_sp() + (f.fp() - f.unextended_sp()), ""); + assert(hf.fp() == hf.unextended_sp() + (f.fp() - f.unextended_sp()), ""); assert((f.at(frame::interpreter_frame_last_sp_offset) != 0) || (f.unextended_sp() == f.sp()), ""); - assert(f.fp() > (intptr_t*)f.at(frame::interpreter_frame_initial_sp_offset), ""); + assert(f.fp() > (intptr_t*)f.at_relative(frame::interpreter_frame_initial_sp_offset), ""); // On RISCV, we may insert padding between the locals and the rest of the frame // (see TemplateInterpreterGenerator::generate_normal_entry, and AbstractInterpreter::layout_activation) @@ -150,7 +141,8 @@ inline void FreezeBase::relativize_interpreted_frame_metadata(const frame& f, co // Make sure that last_sp is already relativized. assert((intptr_t*)hf.at_relative(frame::interpreter_frame_last_sp_offset) == hf.unextended_sp(), ""); - relativize_one(vfp, hfp, frame::interpreter_frame_initial_sp_offset); // == block_top == block_bottom + // Make sure that monitor_block_top is already relativized. + assert(hf.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, ""); // extended_sp is already relativized by TemplateInterpreterGenerator::generate_normal_entry or // AbstractInterpreter::layout_activation @@ -287,18 +279,12 @@ inline void ThawBase::patch_pd(frame& f, const frame& caller) { patch_callee_link(caller, caller.fp()); } -static inline void derelativize_one(intptr_t* const fp, int offset) { - intptr_t* addr = fp + offset; - *addr = (intptr_t)(fp + *addr); -} - inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) { - intptr_t* vfp = f.fp(); - // Make sure that last_sp is kept relativized. assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), ""); - derelativize_one(vfp, frame::interpreter_frame_initial_sp_offset); + // Make sure that monitor_block_top is still relativized. + assert(f.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, ""); // Make sure that extended_sp is kept relativized. assert((intptr_t*)f.at_relative(frame::interpreter_frame_extended_sp_offset) < f.unextended_sp(), ""); diff --git a/src/hotspot/cpu/riscv/continuationHelper_riscv.inline.hpp b/src/hotspot/cpu/riscv/continuationHelper_riscv.inline.hpp index 4e96a8231b1..1c668531a07 100644 --- a/src/hotspot/cpu/riscv/continuationHelper_riscv.inline.hpp +++ b/src/hotspot/cpu/riscv/continuationHelper_riscv.inline.hpp @@ -121,7 +121,7 @@ inline intptr_t* ContinuationHelper::InterpretedFrame::frame_top(const frame& f, // interpreter_frame_last_sp_offset, points to unextended_sp includes arguments in the frame // interpreter_frame_initial_sp_offset excludes expression stack slots int expression_stack_sz = expression_stack_size(f, mask); - intptr_t* res = *(intptr_t**)f.addr_at(frame::interpreter_frame_initial_sp_offset) - expression_stack_sz; + intptr_t* res = (intptr_t*)f.at_relative(frame::interpreter_frame_initial_sp_offset) - expression_stack_sz; assert(res == (intptr_t*)f.interpreter_frame_monitor_end() - expression_stack_sz, ""); assert(res >= f.unextended_sp(), "res: " INTPTR_FORMAT " initial_sp: " INTPTR_FORMAT " last_sp: " INTPTR_FORMAT " unextended_sp: " INTPTR_FORMAT " expression_stack_size: %d", diff --git a/src/hotspot/cpu/riscv/frame_riscv.cpp b/src/hotspot/cpu/riscv/frame_riscv.cpp index a1738eb4517..194342b6d7d 100644 --- a/src/hotspot/cpu/riscv/frame_riscv.cpp +++ b/src/hotspot/cpu/riscv/frame_riscv.cpp @@ -318,7 +318,7 @@ BasicObjectLock* frame::interpreter_frame_monitor_begin() const { } BasicObjectLock* frame::interpreter_frame_monitor_end() const { - BasicObjectLock* result = (BasicObjectLock*) at(interpreter_frame_monitor_block_top_offset); + BasicObjectLock* result = (BasicObjectLock*) at_relative(interpreter_frame_monitor_block_top_offset); // make sure the pointer points inside the frame assert(sp() <= (intptr_t*) result, "monitor end should be above the stack pointer"); assert((intptr_t*) result < fp(), "monitor end should be strictly below the frame pointer"); @@ -326,7 +326,10 @@ BasicObjectLock* frame::interpreter_frame_monitor_end() const { } void frame::interpreter_frame_set_monitor_end(BasicObjectLock* value) { - *((BasicObjectLock**)addr_at(interpreter_frame_monitor_block_top_offset)) = value; + assert(is_interpreted_frame(), "interpreted frame expected"); + // set relativized monitor_block_top + ptr_at_put(interpreter_frame_monitor_block_top_offset, (intptr_t*)value - fp()); + assert(at_absolute(interpreter_frame_monitor_block_top_offset) <= interpreter_frame_monitor_block_top_offset, ""); } // Used by template based interpreter deoptimization diff --git a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp index 5580983b8d2..70c6758603a 100644 --- a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp +++ b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp @@ -700,8 +700,10 @@ void InterpreterMacroAssembler::remove_activation( bind(restart); // We use c_rarg1 so that if we go slow path it will be the correct // register for unlock_object to pass to VM directly - ld(c_rarg1, monitor_block_top); // points to current entry, starting - // with top-most entry + ld(c_rarg1, monitor_block_top); // derelativize pointer + shadd(c_rarg1, c_rarg1, fp, c_rarg1, LogBytesPerWord); + // c_rarg1 points to current entry, starting with top-most entry + la(x9, monitor_block_bot); // points to word before bottom of // monitor block @@ -2008,6 +2010,7 @@ void InterpreterMacroAssembler::verify_frame_setup() { Label L; const Address monitor_block_top(fp, frame::interpreter_frame_monitor_block_top_offset * wordSize); ld(t0, monitor_block_top); + shadd(t0, t0, fp, t0, LogBytesPerWord); beq(esp, t0, L); stop("broken stack frame setup in interpreter"); bind(L); diff --git a/src/hotspot/cpu/riscv/interp_masm_riscv.hpp b/src/hotspot/cpu/riscv/interp_masm_riscv.hpp index 0fa38a1a120..8f447cdba43 100644 --- a/src/hotspot/cpu/riscv/interp_masm_riscv.hpp +++ b/src/hotspot/cpu/riscv/interp_masm_riscv.hpp @@ -75,7 +75,7 @@ class InterpreterMacroAssembler: public MacroAssembler { void restore_locals() { ld(xlocals, Address(fp, frame::interpreter_frame_locals_offset * wordSize)); - shadd(xlocals, xlocals, fp, t0, LogBytesPerWord); + shadd(xlocals, xlocals, fp, t0, LogBytesPerWord); } void restore_constant_pool_cache() { @@ -165,7 +165,8 @@ class InterpreterMacroAssembler: public MacroAssembler { void push(TosState state); // transition state -> vtos void empty_expression_stack() { - ld(esp, Address(fp, frame::interpreter_frame_monitor_block_top_offset * wordSize)); + ld(t0, Address(fp, frame::interpreter_frame_monitor_block_top_offset * wordSize)); + shadd(esp, t0, fp, t0, LogBytesPerWord); // null last_sp until next java call sd(zr, Address(fp, frame::interpreter_frame_last_sp_offset * wordSize)); } diff --git a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp index 8d29dc2041a..7402cb4a54a 100644 --- a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp @@ -332,6 +332,7 @@ address TemplateInterpreterGenerator::generate_StackOverflowError_handler() { { Label L; __ ld(t0, Address(fp, frame::interpreter_frame_monitor_block_top_offset * wordSize)); + __ shadd(t0, t0, fp, t0, LogBytesPerWord); // maximal sp for current fp (stack grows negative) // check if frame is complete __ bge(t0, sp, L); @@ -713,7 +714,9 @@ void TemplateInterpreterGenerator::lock_method() { __ sub(t0, sp, fp); __ srai(t0, t0, Interpreter::logStackElementSize); __ sd(t0, Address(fp, frame::interpreter_frame_extended_sp_offset * wordSize)); - __ sd(esp, monitor_block_top); // set new monitor block top + __ sub(t0, esp, fp); + __ srai(t0, t0, Interpreter::logStackElementSize); + __ sd(t0, monitor_block_top); // set new monitor block top // store object __ sd(x10, Address(esp, BasicObjectLock::obj_offset())); __ mv(c_rarg1, esp); // object address @@ -745,7 +748,8 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { __ add(sp, sp, - 12 * wordSize); } __ sd(xbcp, Address(sp, wordSize)); - __ sd(esp, Address(sp, 0)); + __ mv(t0, frame::interpreter_frame_initial_sp_offset); + __ sd(t0, Address(sp, 0)); if (ProfileInterpreter) { Label method_data_continue; diff --git a/src/hotspot/cpu/riscv/templateTable_riscv.cpp b/src/hotspot/cpu/riscv/templateTable_riscv.cpp index 910a16e4e8f..a0b3f037ab2 100644 --- a/src/hotspot/cpu/riscv/templateTable_riscv.cpp +++ b/src/hotspot/cpu/riscv/templateTable_riscv.cpp @@ -3809,8 +3809,10 @@ void TemplateTable::monitorenter() { // find a free slot in the monitor block (result in c_rarg1) { Label entry, loop, exit, notUsed; - __ ld(c_rarg3, monitor_block_top); // points to current entry, - // starting with top-most entry + __ ld(c_rarg3, monitor_block_top); // derelativize pointer + __ shadd(c_rarg3, c_rarg3, fp, c_rarg3, LogBytesPerWord); + // Now c_rarg3 points to current entry, starting with top-most entry + __ la(c_rarg2, monitor_block_bot); // points to word before bottom __ j(entry); @@ -3848,11 +3850,16 @@ void TemplateTable::monitorenter() { __ srai(t0, t0, Interpreter::logStackElementSize); __ sd(t0, Address(fp, frame::interpreter_frame_extended_sp_offset * wordSize)); - __ ld(c_rarg1, monitor_block_bot); // c_rarg1: old expression stack bottom + __ ld(c_rarg1, monitor_block_bot); // derelativize pointer + __ shadd(c_rarg1, c_rarg1, fp, c_rarg1, LogBytesPerWord); + // Now c_rarg1 points to the old expression stack bottom + __ sub(esp, esp, entry_size); // move expression stack top __ sub(c_rarg1, c_rarg1, entry_size); // move expression stack bottom __ mv(c_rarg3, esp); // set start value for copy loop - __ sd(c_rarg1, monitor_block_bot); // set new monitor block bottom + __ sub(t0, c_rarg1, fp); // relativize pointer + __ srai(t0, t0, Interpreter::logStackElementSize); + __ sd(t0, monitor_block_bot); // set new monitor block bottom __ j(entry); // 2. move expression stack contents @@ -3906,8 +3913,10 @@ void TemplateTable::monitorexit() { // find matching slot { Label entry, loop; - __ ld(c_rarg1, monitor_block_top); // points to current entry, - // starting with top-most entry + __ ld(c_rarg1, monitor_block_top); // derelativize pointer + __ shadd(c_rarg1, c_rarg1, fp, c_rarg1, LogBytesPerWord); + // Now c_rarg1 points to current entry, starting with top-most entry + __ la(c_rarg2, monitor_block_bot); // points to word before bottom // of monitor block __ j(entry); diff --git a/src/hotspot/cpu/riscv/vm_version_riscv.cpp b/src/hotspot/cpu/riscv/vm_version_riscv.cpp index 1c099f455cb..a19a4e4b08a 100644 --- a/src/hotspot/cpu/riscv/vm_version_riscv.cpp +++ b/src/hotspot/cpu/riscv/vm_version_riscv.cpp @@ -182,6 +182,11 @@ void VM_Version::initialize() { FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false); } + if (UseVectorizedMismatchIntrinsic) { + warning("VectorizedMismatch intrinsic is not available on this CPU."); + FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false); + } + if (FLAG_IS_DEFAULT(UseMD5Intrinsics)) { FLAG_SET_DEFAULT(UseMD5Intrinsics, true); } diff --git a/src/hotspot/cpu/x86/continuationFreezeThaw_x86.inline.hpp b/src/hotspot/cpu/x86/continuationFreezeThaw_x86.inline.hpp index 8630a4670db..ecc2d81e672 100644 --- a/src/hotspot/cpu/x86/continuationFreezeThaw_x86.inline.hpp +++ b/src/hotspot/cpu/x86/continuationFreezeThaw_x86.inline.hpp @@ -126,20 +126,11 @@ void FreezeBase::adjust_interpreted_frame_unextended_sp(frame& f) { } } -static inline void relativize_one(intptr_t* const vfp, intptr_t* const hfp, int offset) { - assert(*(hfp + offset) == *(vfp + offset), ""); - intptr_t* addr = hfp + offset; - intptr_t value = *(intptr_t**)addr - vfp; - *addr = value; -} - inline void FreezeBase::relativize_interpreted_frame_metadata(const frame& f, const frame& hf) { - intptr_t* vfp = f.fp(); - intptr_t* hfp = hf.fp(); - assert(hfp == hf.unextended_sp() + (f.fp() - f.unextended_sp()), ""); + assert(hf.fp() == hf.unextended_sp() + (f.fp() - f.unextended_sp()), ""); assert((f.at(frame::interpreter_frame_last_sp_offset) != 0) || (f.unextended_sp() == f.sp()), ""); - assert(f.fp() > (intptr_t*)f.at(frame::interpreter_frame_initial_sp_offset), ""); + assert(f.fp() > (intptr_t*)f.at_relative(frame::interpreter_frame_initial_sp_offset), ""); // Make sure that last_sp is already relativized. assert((intptr_t*)hf.at_relative(frame::interpreter_frame_last_sp_offset) == hf.unextended_sp(), ""); @@ -147,7 +138,8 @@ inline void FreezeBase::relativize_interpreted_frame_metadata(const frame& f, co // Make sure that locals is already relativized. assert((*hf.addr_at(frame::interpreter_frame_locals_offset) == frame::sender_sp_offset + f.interpreter_frame_method()->max_locals() - 1), ""); - relativize_one(vfp, hfp, frame::interpreter_frame_initial_sp_offset); // == block_top == block_bottom + // Make sure that monitor_block_top is already relativized. + assert(hf.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, ""); assert((hf.fp() - hf.unextended_sp()) == (f.fp() - f.unextended_sp()), ""); assert(hf.unextended_sp() == (intptr_t*)hf.at(frame::interpreter_frame_last_sp_offset), ""); @@ -274,18 +266,12 @@ inline void ThawBase::patch_pd(frame& f, const frame& caller) { patch_callee_link(caller, caller.fp()); } -static inline void derelativize_one(intptr_t* const fp, int offset) { - intptr_t* addr = fp + offset; - *addr = (intptr_t)(fp + *addr); -} - inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) { - intptr_t* vfp = f.fp(); - // Make sure that last_sp is kept relativized. assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), ""); - derelativize_one(vfp, frame::interpreter_frame_initial_sp_offset); + // Make sure that monitor_block_top is still relativized. + assert(f.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, ""); } #endif // CPU_X86_CONTINUATIONFREEZE_THAW_X86_INLINE_HPP diff --git a/src/hotspot/cpu/x86/continuationHelper_x86.inline.hpp b/src/hotspot/cpu/x86/continuationHelper_x86.inline.hpp index 55794f9ac7e..dab6cec2a5f 100644 --- a/src/hotspot/cpu/x86/continuationHelper_x86.inline.hpp +++ b/src/hotspot/cpu/x86/continuationHelper_x86.inline.hpp @@ -121,7 +121,7 @@ inline intptr_t* ContinuationHelper::InterpretedFrame::frame_top(const frame& f, // interpreter_frame_last_sp_offset, points to unextended_sp includes arguments in the frame // interpreter_frame_initial_sp_offset excludes expression stack slots int expression_stack_sz = expression_stack_size(f, mask); - intptr_t* res = *(intptr_t**)f.addr_at(frame::interpreter_frame_initial_sp_offset) - expression_stack_sz; + intptr_t* res = (intptr_t*)f.at_relative(frame::interpreter_frame_initial_sp_offset) - expression_stack_sz; assert(res == (intptr_t*)f.interpreter_frame_monitor_end() - expression_stack_sz, ""); assert(res >= f.unextended_sp(), "res: " INTPTR_FORMAT " initial_sp: " INTPTR_FORMAT " last_sp: " INTPTR_FORMAT " unextended_sp: " INTPTR_FORMAT " expression_stack_size: %d", diff --git a/src/hotspot/cpu/x86/frame_x86.cpp b/src/hotspot/cpu/x86/frame_x86.cpp index 0fc674ec69b..bef2443a60a 100644 --- a/src/hotspot/cpu/x86/frame_x86.cpp +++ b/src/hotspot/cpu/x86/frame_x86.cpp @@ -339,7 +339,7 @@ BasicObjectLock* frame::interpreter_frame_monitor_begin() const { } BasicObjectLock* frame::interpreter_frame_monitor_end() const { - BasicObjectLock* result = (BasicObjectLock*) at(interpreter_frame_monitor_block_top_offset); + BasicObjectLock* result = (BasicObjectLock*) at_relative(interpreter_frame_monitor_block_top_offset); // make sure the pointer points inside the frame assert(sp() <= (intptr_t*) result, "monitor end should be above the stack pointer"); assert((intptr_t*) result < fp(), "monitor end should be strictly below the frame pointer: result: " INTPTR_FORMAT " fp: " INTPTR_FORMAT, p2i(result), p2i(fp())); @@ -347,7 +347,10 @@ BasicObjectLock* frame::interpreter_frame_monitor_end() const { } void frame::interpreter_frame_set_monitor_end(BasicObjectLock* value) { - *((BasicObjectLock**)addr_at(interpreter_frame_monitor_block_top_offset)) = value; + assert(is_interpreted_frame(), "interpreted frame expected"); + // set relativized monitor_block_top + ptr_at_put(interpreter_frame_monitor_block_top_offset, (intptr_t*)value - fp()); + assert(at_absolute(interpreter_frame_monitor_block_top_offset) <= interpreter_frame_monitor_block_top_offset, ""); } // Used by template based interpreter deoptimization diff --git a/src/hotspot/cpu/x86/frame_x86.hpp b/src/hotspot/cpu/x86/frame_x86.hpp index 3658fa23467..122f640a92a 100644 --- a/src/hotspot/cpu/x86/frame_x86.hpp +++ b/src/hotspot/cpu/x86/frame_x86.hpp @@ -82,7 +82,7 @@ // Entry frames #ifdef AMD64 #ifdef _WIN64 - entry_frame_after_call_words = 60, + entry_frame_after_call_words = 28, entry_frame_call_wrapper_offset = 2, arg_reg_save_area_bytes = 32, // Register argument save area diff --git a/src/hotspot/cpu/x86/interp_masm_x86.cpp b/src/hotspot/cpu/x86/interp_masm_x86.cpp index f8a6c5b4f19..7d50387ce6f 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.cpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp @@ -1085,8 +1085,10 @@ void InterpreterMacroAssembler::remove_activation( bind(restart); // We use c_rarg1 so that if we go slow path it will be the correct // register for unlock_object to pass to VM directly - movptr(rmon, monitor_block_top); // points to current entry, starting - // with top-most entry + movptr(rmon, monitor_block_top); // derelativize pointer + lea(rmon, Address(rbp, rmon, Address::times_ptr)); + // c_rarg1 points to current entry, starting with top-most entry + lea(rbx, monitor_block_bot); // points to word before bottom of // monitor block jmp(entry); diff --git a/src/hotspot/cpu/x86/interp_masm_x86.hpp b/src/hotspot/cpu/x86/interp_masm_x86.hpp index 60a33bc7c5d..ad72a308481 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.hpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.hpp @@ -177,7 +177,8 @@ class InterpreterMacroAssembler: public MacroAssembler { void push(TosState state); // transition state -> vtos void empty_expression_stack() { - movptr(rsp, Address(rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize)); + movptr(rcx, Address(rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize)); + lea(rsp, Address(rbp, rcx, Address::times_ptr)); // null last_sp until next java call movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); NOT_LP64(empty_FPU_stack()); diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp index 6cec069d0c1..c6178836df2 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp @@ -106,10 +106,8 @@ // [ return_from_Java ] <--- rsp // [ argument word n ] // ... -// -60 [ argument word 1 ] -// -59 [ saved xmm31 ] <--- rsp after_call -// [ saved xmm16-xmm30 ] (EVEX enabled, else the space is blank) -// -27 [ saved xmm15 ] +// -28 [ argument word 1 ] +// -27 [ saved xmm15 ] <--- rsp after_call // [ saved xmm7-xmm14 ] // -9 [ saved xmm6 ] (each xmm register takes 2 slots) // -7 [ saved r15 ] @@ -137,7 +135,7 @@ #ifdef _WIN64 enum call_stub_layout { xmm_save_first = 6, // save from xmm6 - xmm_save_last = 31, // to xmm31 + xmm_save_last = 15, // to xmm15 xmm_save_base = -9, rsp_after_call_off = xmm_save_base - 2 * (xmm_save_last - xmm_save_first), // -27 r15_off = -7, @@ -237,17 +235,8 @@ address StubGenerator::generate_call_stub(address& return_address) { #ifdef _WIN64 int last_reg = 15; - if (UseAVX > 2) { - last_reg = 31; - } - if (VM_Version::supports_evex()) { - for (int i = xmm_save_first; i <= last_reg; i++) { - __ vextractf32x4(xmm_save(i), as_XMMRegister(i), 0); - } - } else { - for (int i = xmm_save_first; i <= last_reg; i++) { - __ movdqu(xmm_save(i), as_XMMRegister(i)); - } + for (int i = xmm_save_first; i <= last_reg; i++) { + __ movdqu(xmm_save(i), as_XMMRegister(i)); } const Address rdi_save(rbp, rdi_off * wordSize); @@ -370,14 +359,8 @@ address StubGenerator::generate_call_stub(address& return_address) { // restore regs belonging to calling function #ifdef _WIN64 // emit the restores for xmm regs - if (VM_Version::supports_evex()) { - for (int i = xmm_save_first; i <= last_reg; i++) { - __ vinsertf32x4(as_XMMRegister(i), as_XMMRegister(i), xmm_save(i), 0); - } - } else { - for (int i = xmm_save_first; i <= last_reg; i++) { - __ movdqu(as_XMMRegister(i), xmm_save(i)); - } + for (int i = xmm_save_first; i <= last_reg; i++) { + __ movdqu(as_XMMRegister(i), xmm_save(i)); } #endif __ movptr(r15, r15_save); diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp index ba53694397c..c01d9832072 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp @@ -86,9 +86,10 @@ address TemplateInterpreterGenerator::generate_StackOverflowError_handler() { #ifdef ASSERT { Label L; - __ lea(rax, Address(rbp, - frame::interpreter_frame_monitor_block_top_offset * - wordSize)); + __ movptr(rax, Address(rbp, + frame::interpreter_frame_monitor_block_top_offset * + wordSize)); + __ lea(rax, Address(rbp, rax, Address::times_ptr)); __ cmpptr(rax, rsp); // rax = maximal rsp for current rbp (stack // grows negative) __ jcc(Assembler::aboveEqual, L); // check if frame is complete @@ -608,7 +609,7 @@ void TemplateInterpreterGenerator::lock_method() { // add space for monitor & lock __ subptr(rsp, entry_size); // add space for a monitor entry - __ movptr(monitor_block_top, rsp); // set new monitor block top + __ subptr(monitor_block_top, entry_size / wordSize); // set new monitor block top // store object __ movptr(Address(rsp, BasicObjectLock::obj_offset()), rax); const Register lockreg = NOT_LP64(rdx) LP64_ONLY(c_rarg1); @@ -664,8 +665,8 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { } else { __ push(rbcp); // set bcp } - __ push(0); // reserve word for pointer to expression stack bottom - __ movptr(Address(rsp, 0), rsp); // set expression stack bottom + // initialize relativized pointer to expression stack bottom + __ push(frame::interpreter_frame_initial_sp_offset); } // End of helpers @@ -904,6 +905,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { const Address monitor_block_top(rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize); __ movptr(rax, monitor_block_top); + __ lea(rax, Address(rbp, rax, Address::times_ptr)); __ cmpptr(rax, rsp); __ jcc(Assembler::equal, L); __ stop("broken stack frame setup in interpreter 5"); @@ -1458,6 +1460,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { const Address monitor_block_top (rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize); __ movptr(rax, monitor_block_top); + __ lea(rax, Address(rbp, rax, Address::times_ptr)); __ cmpptr(rax, rsp); __ jcc(Assembler::equal, L); __ stop("broken stack frame setup in interpreter 6"); diff --git a/src/hotspot/cpu/x86/templateTable_x86.cpp b/src/hotspot/cpu/x86/templateTable_x86.cpp index 99a2d19ba7e..53fc05bedb0 100644 --- a/src/hotspot/cpu/x86/templateTable_x86.cpp +++ b/src/hotspot/cpu/x86/templateTable_x86.cpp @@ -4358,8 +4358,10 @@ void TemplateTable::monitorenter() { // find a free slot in the monitor block (result in rmon) { Label entry, loop, exit; - __ movptr(rtop, monitor_block_top); // points to current entry, - // starting with top-most entry + __ movptr(rtop, monitor_block_top); // derelativize pointer + __ lea(rtop, Address(rbp, rtop, Address::times_ptr)); + // rtop points to current entry, starting with top-most entry + __ lea(rbot, monitor_block_bot); // points to word before bottom // of monitor block __ jmpb(entry); @@ -4391,10 +4393,11 @@ void TemplateTable::monitorenter() { Label entry, loop; // 1. compute new pointers // rsp: old expression stack top __ movptr(rmon, monitor_block_bot); // rmon: old expression stack bottom + __ lea(rmon, Address(rbp, rmon, Address::times_ptr)); __ subptr(rsp, entry_size); // move expression stack top __ subptr(rmon, entry_size); // move expression stack bottom __ mov(rtop, rsp); // set start value for copy loop - __ movptr(monitor_block_bot, rmon); // set new monitor block bottom + __ subptr(monitor_block_bot, entry_size / wordSize); // set new monitor block bottom __ jmp(entry); // 2. move expression stack contents __ bind(loop); @@ -4451,8 +4454,10 @@ void TemplateTable::monitorexit() { // find matching slot { Label entry, loop; - __ movptr(rtop, monitor_block_top); // points to current entry, - // starting with top-most entry + __ movptr(rtop, monitor_block_top); // derelativize pointer + __ lea(rtop, Address(rbp, rtop, Address::times_ptr)); + // rtop points to current entry, starting with top-most entry + __ lea(rbot, monitor_block_bot); // points to word before bottom // of monitor block __ jmpb(entry); diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad index a7a982edd07..56d3634fa12 100644 --- a/src/hotspot/cpu/x86/x86.ad +++ b/src/hotspot/cpu/x86/x86.ad @@ -71,7 +71,7 @@ register %{ // // Linux ABI: No register preserved across function calls // XMM0-XMM7 might hold parameters -// Windows ABI: XMM6-XMM31 preserved across function calls +// Windows ABI: XMM6-XMM15 preserved across function calls // XMM0-XMM3 might hold parameters reg_def XMM0 ( SOC, SOC, Op_RegF, 0, xmm0->as_VMReg()); diff --git a/src/hotspot/os_cpu/linux_riscv/orderAccess_linux_riscv.hpp b/src/hotspot/os_cpu/linux_riscv/orderAccess_linux_riscv.hpp index 2b500376f9b..a7dc84770f8 100644 --- a/src/hotspot/os_cpu/linux_riscv/orderAccess_linux_riscv.hpp +++ b/src/hotspot/os_cpu/linux_riscv/orderAccess_linux_riscv.hpp @@ -37,7 +37,7 @@ inline void OrderAccess::storestore() { release(); } inline void OrderAccess::loadstore() { acquire(); } inline void OrderAccess::storeload() { fence(); } -#define FULL_MEM_BARRIER __sync_synchronize() +#define FULL_MEM_BARRIER __atomic_thread_fence(__ATOMIC_SEQ_CST); #define READ_MEM_BARRIER __atomic_thread_fence(__ATOMIC_ACQUIRE); #define WRITE_MEM_BARRIER __atomic_thread_fence(__ATOMIC_RELEASE); diff --git a/src/hotspot/share/cds/archiveHeapWriter.cpp b/src/hotspot/share/cds/archiveHeapWriter.cpp index 032190c841d..17f6e831dc0 100644 --- a/src/hotspot/share/cds/archiveHeapWriter.cpp +++ b/src/hotspot/share/cds/archiveHeapWriter.cpp @@ -26,6 +26,7 @@ #include "cds/archiveHeapWriter.hpp" #include "cds/filemap.hpp" #include "cds/heapShared.hpp" +#include "classfile/systemDictionary.hpp" #include "gc/shared/collectedHeap.hpp" #include "memory/iterator.inline.hpp" #include "memory/oopFactory.hpp" @@ -317,6 +318,12 @@ size_t ArchiveHeapWriter::get_filler_size_at(address buffered_addr) { } } +template +void update_buffered_object_field(address buffered_obj, int field_offset, T value) { + T* field_addr = cast_to_oop(buffered_obj)->field_addr(field_offset); + *field_addr = value; +} + size_t ArchiveHeapWriter::copy_one_source_obj_to_buffer(oop src_obj) { assert(!is_too_large_to_archive(src_obj), "already checked"); size_t byte_size = src_obj->size() * HeapWordSize; @@ -342,6 +349,20 @@ size_t ArchiveHeapWriter::copy_one_source_obj_to_buffer(oop src_obj) { assert(is_object_aligned(byte_size), "sanity"); memcpy(to, from, byte_size); + // These native pointers will be restored explicitly at run time. + if (java_lang_Module::is_instance(src_obj)) { + update_buffered_object_field(to, java_lang_Module::module_entry_offset(), nullptr); + } else if (java_lang_ClassLoader::is_instance(src_obj)) { +#ifdef ASSERT + // We only archive these loaders + if (src_obj != SystemDictionary::java_platform_loader() && + src_obj != SystemDictionary::java_system_loader()) { + assert(src_obj->klass()->name()->equals("jdk/internal/loader/ClassLoaders$BootClassLoader"), "must be"); + } +#endif + update_buffered_object_field(to, java_lang_ClassLoader::loader_data_offset(), nullptr); + } + size_t buffered_obj_offset = _buffer_used; _buffer_used = new_used; diff --git a/src/hotspot/share/cds/heapShared.cpp b/src/hotspot/share/cds/heapShared.cpp index e17b64d5b61..04fde9a31e3 100644 --- a/src/hotspot/share/cds/heapShared.cpp +++ b/src/hotspot/share/cds/heapShared.cpp @@ -135,8 +135,6 @@ OopHandle HeapShared::_roots; OopHandle HeapShared::_scratch_basic_type_mirrors[T_VOID+1]; MetaspaceObjToOopHandleTable* HeapShared::_scratch_java_mirror_table = nullptr; MetaspaceObjToOopHandleTable* HeapShared::_scratch_references_table = nullptr; -ClassLoaderData* HeapShared::_saved_java_platform_loader_data = nullptr; -ClassLoaderData* HeapShared::_saved_java_system_loader_data = nullptr; static bool is_subgraph_root_class_of(ArchivableStaticFieldInfo fields[], InstanceKlass* ik) { for (int i = 0; fields[i].valid(); i++) { @@ -295,34 +293,14 @@ bool HeapShared::archive_object(oop obj) { p2i(obj), obj->klass()->external_name()); } - if (java_lang_Module::is_instance(obj)) { - if (Modules::check_module_oop(obj)) { - Modules::update_oops_in_archived_module(obj, append_root(obj)); - } - java_lang_Module::set_module_entry(obj, nullptr); - } else if (java_lang_ClassLoader::is_instance(obj)) { - // class_data will be restored explicitly at run time and after dumptime - guarantee(obj == SystemDictionary::java_platform_loader() || - obj == SystemDictionary::java_system_loader() || - java_lang_ClassLoader::loader_data(obj) == nullptr, "must be"); - if (obj == SystemDictionary::java_platform_loader()) { - _saved_java_platform_loader_data = java_lang_ClassLoader::loader_data_acquire(SystemDictionary::java_platform_loader()); - } else if (obj == SystemDictionary::java_system_loader()) { - _saved_java_system_loader_data = java_lang_ClassLoader::loader_data_acquire(SystemDictionary::java_system_loader()); - } - java_lang_ClassLoader::release_set_loader_data(obj, nullptr); + if (java_lang_Module::is_instance(obj) && Modules::check_archived_module_oop(obj)) { + Modules::update_oops_in_archived_module(obj, append_root(obj)); } return true; } } -void HeapShared::restore_loader_data() { - log_info(cds)("Restoring java platform and system loaders"); - java_lang_ClassLoader::release_set_loader_data(SystemDictionary::java_platform_loader(), _saved_java_platform_loader_data); - java_lang_ClassLoader::release_set_loader_data(SystemDictionary::java_system_loader(), _saved_java_system_loader_data); -} - class MetaspaceObjToOopHandleTable: public ResourceHashtablecontains_blob(cb)) { + if ((*heap)->contains(cb)) { return *heap; } } @@ -604,6 +604,7 @@ void CodeCache::free(CodeBlob* cb) { heap->set_adapter_count(heap->adapter_count() - 1); } + cb->~CodeBlob(); // Get heap for given CodeBlob and deallocate get_code_heap(cb)->deallocate(cb); diff --git a/src/hotspot/share/code/codeCache.hpp b/src/hotspot/share/code/codeCache.hpp index 5645d5067f6..8abc4043ae6 100644 --- a/src/hotspot/share/code/codeCache.hpp +++ b/src/hotspot/share/code/codeCache.hpp @@ -117,7 +117,7 @@ class CodeCache : AllStatic { // Creates a new heap with the given name and size, containing CodeBlobs of the given type static void add_heap(ReservedSpace rs, const char* name, CodeBlobType code_blob_type); static CodeHeap* get_code_heap_containing(void* p); // Returns the CodeHeap containing the given pointer, or nullptr - static CodeHeap* get_code_heap(const CodeBlob* cb); // Returns the CodeHeap for the given CodeBlob + static CodeHeap* get_code_heap(const void* cb); // Returns the CodeHeap for the given CodeBlob static CodeHeap* get_code_heap(CodeBlobType code_blob_type); // Returns the CodeHeap for the given CodeBlobType // Returns the name of the VM option to set the size of the corresponding CodeHeap static const char* get_code_heap_flag_name(CodeBlobType code_blob_type); @@ -397,10 +397,10 @@ template class CodeBlobIterator : publi // If set to nullptr, initialized by first call to next() _code_blob = nm; if (nm != nullptr) { - while(!(*_heap)->contains_blob(_code_blob)) { + while(!(*_heap)->contains(_code_blob)) { ++_heap; } - assert((*_heap)->contains_blob(_code_blob), "match not found"); + assert((*_heap)->contains(_code_blob), "match not found"); } } diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index 2eedda37b43..723e7a08cc0 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -1770,17 +1770,22 @@ bool CompileBroker::init_compiler_runtime() { return true; } +void CompileBroker::free_buffer_blob_if_allocated(CompilerThread* thread) { + BufferBlob* blob = thread->get_buffer_blob(); + if (blob != nullptr) { + blob->flush(); + MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); + CodeCache::free(blob); + } +} + /** * If C1 and/or C2 initialization failed, we shut down all compilation. * We do this to keep things simple. This can be changed if it ever turns * out to be a problem. */ void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) { - // Free buffer blob, if allocated - if (thread->get_buffer_blob() != nullptr) { - MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - CodeCache::free(thread->get_buffer_blob()); - } + free_buffer_blob_if_allocated(thread); if (comp->should_perform_shutdown()) { // There are two reasons for shutting down the compiler @@ -1919,11 +1924,7 @@ void CompileBroker::compiler_thread_loop() { // Notify compiler that the compiler thread is about to stop thread->compiler()->stopping_compiler_thread(thread); - // Free buffer blob, if allocated - if (thread->get_buffer_blob() != nullptr) { - MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - CodeCache::free(thread->get_buffer_blob()); - } + free_buffer_blob_if_allocated(thread); return; // Stop this thread. } } diff --git a/src/hotspot/share/compiler/compileBroker.hpp b/src/hotspot/share/compiler/compileBroker.hpp index 1ce736528ac..92c8628d18e 100644 --- a/src/hotspot/share/compiler/compileBroker.hpp +++ b/src/hotspot/share/compiler/compileBroker.hpp @@ -252,6 +252,8 @@ class CompileBroker: AllStatic { static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread); #endif + static void free_buffer_blob_if_allocated(CompilerThread* thread); + static void invoke_compiler_on_method(CompileTask* task); static void handle_compile_error(CompilerThread* thread, CompileTask* task, ciEnv* ci_env, int compilable, const char* failure_reason); diff --git a/src/hotspot/share/gc/g1/g1Analytics.cpp b/src/hotspot/share/gc/g1/g1Analytics.cpp index f1d032061dc..5809bfa2b6c 100644 --- a/src/hotspot/share/gc/g1/g1Analytics.cpp +++ b/src/hotspot/share/gc/g1/g1Analytics.cpp @@ -83,7 +83,7 @@ G1Analytics::G1Analytics(const G1Predictions* predictor) : _cost_per_code_root_ms_seq(TruncatedSeqLength), _cost_per_byte_copied_ms_seq(TruncatedSeqLength), _pending_cards_seq(TruncatedSeqLength), - _rs_length_seq(TruncatedSeqLength), + _card_rs_length_seq(TruncatedSeqLength), _code_root_rs_length_seq(TruncatedSeqLength), _constant_other_time_ms_seq(TruncatedSeqLength), _young_other_cost_per_region_ms_seq(TruncatedSeqLength), @@ -105,7 +105,7 @@ G1Analytics::G1Analytics(const G1Predictions* predictor) : _card_scan_to_merge_ratio_seq.set_initial(young_card_scan_to_merge_ratio_defaults[index]); _cost_per_card_scan_ms_seq.set_initial(young_only_cost_per_card_scan_ms_defaults[index]); - _rs_length_seq.set_initial(0); + _card_rs_length_seq.set_initial(0); _code_root_rs_length_seq.set_initial(0); _cost_per_byte_copied_ms_seq.set_initial(cost_per_byte_ms_defaults[index]); @@ -217,8 +217,8 @@ void G1Analytics::report_pending_cards(double pending_cards, bool for_young_only _pending_cards_seq.add(pending_cards, for_young_only_phase); } -void G1Analytics::report_rs_length(double rs_length, bool for_young_only_phase) { - _rs_length_seq.add(rs_length, for_young_only_phase); +void G1Analytics::report_card_rs_length(double card_rs_length, bool for_young_only_phase) { + _card_rs_length_seq.add(card_rs_length, for_young_only_phase); } void G1Analytics::report_code_root_rs_length(double code_root_rs_length, bool for_young_only_phase) { @@ -245,8 +245,8 @@ size_t G1Analytics::predict_dirtied_cards_in_thread_buffers() const { return predict_size(&_dirtied_cards_in_thread_buffers_seq); } -size_t G1Analytics::predict_scan_card_num(size_t rs_length, bool for_young_only_phase) const { - return rs_length * predict_in_unit_interval(&_card_scan_to_merge_ratio_seq, for_young_only_phase); +size_t G1Analytics::predict_scan_card_num(size_t card_rs_length, bool for_young_only_phase) const { + return card_rs_length * predict_in_unit_interval(&_card_scan_to_merge_ratio_seq, for_young_only_phase); } double G1Analytics::predict_card_merge_time_ms(size_t card_num, bool for_young_only_phase) const { @@ -285,8 +285,8 @@ double G1Analytics::predict_cleanup_time_ms() const { return predict_zero_bounded(&_concurrent_mark_cleanup_times_ms); } -size_t G1Analytics::predict_rs_length(bool for_young_only_phase) const { - return predict_size(&_rs_length_seq, for_young_only_phase); +size_t G1Analytics::predict_card_rs_length(bool for_young_only_phase) const { + return predict_size(&_card_rs_length_seq, for_young_only_phase); } size_t G1Analytics::predict_code_root_rs_length(bool for_young_only_phase) const { diff --git a/src/hotspot/share/gc/g1/g1Analytics.hpp b/src/hotspot/share/gc/g1/g1Analytics.hpp index fa9bb59bb7a..d4c6463b486 100644 --- a/src/hotspot/share/gc/g1/g1Analytics.hpp +++ b/src/hotspot/share/gc/g1/g1Analytics.hpp @@ -63,7 +63,7 @@ class G1Analytics: public CHeapObj { G1PhaseDependentSeq _cost_per_byte_copied_ms_seq; G1PhaseDependentSeq _pending_cards_seq; - G1PhaseDependentSeq _rs_length_seq; + G1PhaseDependentSeq _card_rs_length_seq; G1PhaseDependentSeq _code_root_rs_length_seq; TruncatedSeq _constant_other_time_ms_seq; @@ -132,13 +132,12 @@ class G1Analytics: public CHeapObj { void report_cost_per_card_merge_ms(double cost_per_card_ms, bool for_young_only_phase); void report_cost_per_code_root_scan_ms(double cost_per_code_root_ms, bool for_young_only_phase); void report_card_scan_to_merge_ratio(double cards_per_entry_ratio, bool for_young_only_phase); - void report_rs_length_diff(double rs_length_diff, bool for_young_only_phase); void report_cost_per_byte_ms(double cost_per_byte_ms, bool for_young_only_phase); void report_young_other_cost_per_region_ms(double other_cost_per_region_ms); void report_non_young_other_cost_per_region_ms(double other_cost_per_region_ms); void report_constant_other_time_ms(double constant_other_time_ms); void report_pending_cards(double pending_cards, bool for_young_only_phase); - void report_rs_length(double rs_length, bool for_young_only_phase); + void report_card_rs_length(double card_rs_length, bool for_young_only_phase); void report_code_root_rs_length(double code_root_rs_length, bool for_young_only_phase); double predict_alloc_rate_ms() const; @@ -148,9 +147,9 @@ class G1Analytics: public CHeapObj { double predict_dirtied_cards_rate_ms() const; size_t predict_dirtied_cards_in_thread_buffers() const; - // Predict how many of the given remembered set of length rs_length will add to + // Predict how many of the given remembered set of length card_rs_length will add to // the number of total cards scanned. - size_t predict_scan_card_num(size_t rs_length, bool for_young_only_phase) const; + size_t predict_scan_card_num(size_t card_rs_length, bool for_young_only_phase) const; double predict_card_merge_time_ms(size_t card_num, bool for_young_only_phase) const; double predict_card_scan_time_ms(size_t card_num, bool for_young_only_phase) const; @@ -169,7 +168,7 @@ class G1Analytics: public CHeapObj { double predict_cleanup_time_ms() const; - size_t predict_rs_length(bool for_young_only_phase) const; + size_t predict_card_rs_length(bool for_young_only_phase) const; size_t predict_code_root_rs_length(bool for_young_only_phase) const; size_t predict_pending_cards(bool for_young_only_phase) const; diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp index 9aab42afc45..aebdd2c43f5 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp @@ -279,21 +279,21 @@ uint64_t G1ConcurrentRefine::adjust_threads_wait_ms() const { class G1ConcurrentRefine::RemSetSamplingClosure : public HeapRegionClosure { G1CollectionSet* _cset; - size_t _sampled_rs_length; + size_t _sampled_card_rs_length; size_t _sampled_code_root_rs_length; public: explicit RemSetSamplingClosure(G1CollectionSet* cset) : - _cset(cset), _sampled_rs_length(0), _sampled_code_root_rs_length(0) {} + _cset(cset), _sampled_card_rs_length(0), _sampled_code_root_rs_length(0) {} bool do_heap_region(HeapRegion* r) override { HeapRegionRemSet* rem_set = r->rem_set(); - _sampled_rs_length += rem_set->occupied(); + _sampled_card_rs_length += rem_set->occupied(); _sampled_code_root_rs_length += rem_set->code_roots_list_length(); return false; } - size_t sampled_rs_length() const { return _sampled_rs_length; } + size_t sampled_card_rs_length() const { return _sampled_card_rs_length; } size_t sampled_code_root_rs_length() const { return _sampled_code_root_rs_length; } }; @@ -314,7 +314,7 @@ void G1ConcurrentRefine::adjust_young_list_target_length() { G1CollectionSet* cset = G1CollectedHeap::heap()->collection_set(); RemSetSamplingClosure cl{cset}; cset->iterate(&cl); - _policy->revise_young_list_target_length(cl.sampled_rs_length(), cl.sampled_code_root_rs_length()); + _policy->revise_young_list_target_length(cl.sampled_card_rs_length(), cl.sampled_code_root_rs_length()); } } diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp index 4990dd64217..33e8ad79754 100644 --- a/src/hotspot/share/gc/g1/g1Policy.cpp +++ b/src/hotspot/share/gc/g1/g1Policy.cpp @@ -70,7 +70,7 @@ G1Policy::G1Policy(STWGCTimer* gc_timer) : _reserve_regions(0), _young_gen_sizer(), _free_regions_at_end_of_collection(0), - _rs_length(0), + _card_rs_length(0), _pending_cards_at_gc_start(0), _concurrent_start_to_mixed(), _collection_set(nullptr), @@ -189,20 +189,20 @@ void G1Policy::update_young_length_bounds() { assert(!Universe::is_fully_initialized() || SafepointSynchronize::is_at_safepoint(), "must be"); bool for_young_only_phase = collector_state()->in_young_only_phase(); update_young_length_bounds(_analytics->predict_pending_cards(for_young_only_phase), - _analytics->predict_rs_length(for_young_only_phase), + _analytics->predict_card_rs_length(for_young_only_phase), _analytics->predict_code_root_rs_length(for_young_only_phase)); } -void G1Policy::update_young_length_bounds(size_t pending_cards, size_t rs_length, size_t code_root_rs_length) { +void G1Policy::update_young_length_bounds(size_t pending_cards, size_t card_rs_length, size_t code_root_rs_length) { uint old_young_list_target_length = young_list_target_length(); - uint new_young_list_desired_length = calculate_young_desired_length(pending_cards, rs_length, code_root_rs_length); + uint new_young_list_desired_length = calculate_young_desired_length(pending_cards, card_rs_length, code_root_rs_length); uint new_young_list_target_length = calculate_young_target_length(new_young_list_desired_length); uint new_young_list_max_length = calculate_young_max_length(new_young_list_target_length); - log_trace(gc, ergo, heap)("Young list length update: pending cards %zu rs_length %zu old target %u desired: %u target: %u max: %u", + log_trace(gc, ergo, heap)("Young list length update: pending cards %zu card_rs_length %zu old target %u desired: %u target: %u max: %u", pending_cards, - rs_length, + card_rs_length, old_young_list_target_length, new_young_list_desired_length, new_young_list_target_length, @@ -236,7 +236,7 @@ void G1Policy::update_young_length_bounds(size_t pending_cards, size_t rs_length // This return value is only an expectation. // uint G1Policy::calculate_young_desired_length(size_t pending_cards, - size_t rs_length, + size_t card_rs_length, size_t code_root_rs_length) const { uint min_young_length_by_sizer = _young_gen_sizer.min_desired_young_length(); uint max_young_length_by_sizer = _young_gen_sizer.max_desired_young_length(); @@ -270,7 +270,7 @@ uint G1Policy::calculate_young_desired_length(size_t pending_cards, if (use_adaptive_young_list_length()) { desired_eden_length_by_mmu = calculate_desired_eden_length_by_mmu(); - double base_time_ms = predict_base_time_ms(pending_cards, rs_length, code_root_rs_length); + double base_time_ms = predict_base_time_ms(pending_cards, card_rs_length, code_root_rs_length); double retained_time_ms = predict_retained_regions_evac_time(); double total_time_ms = base_time_ms + retained_time_ms; @@ -553,13 +553,13 @@ G1GCPhaseTimes* G1Policy::phase_times() const { return _phase_times; } -void G1Policy::revise_young_list_target_length(size_t rs_length, size_t code_root_rs_length) { +void G1Policy::revise_young_list_target_length(size_t card_rs_length, size_t code_root_rs_length) { guarantee(use_adaptive_young_list_length(), "should not call this otherwise" ); size_t thread_buffer_cards = _analytics->predict_dirtied_cards_in_thread_buffers(); G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set(); size_t pending_cards = dcqs.num_cards() + thread_buffer_cards; - update_young_length_bounds(pending_cards, rs_length, code_root_rs_length); + update_young_length_bounds(pending_cards, card_rs_length, code_root_rs_length); } void G1Policy::record_full_collection_start() { @@ -925,7 +925,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar _analytics->report_constant_other_time_ms(constant_other_time_ms(pause_time_ms)); _analytics->report_pending_cards((double)pending_cards_at_gc_start(), is_young_only_pause); - _analytics->report_rs_length((double)_rs_length, is_young_only_pause); + _analytics->report_card_rs_length((double)_card_rs_length, is_young_only_pause); _analytics->report_code_root_rs_length((double)total_code_roots_scanned, is_young_only_pause); } @@ -1048,16 +1048,16 @@ void G1Policy::record_young_gc_pause_end(bool evacuation_failed) { } double G1Policy::predict_base_time_ms(size_t pending_cards, - size_t rs_length, + size_t card_rs_length, size_t code_root_rs_length) const { bool in_young_only_phase = collector_state()->in_young_only_phase(); - size_t unique_cards_from_rs = _analytics->predict_scan_card_num(rs_length, in_young_only_phase); + size_t unique_cards_from_rs = _analytics->predict_scan_card_num(card_rs_length, in_young_only_phase); // Assume that all cards from the log buffers will be scanned, i.e. there are no // duplicates in that set. size_t effective_scanned_cards = unique_cards_from_rs + pending_cards; - double card_merge_time = _analytics->predict_card_merge_time_ms(pending_cards + rs_length, in_young_only_phase); + double card_merge_time = _analytics->predict_card_merge_time_ms(pending_cards + card_rs_length, in_young_only_phase); double card_scan_time = _analytics->predict_card_scan_time_ms(effective_scanned_cards, in_young_only_phase); double code_root_scan_time = _analytics->predict_code_root_scan_time_ms(code_root_rs_length, in_young_only_phase); double constant_other_time = _analytics->predict_constant_other_time_ms(); @@ -1065,10 +1065,10 @@ double G1Policy::predict_base_time_ms(size_t pending_cards, double total_time = card_merge_time + card_scan_time + code_root_scan_time + constant_other_time + survivor_evac_time; - log_trace(gc, ergo, heap)("Predicted base time: total %f lb_cards %zu rs_length %zu effective_scanned_cards %zu " + log_trace(gc, ergo, heap)("Predicted base time: total %f lb_cards %zu card_rs_length %zu effective_scanned_cards %zu " "card_merge_time %f card_scan_time %f code_root_rs_length %zu code_root_scan_time %f " "constant_other_time %f survivor_evac_time %f", - total_time, pending_cards, rs_length, effective_scanned_cards, + total_time, pending_cards, card_rs_length, effective_scanned_cards, card_merge_time, card_scan_time, code_root_rs_length, code_root_scan_time, constant_other_time, survivor_evac_time); return total_time; @@ -1076,9 +1076,9 @@ double G1Policy::predict_base_time_ms(size_t pending_cards, double G1Policy::predict_base_time_ms(size_t pending_cards) const { bool for_young_only_phase = collector_state()->in_young_only_phase(); - size_t rs_length = _analytics->predict_rs_length(for_young_only_phase); + size_t card_rs_length = _analytics->predict_card_rs_length(for_young_only_phase); size_t code_root_rs_length = _analytics->predict_code_root_rs_length(for_young_only_phase); - return predict_base_time_ms(pending_cards, rs_length, code_root_rs_length); + return predict_base_time_ms(pending_cards, card_rs_length, code_root_rs_length); } size_t G1Policy::predict_bytes_to_copy(HeapRegion* hr) const { @@ -1112,11 +1112,11 @@ double G1Policy::predict_region_copy_time_ms(HeapRegion* hr, bool for_young_only } double G1Policy::predict_region_merge_scan_time(HeapRegion* hr, bool for_young_only_phase) const { - size_t rs_length = hr->rem_set()->occupied(); - size_t scan_card_num = _analytics->predict_scan_card_num(rs_length, for_young_only_phase); + size_t card_rs_length = hr->rem_set()->occupied(); + size_t scan_card_num = _analytics->predict_scan_card_num(card_rs_length, for_young_only_phase); return - _analytics->predict_card_merge_time_ms(rs_length, for_young_only_phase) + + _analytics->predict_card_merge_time_ms(card_rs_length, for_young_only_phase) + _analytics->predict_card_scan_time_ms(scan_card_num, for_young_only_phase); } diff --git a/src/hotspot/share/gc/g1/g1Policy.hpp b/src/hotspot/share/gc/g1/g1Policy.hpp index e478f7ebcdb..7ecfc4dd2f7 100644 --- a/src/hotspot/share/gc/g1/g1Policy.hpp +++ b/src/hotspot/share/gc/g1/g1Policy.hpp @@ -103,7 +103,7 @@ class G1Policy: public CHeapObj { uint _free_regions_at_end_of_collection; - size_t _rs_length; + size_t _card_rs_length; size_t _pending_cards_at_gc_start; @@ -132,8 +132,8 @@ class G1Policy: public CHeapObj { hr->install_surv_rate_group(_survivor_surv_rate_group); } - void record_rs_length(size_t rs_length) { - _rs_length = rs_length; + void record_card_rs_length(size_t card_rs_length) { + _card_rs_length = card_rs_length; } double predict_base_time_ms(size_t pending_cards) const; @@ -142,7 +142,7 @@ class G1Policy: public CHeapObj { // Base time contains handling remembered sets and constant other time of the // whole young gen, refinement buffers, and copying survivors. // Basically everything but copying eden regions. - double predict_base_time_ms(size_t pending_cards, size_t rs_length, size_t code_root_length) const; + double predict_base_time_ms(size_t pending_cards, size_t card_rs_length, size_t code_root_length) const; // Copy time for a region is copying live data. double predict_region_copy_time_ms(HeapRegion* hr, bool for_young_only_phase) const; @@ -213,15 +213,14 @@ class G1Policy: public CHeapObj { // If no parameters are passed, predict pending cards, card set remset length and // code root remset length using the prediction model. void update_young_length_bounds(); - void update_young_length_bounds(size_t pending_cards, size_t rs_length, size_t code_root_rs_length); + void update_young_length_bounds(size_t pending_cards, size_t card_rs_length, size_t code_root_rs_length); // Calculate and return the minimum desired eden length based on the MMU target. uint calculate_desired_eden_length_by_mmu() const; // Calculate the desired eden length meeting the pause time goal. - // The parameters are: rs_length represents the prediction of how large the - // young RSet lengths will be, min_eden_length and max_eden_length are the bounds - // (inclusive) within eden can grow. + // Min_eden_length and max_eden_length are the bounds + // (inclusive) within which eden can grow. uint calculate_desired_eden_length_by_pause(double base_time_ms, uint min_eden_length, uint max_eden_length) const; @@ -241,7 +240,7 @@ class G1Policy: public CHeapObj { // Calculate desired young length based on current situation without taking actually // available free regions into account. - uint calculate_young_desired_length(size_t pending_cards, size_t rs_length, size_t code_root_rs_length) const; + uint calculate_young_desired_length(size_t pending_cards, size_t card_rs_length, size_t code_root_rs_length) const; // Limit the given desired young length to available free regions. uint calculate_young_target_length(uint desired_young_length) const; // The GCLocker might cause us to need more regions than the target. Calculate @@ -304,7 +303,7 @@ class G1Policy: public CHeapObj { // Check the current value of the young list RSet length and // compare it against the last prediction. If the current value is // higher, recalculate the young list target length prediction. - void revise_young_list_target_length(size_t rs_length, size_t code_root_rs_length); + void revise_young_list_target_length(size_t card_rs_length, size_t code_root_rs_length); // This should be called after the heap is resized. void record_new_heap_size(uint new_number_of_regions); diff --git a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp index 798e6f3c604..02820869148 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp @@ -434,7 +434,7 @@ class FreeCSetStats { size_t _bytes_allocated_in_old_since_last_gc; // Size of young regions turned into old size_t _failure_used_words; // Live size in failed regions size_t _failure_waste_words; // Wasted size in failed regions - size_t _rs_length; // Remembered set size + size_t _card_rs_length; // (Card Set) Remembered set size uint _regions_freed; // Number of regions freed public: @@ -444,7 +444,7 @@ class FreeCSetStats { _bytes_allocated_in_old_since_last_gc(0), _failure_used_words(0), _failure_waste_words(0), - _rs_length(0), + _card_rs_length(0), _regions_freed(0) { } void merge_stats(FreeCSetStats* other) { @@ -454,7 +454,7 @@ class FreeCSetStats { _bytes_allocated_in_old_since_last_gc += other->_bytes_allocated_in_old_since_last_gc; _failure_used_words += other->_failure_used_words; _failure_waste_words += other->_failure_waste_words; - _rs_length += other->_rs_length; + _card_rs_length += other->_card_rs_length; _regions_freed += other->_regions_freed; } @@ -468,7 +468,7 @@ class FreeCSetStats { G1Policy *policy = g1h->policy(); policy->old_gen_alloc_tracker()->add_allocated_bytes_since_last_gc(_bytes_allocated_in_old_since_last_gc); - policy->record_rs_length(_rs_length); + policy->record_card_rs_length(_card_rs_length); policy->cset_regions_freed(); } @@ -495,8 +495,8 @@ class FreeCSetStats { _regions_freed += 1; } - void account_rs_length(HeapRegion* r) { - _rs_length += r->rem_set()->occupied(); + void account_card_rs_length(HeapRegion* r) { + _card_rs_length += r->rem_set()->occupied(); } }; @@ -617,7 +617,7 @@ class FreeCSetClosure : public HeapRegionClosure { JFREventForRegion event(r, _worker_id); TimerForRegion timer(timer_for_region(r)); - stats()->account_rs_length(r); + stats()->account_card_rs_length(r); if (r->is_young()) { assert_tracks_surviving_words(r); diff --git a/src/hotspot/share/gc/shared/taskqueue.inline.hpp b/src/hotspot/share/gc/shared/taskqueue.inline.hpp index 8faeb73cb8d..f937ce8a2e9 100644 --- a/src/hotspot/share/gc/shared/taskqueue.inline.hpp +++ b/src/hotspot/share/gc/shared/taskqueue.inline.hpp @@ -99,13 +99,13 @@ inline void GenericTaskQueueSet::print_and_reset_taskqueue_stats(const cha template inline GenericTaskQueue::GenericTaskQueue() : - _elems(ArrayAllocator::allocate(N, F)), + _elems(MallocArrayAllocator::allocate(N, F)), _last_stolen_queue_id(InvalidQueueId), _seed(17 /* random number */) {} template inline GenericTaskQueue::~GenericTaskQueue() { - ArrayAllocator::free(_elems, N); + MallocArrayAllocator::free(_elems); } template inline bool diff --git a/src/hotspot/share/gc/shared/tlab_globals.hpp b/src/hotspot/share/gc/shared/tlab_globals.hpp index 8ecc5283642..0b047b4b9e8 100644 --- a/src/hotspot/share/gc/shared/tlab_globals.hpp +++ b/src/hotspot/share/gc/shared/tlab_globals.hpp @@ -70,10 +70,13 @@ "Allocation averaging weight") \ range(0, 100) \ \ + /* At GC all TLABs are retired, and each thread's active */ \ + /* TLAB is assumed to be half full on average. The */ \ + /* remaining space is waste, proportional to TLAB size. */ \ + product(uintx, TLABWasteTargetPercent, 1, \ + "Percentage of Eden that can be wasted (half-full TLABs at GC)") \ /* Limit the lower bound of this flag to 1 as it is used */ \ /* in a division expression. */ \ - product(uintx, TLABWasteTargetPercent, 1, \ - "Percentage of Eden that can be wasted") \ range(1, 100) \ \ product(uintx, TLABRefillWasteFraction, 64, \ diff --git a/src/hotspot/share/memory/allocation.hpp b/src/hotspot/share/memory/allocation.hpp index 0bb1840fd34..50bb2e0c68b 100644 --- a/src/hotspot/share/memory/allocation.hpp +++ b/src/hotspot/share/memory/allocation.hpp @@ -616,32 +616,6 @@ class ReallocMark: public StackObj { void check() PRODUCT_RETURN; }; -// Helper class to allocate arrays that may become large. -// Uses the OS malloc for allocations smaller than ArrayAllocatorMallocLimit -// and uses mapped memory for larger allocations. -// Most OS mallocs do something similar but Solaris malloc does not revert -// to mapped memory for large allocations. By default ArrayAllocatorMallocLimit -// is set so that we always use malloc except for Solaris where we set the -// limit to get mapped memory. -template -class ArrayAllocator : public AllStatic { - private: - static bool should_use_malloc(size_t length); - - static E* allocate_malloc(size_t length, MEMFLAGS flags); - static E* allocate_mmap(size_t length, MEMFLAGS flags); - - static E* reallocate_malloc(E* addr, size_t new_length, MEMFLAGS flags); - - static void free_malloc(E* addr, size_t length); - static void free_mmap(E* addr, size_t length); - - public: - static E* allocate(size_t length, MEMFLAGS flags); - static E* reallocate(E* old_addr, size_t old_length, size_t new_length, MEMFLAGS flags); - static void free(E* addr, size_t length); -}; - // Uses mmapped memory for all allocations. All allocations are initially // zero-filled. No pre-touching. template diff --git a/src/hotspot/share/memory/allocation.inline.hpp b/src/hotspot/share/memory/allocation.inline.hpp index fa2b2a7a7e3..4a1b0b0c597 100644 --- a/src/hotspot/share/memory/allocation.inline.hpp +++ b/src/hotspot/share/memory/allocation.inline.hpp @@ -111,75 +111,4 @@ void MallocArrayAllocator::free(E* addr) { FreeHeap(addr); } -template -bool ArrayAllocator::should_use_malloc(size_t length) { - return MallocArrayAllocator::size_for(length) < ArrayAllocatorMallocLimit; -} - -template -E* ArrayAllocator::allocate_malloc(size_t length, MEMFLAGS flags) { - return MallocArrayAllocator::allocate(length, flags); -} - -template -E* ArrayAllocator::allocate_mmap(size_t length, MEMFLAGS flags) { - return MmapArrayAllocator::allocate(length, flags); -} - -template -E* ArrayAllocator::allocate(size_t length, MEMFLAGS flags) { - if (should_use_malloc(length)) { - return allocate_malloc(length, flags); - } - - return allocate_mmap(length, flags); -} - -template -E* ArrayAllocator::reallocate_malloc(E* addr, size_t new_length, MEMFLAGS flags) { - return MallocArrayAllocator::reallocate(addr, new_length, flags); -} - -template -E* ArrayAllocator::reallocate(E* old_addr, size_t old_length, size_t new_length, MEMFLAGS flags) { - if (should_use_malloc(old_length) && should_use_malloc(new_length)) { - return reallocate_malloc(old_addr, new_length, flags); - } - - E* new_addr = (new_length > 0) - ? allocate(new_length, flags) - : nullptr; - - if (new_addr != nullptr && old_addr != nullptr) { - memcpy(new_addr, old_addr, MIN2(old_length, new_length) * sizeof(E)); - } - - if (old_addr != nullptr) { - free(old_addr, old_length); - } - - return new_addr; -} - -template -void ArrayAllocator::free_malloc(E* addr, size_t length) { - MallocArrayAllocator::free(addr); -} - -template -void ArrayAllocator::free_mmap(E* addr, size_t length) { - MmapArrayAllocator::free(addr, length); -} - -template -void ArrayAllocator::free(E* addr, size_t length) { - if (addr != nullptr) { - if (should_use_malloc(length)) { - free_malloc(addr, length); - } else { - free_mmap(addr, length); - } - } -} - #endif // SHARE_MEMORY_ALLOCATION_INLINE_HPP diff --git a/src/hotspot/share/memory/heap.hpp b/src/hotspot/share/memory/heap.hpp index 97ac11708c1..da02eecae49 100644 --- a/src/hotspot/share/memory/heap.hpp +++ b/src/hotspot/share/memory/heap.hpp @@ -171,9 +171,6 @@ class CodeHeap : public CHeapObj { // Containment means "contained in committed space". bool contains(const void* p) const { return low() <= p && p < high(); } - bool contains_blob(const CodeBlob* blob) const { - return contains((void*)blob); - } void* find_start(void* p) const; // returns the block containing p or null CodeBlob* find_blob(void* start) const; diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 6b96e109d11..4ae156a773e 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -1888,10 +1888,6 @@ const int ObjectAlignmentInBytes = 8; product(bool, WhiteBoxAPI, false, DIAGNOSTIC, \ "Enable internal testing APIs") \ \ - product(size_t, ArrayAllocatorMallocLimit, SIZE_MAX, EXPERIMENTAL, \ - "Allocation less than this value will be allocated " \ - "using malloc. Larger allocations will use mmap.") \ - \ product(bool, AlwaysAtomicAccesses, false, EXPERIMENTAL, \ "Accesses to all variables should always be atomic") \ \ diff --git a/src/hotspot/share/utilities/bitMap.cpp b/src/hotspot/share/utilities/bitMap.cpp index 5ab586debd9..3cef6122557 100644 --- a/src/hotspot/share/utilities/bitMap.cpp +++ b/src/hotspot/share/utilities/bitMap.cpp @@ -135,15 +135,17 @@ CHeapBitMap::~CHeapBitMap() { } bm_word_t* CHeapBitMap::allocate(idx_t size_in_words) const { - return ArrayAllocator::allocate(size_in_words, _flags); + return MallocArrayAllocator::allocate(size_in_words, _flags); } +// GrowableBitMap::resize uses free(ptr, size) for T as CHeapBitMap, ArenaBitMap and ResourceBitMap allocators. +// The free(ptr, size) signature is kept but the size parameter is ignored. void CHeapBitMap::free(bm_word_t* map, idx_t size_in_words) const { - ArrayAllocator::free(map, size_in_words); + MallocArrayAllocator::free(map); } bm_word_t* CHeapBitMap::reallocate(bm_word_t* map, size_t old_size_in_words, size_t new_size_in_words) const { - return ArrayAllocator::reallocate(map, old_size_in_words, new_size_in_words, _flags); + return MallocArrayAllocator::reallocate(map, new_size_in_words, _flags); } #ifdef ASSERT diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java index d0fcb48c013..f8e71aa3761 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2023, 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 @@ -43,8 +43,10 @@ public void update(Observable o, Object data) { } private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { - Type type = db.lookupType("ObjectSynchronizer"); - inUseList = type.getAddressField("_in_use_list").getValue(); + Type objectSynchronizerType = db.lookupType("ObjectSynchronizer"); + Type monitorListType = db.lookupType("MonitorList"); + Address monitorListAddr = objectSynchronizerType.getField("_in_use_list").getStaticFieldAddress(); + inUseListHead = monitorListType.getAddressField("_head").getAddress(monitorListAddr); } public long identityHashValueFor(Oop obj) { @@ -70,11 +72,7 @@ public long identityHashValueFor(Oop obj) { } public static Iterator objectMonitorIterator() { - if (inUseList != null) { - return new ObjectMonitorIterator(); - } else { - return null; - } + return new ObjectMonitorIterator(); } private static class ObjectMonitorIterator implements Iterator { @@ -83,21 +81,23 @@ private static class ObjectMonitorIterator implements Iterator { // are not returned by this Iterator. ObjectMonitorIterator() { - mon = new ObjectMonitor(inUseList); + mon = inUseListHead == null ? null : new ObjectMonitor(inUseListHead); } public boolean hasNext() { - return (mon.nextOM() != null); + return (mon != null); } public Object next() { - // advance to next entry - Address monAddr = mon.nextOM(); - if (monAddr == null) { + ObjectMonitor ret = mon; + if (ret == null) { throw new NoSuchElementException(); } - mon = new ObjectMonitor(monAddr); - return mon; + // advance to next entry + Address nextMon = mon.nextOM(); + mon = nextMon == null ? null : new ObjectMonitor(nextMon); + + return ret; } public void remove() { @@ -107,6 +107,6 @@ public void remove() { private ObjectMonitor mon; } - private static Address inUseList; + private static Address inUseListHead; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/aarch64/AARCH64Frame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/aarch64/AARCH64Frame.java index dfd2ddb9228..5d8712002f8 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/aarch64/AARCH64Frame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/aarch64/AARCH64Frame.java @@ -524,7 +524,8 @@ public BasicObjectLock interpreterFrameMonitorBegin() { } public BasicObjectLock interpreterFrameMonitorEnd() { - Address result = addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET).getAddressAt(0); + long n = addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET).getCIntegerAt(0, VM.getVM().getAddressSize(), false); + Address result = getFP().addOffsetTo(n * VM.getVM().getAddressSize()); if (Assert.ASSERTS_ENABLED) { // make sure the pointer points inside the frame Assert.that(AddressOps.gt(getFP(), result), "result must < than frame pointer"); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64Frame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64Frame.java index 953e4f09ccc..710f30f19f2 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64Frame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ppc64/PPC64Frame.java @@ -445,7 +445,8 @@ public BasicObjectLock interpreterFrameMonitorBegin() { } public BasicObjectLock interpreterFrameMonitorEnd() { - Address result = addressOfStackSlot(INTERPRETER_FRAME_MONITORS_OFFSET).getAddressAt(0); + long n = addressOfStackSlot(INTERPRETER_FRAME_MONITORS_OFFSET).getCIntegerAt(0, VM.getVM().getAddressSize(), false); + Address result = getFP().addOffsetTo(n * VM.getVM().getAddressSize()); if (Assert.ASSERTS_ENABLED) { // make sure the pointer points inside the frame Assert.that(AddressOps.gt(getFP(), result), "result must < than frame pointer"); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java index b21a163e970..c8e503db93b 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java @@ -496,7 +496,8 @@ public BasicObjectLock interpreterFrameMonitorBegin() { } public BasicObjectLock interpreterFrameMonitorEnd() { - Address result = addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET).getAddressAt(0); + long n = addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET).getCIntegerAt(0, VM.getVM().getAddressSize(), false); + Address result = getFP().addOffsetTo(n * VM.getVM().getAddressSize()); if (Assert.ASSERTS_ENABLED) { // make sure the pointer points inside the frame Assert.that(AddressOps.gt(getFP(), result), "result must < than frame pointer"); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java index b33e88dc25f..1ffc9761a33 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/x86/X86Frame.java @@ -512,7 +512,8 @@ public BasicObjectLock interpreterFrameMonitorBegin() { } public BasicObjectLock interpreterFrameMonitorEnd() { - Address result = addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET).getAddressAt(0); + long n = addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET).getCIntegerAt(0, VM.getVM().getAddressSize(), false); + Address result = getFP().addOffsetTo(n * VM.getVM().getAddressSize()); if (Assert.ASSERTS_ENABLED) { // make sure the pointer points inside the frame Assert.that(AddressOps.gt(getFP(), result), "result must < than frame pointer"); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/MonitorCacheDumpPanel.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/MonitorCacheDumpPanel.java index ed3ccb2c496..ffedbc51598 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/MonitorCacheDumpPanel.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/MonitorCacheDumpPanel.java @@ -94,11 +94,6 @@ private static void dumpMonitor(PrintStream tty, ObjectMonitor mon, boolean raw) private void dumpOn(PrintStream tty) { Iterator i = ObjectSynchronizer.objectMonitorIterator(); - if (i == null) { - tty.println("This version of HotSpot VM doesn't support monitor cache dump."); - tty.println("You need 1.4.0_04, 1.4.1_01 or later versions"); - return; - } ObjectMonitor mon; while (i.hasNext()) { mon = (ObjectMonitor)i.next(); diff --git a/src/jdk.management/windows/native/libmanagement_ext/OperatingSystemImpl.c b/src/jdk.management/windows/native/libmanagement_ext/OperatingSystemImpl.c index 26d46ddaeac..746bd97c7ff 100644 --- a/src/jdk.management/windows/native/libmanagement_ext/OperatingSystemImpl.c +++ b/src/jdk.management/windows/native/libmanagement_ext/OperatingSystemImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, 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 @@ -698,6 +698,8 @@ getProcessID() { * (in order to keep this index valid when the list resets from underneath, * ensure to call getCurrentQueryIndexForProcess() before every query involving * Process object instance data). + * + * Returns -1 on failure. */ static int currentQueryIndexForProcess(void) { @@ -775,8 +777,7 @@ static int getCurrentQueryIndexForProcess() { int currentQueryIndex = currentQueryIndexForProcess(); - assert(currentQueryIndex >= 0 && - currentQueryIndex < numberOfJavaProcessesAtInitialization); + assert(currentQueryIndex < numberOfJavaProcessesAtInitialization); return currentQueryIndex; } @@ -1310,11 +1311,10 @@ perfGetProcessCPULoad() { } currentQueryIndex = getCurrentQueryIndexForProcess(); - - if (getPerformanceData(&processTotalCPULoad[currentQueryIndex].query, - processTotalCPULoad[currentQueryIndex].counter, - &cv, - PDH_FMT_DOUBLE | PDH_FMT_NOCAP100) == 0) { + if (currentQueryIndex >= 0 && getPerformanceData(&processTotalCPULoad[currentQueryIndex].query, + processTotalCPULoad[currentQueryIndex].counter, + &cv, + PDH_FMT_DOUBLE | PDH_FMT_NOCAP100) == 0) { double d = cv.doubleValue / cpuFactor; d = min(1, d); d = max(0, d); diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/PatternAction.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/PatternAction.java index 8e0525aa8f8..5eafdb46e63 100644 --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/PatternAction.java +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/PatternAction.java @@ -36,6 +36,7 @@ public class PatternAction implements Action { private final SimpleAction action; private final String[] originalArgs; + private final String originalSuccessArtifacts; public PatternAction(String id, Properties properties) throws InvalidValueException { @@ -47,6 +48,11 @@ public PatternAction(String name, String id, Properties properties) action = new SimpleAction(name != null ? ("pattern." + name) : "pattern", id, properties); ValueHandler.apply(this, properties, id); originalArgs = action.args.clone(); + ActionParameters params = action.getParameters(); + // just like the "args" the "successArtifacts" param can also contain pattern that + // this PatternAction will (sometimes repeatedly) replace, so we keep track of + // the original (un-replaced text) + originalSuccessArtifacts = params == null ? null : params.successArtifacts; } public ProcessBuilder prepareProcess(HtmlSection section, @@ -63,9 +69,9 @@ public ProcessBuilder prepareProcess(HtmlSection section, args[i] = args[i].replace("%java", helper.findApp("java").getAbsolutePath()); } // replace occurrences of the pattern in the "successArtifacts" param - String successArtifacts = action.getParameters().successArtifacts; - if (successArtifacts != null) { - action.getParameters().successArtifacts = successArtifacts.replaceAll(pattern, value); + if (originalSuccessArtifacts != null) { + action.getParameters().successArtifacts = originalSuccessArtifacts.replaceAll(pattern, + value); } return action.prepareProcess(section.getWriter(), helper); } diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 519c1b7eed4..b2922d884e1 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -133,7 +133,6 @@ serviceability/sa/TestJmapCoreMetaspace.java 8267433 macosx-x64 serviceability/sa/ClhsdbDumpclass.java 8316342 generic-all serviceability/attach/ConcAttachTest.java 8290043 linux-all -serviceability/jvmti/RedefineClasses/RedefineLeakThrowable.java 8316658 generic-all ############################################################################# diff --git a/test/hotspot/jtreg/gc/arguments/TestArrayAllocatorMallocLimit.java b/test/hotspot/jtreg/gc/arguments/TestArrayAllocatorMallocLimit.java deleted file mode 100644 index 80f0ec4f0cc..00000000000 --- a/test/hotspot/jtreg/gc/arguments/TestArrayAllocatorMallocLimit.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2014, 2023, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package gc.arguments; - -/* - * @test TestArrayAllocatorMallocLimit - * @summary Sanity check that the ArrayAllocatorMallocLimit flag can be set. - * The test helps verifying that size_t flags can be set/read. - * @bug 8054823 - * @library /test/lib - * @library / - * @modules java.base/jdk.internal.misc - * java.management - * @run driver gc.arguments.TestArrayAllocatorMallocLimit - */ - -import jdk.test.lib.Asserts; -import jdk.test.lib.process.OutputAnalyzer; -import java.math.BigInteger; - -public class TestArrayAllocatorMallocLimit { - public static void main(String [] args) throws Exception { - testDefaultValue(); - testSetValue(); - } - - private static final String flagName = "ArrayAllocatorMallocLimit"; - - // size_t ArrayAllocatorMallocLimit = 18446744073709551615{experimental} - private static final String printFlagsFinalPattern = " *size_t *" + flagName + " *:?= *(\\d+) *\\{experimental\\} *"; - - public static void testDefaultValue() throws Exception { - ProcessBuilder pb = GCArguments.createTestJvm( - "-XX:+UnlockExperimentalVMOptions", "-XX:+PrintFlagsFinal", "-version"); - - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - String value = output.firstMatch(printFlagsFinalPattern, 1); - - try { - Asserts.assertNotNull(value, "Couldn't find size_t flag " + flagName); - - // A size_t is not always parseable with Long.parseValue, - // use BigInteger instead. - BigInteger biValue = new BigInteger(value); - - // Sanity check that we got a non-zero value. - Asserts.assertNotEquals(biValue, "0"); - - output.shouldHaveExitValue(0); - } catch (Exception e) { - System.err.println(output.getOutput()); - throw e; - } - } - - public static void testSetValue() throws Exception { - long flagValue = 2048; - - ProcessBuilder pb = GCArguments.createJavaProcessBuilder( - "-XX:+UnlockExperimentalVMOptions", "-XX:" + flagName + "=" + flagValue, "-XX:+PrintFlagsFinal", "-version"); - - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - String value = output.firstMatch(printFlagsFinalPattern, 1); - - try { - Asserts.assertNotNull("Couldn't find size_t flag " + flagName); - - long longValue = Long.parseLong(value); - - Asserts.assertEquals(longValue, flagValue); - - output.shouldHaveExitValue(0); - } catch (Exception e) { - System.err.println(output.getOutput()); - throw e; - } - } - -} diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicSharedSymbols.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicSharedSymbols.java index 24305c5a166..f07c775a003 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicSharedSymbols.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicSharedSymbols.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -38,7 +38,7 @@ * @build JCmdTestLingeredApp Hello jdk.test.lib.apps.LingeredApp * @build jdk.test.whitebox.WhiteBox * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar loadclass.jar JCmdTestLingeredApp - * jdk.test.lib.apps.LingeredApp jdk.test.lib.apps.LingeredApp$1 + * jdk.test.lib.apps.LingeredApp jdk.test.lib.apps.LingeredApp$1 jdk.test.lib.apps.LingeredApp$SteadyStateLock * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar WhiteBox.jar jdk.test.whitebox.WhiteBox * @run main/othervm/timeout=500 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:./WhiteBox.jar DynamicSharedSymbols */ diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jcmd/JCmdTestDumpBase.java b/test/hotspot/jtreg/runtime/cds/appcds/jcmd/JCmdTestDumpBase.java index a18de9ea61e..ad7b8e97b81 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jcmd/JCmdTestDumpBase.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jcmd/JCmdTestDumpBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -64,7 +64,8 @@ public static void runTest(JCmdTest t) throws Exception { private static final String TEST_CLASSES[] = {"JCmdTestLingeredApp", "jdk/test/lib/apps/LingeredApp", - "jdk/test/lib/apps/LingeredApp$1"}; + "jdk/test/lib/apps/LingeredApp$1", + "jdk/test/lib/apps/LingeredApp$SteadyStateLock"}; private static final String BOOT_CLASSES[] = {"Hello"}; protected static String testJar = null; diff --git a/test/hotspot/jtreg/serviceability/attach/AttachSetGetFlag.java b/test/hotspot/jtreg/serviceability/attach/AttachSetGetFlag.java index 939cc872a11..d6b21a5a327 100644 --- a/test/hotspot/jtreg/serviceability/attach/AttachSetGetFlag.java +++ b/test/hotspot/jtreg/serviceability/attach/AttachSetGetFlag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -59,8 +59,7 @@ public static void main(String... args) throws Exception { // Test a non-manageable size_t flag. // Since it is not manageable, we can't test the setFlag functionality. - testGetFlag("ArrayAllocatorMallocLimit", "128"); - // testSetFlag("ArrayAllocatorMallocLimit", "64", "128"); + testGetFlag("MetaspaceSize", "65536"); // Test a uint flag. testGetFlag("ParallelGCThreads", "10"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineLeakThrowable.java b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineLeakThrowable.java index 47e1cd736eb..7e755c9100c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineLeakThrowable.java +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineLeakThrowable.java @@ -32,7 +32,7 @@ * @modules java.instrument * java.compiler * @run main RedefineClassHelper - * @run main/othervm/timeout=6000 -javaagent:redefineagent.jar -XX:MetaspaceSize=12m -XX:MaxMetaspaceSize=12m RedefineLeakThrowable + * @run main/othervm/timeout=6000 -javaagent:redefineagent.jar -XX:MetaspaceSize=17m -XX:MaxMetaspaceSize=17m RedefineLeakThrowable */ class Tester { @@ -60,7 +60,7 @@ public class RedefineLeakThrowable { public static void main(String argv[]) throws Exception { - for (int i = 0; i < 500; i++) { + for (int i = 0; i < 700; i++) { RedefineClassHelper.redefineClass(Tester.class, NEW_TESTER); } } diff --git a/test/hotspot/jtreg/serviceability/sa/TestObjectMonitorIterate.java b/test/hotspot/jtreg/serviceability/sa/TestObjectMonitorIterate.java index e2d79b1ce9d..666fa169363 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestObjectMonitorIterate.java +++ b/test/hotspot/jtreg/serviceability/sa/TestObjectMonitorIterate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -82,6 +82,7 @@ private static void createAnotherToAttach(long lingeredAppPid) throws Exception Long.toString(lingeredAppPid)); SATestUtils.addPrivilegesIfNeeded(processBuilder); OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder); + SAOutput.shouldContain("SteadyStateLock"); SAOutput.shouldHaveExitValue(0); System.out.println(SAOutput.getOutput()); } diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 4d0ae5ed38b..77f57875327 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -413,6 +413,7 @@ java/awt/Modal/ToBack/ToBackNonModal3Test.java 8196441 macosx-all,linux-all java/awt/Modal/ToBack/ToBackNonModal4Test.java 8196441 macosx-all,linux-all java/awt/Modal/ToBack/ToBackNonModal5Test.java 8196441 macosx-all javax/print/PrintSEUmlauts/PrintSEUmlauts.java 8135174 generic-all +java/awt/font/Rotate/RotatedTextTest.java 8219641 linux-all java/awt/font/TextLayout/LigatureCaretTest.java 8266312 generic-all java/awt/image/VolatileImage/CustomCompositeTest.java 8199002 windows-all,linux-all java/awt/image/VolatileImage/GradientPaints.java 8199003 linux-all diff --git a/test/jdk/java/lang/ProcessBuilder/CloseRace.java b/test/jdk/java/lang/ProcessBuilder/CloseRace.java index 05024dd17e4..e7eab128d60 100644 --- a/test/jdk/java/lang/ProcessBuilder/CloseRace.java +++ b/test/jdk/java/lang/ProcessBuilder/CloseRace.java @@ -23,11 +23,13 @@ /** * @test - * @bug 8024521 + * @bug 8024521 8315721 * @summary Closing ProcessPipeInputStream at the time the process exits is racy * and leads to data corruption. Run this test manually (as * an ordinary java program) with -Xmx8M to repro bug 8024521. * @requires !vm.opt.final.ZGenerational + * @comment Don't allow -Xcomp, it disturbs the timing + * @requires (vm.compMode != "Xcomp") * @run main/othervm -Xmx8M -Dtest.duration=2 CloseRace */ @@ -35,6 +37,8 @@ * @test * @comment Turn up heap size to lower amount of GCs * @requires vm.gc.Z & vm.opt.final.ZGenerational + * @comment Don't allow -Xcomp, it disturbs the timing + * @requires (vm.compMode != "Xcomp") * @run main/othervm -XX:+UseZGC -XX:+ZGenerational -Xmx32M -Dtest.duration=2 CloseRace */ diff --git a/test/jdk/java/lang/Thread/virtual/stress/ParkALot.java b/test/jdk/java/lang/Thread/virtual/stress/ParkALot.java index a5eb98d207d..ccba3fe1b4d 100644 --- a/test/jdk/java/lang/Thread/virtual/stress/ParkALot.java +++ b/test/jdk/java/lang/Thread/virtual/stress/ParkALot.java @@ -31,7 +31,7 @@ /* * @test * @requires vm.debug == true - * @run main/othervm ParkALot 200000 + * @run main/othervm ParkALot 100000 */ import java.time.Instant; @@ -50,15 +50,16 @@ public static void main(String[] args) { iterations = ITERATIONS; } - int maxThreads = Math.max(Runtime.getRuntime().availableProcessors() / 2, 1); + int maxThreads = Math.clamp(Runtime.getRuntime().availableProcessors() / 2, 1, 4); for (int nthreads = 1; nthreads <= maxThreads; nthreads++) { - System.out.format("%s %d threads ...%n", Instant.now(), nthreads); + System.out.format("%s %d thread(s) ...%n", Instant.now(), nthreads); ThreadFactory factory = Thread.ofPlatform().factory(); try (var executor = Executors.newThreadPerTaskExecutor(factory)) { for (int i = 0; i < nthreads; i++) { executor.submit(() -> parkALot(iterations)); } } + System.out.format("%s %d thread(s) done%n", Instant.now(), nthreads); } } @@ -87,7 +88,7 @@ private static void parkALot(int iterations) { if (state == Thread.State.WAITING || state == Thread.State.TIMED_WAITING) { LockSupport.unpark(vthread); } else { - Thread.onSpinWait(); + Thread.yield(); } } } diff --git a/test/jdk/javax/swing/AbstractDocument/bug4549069.java b/test/jdk/javax/swing/AbstractDocument/bug4549069.java new file mode 100644 index 00000000000..472830399ee --- /dev/null +++ b/test/jdk/javax/swing/AbstractDocument/bug4549069.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2001, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4549069 + * @summary Tests if javax.swing.text.AbstractDocument.BranchElement.getEndOffset() throws AIOOBE + * @key headful + */ + +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Timer; +import java.util.TimerTask; +import javax.swing.JFrame; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; +import javax.swing.text.DefaultStyledDocument; +import javax.swing.undo.UndoManager; + +public class bug4549069 { + static Timer timer; + static volatile Point p; + + static JFrame f; + static JTextArea jta; + static UndoManager um; + static Robot robot; + + public static void main(String[] argv) throws Exception { + robot = new Robot(); + try { + SwingUtilities.invokeAndWait(() -> { + f = new JFrame("bug4549069"); + f.addWindowListener(new TestStateListener()); + + jta = new JTextArea(); + um = new UndoManager(); + jta.setDocument(new DefaultStyledDocument()); + jta.getDocument().addUndoableEditListener(um); + + String text = "Press Ctrl-Z (undo) to get\n" + + "a stacktrace U shouldn't XX\n"; + jta.setText(text); + + jta.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + if (um.canUndo()) { + um.undo(); + } + } + }); + + f.getContentPane().add(jta); + f.pack(); + f.setVisible(true); + }); + + robot.waitForIdle(); + robot.delay(1000); + } finally { + if (f != null) { + SwingUtilities.invokeAndWait(() -> { + f.dispose(); + }); + } + } + } + + static class TestStateListener extends WindowAdapter { + public void windowOpened(WindowEvent ev) { + timer = new Timer(); + timer.schedule(new RobotTask(), 1000); + } + } + + static class RobotTask extends TimerTask { + public void run() { + try { + SwingUtilities.invokeAndWait(() -> { + p = jta.getLocationOnScreen(); + }); + } catch (Exception e) { + throw new RuntimeException("Could not get location"); + + } + robot.mouseMove(p.x, p.y); + robot.waitForIdle(); + + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + + robot.keyPress(KeyEvent.VK_SPACE); + robot.keyRelease(KeyEvent.VK_SPACE); + robot.waitForIdle(); + } + } +} diff --git a/test/jdk/javax/swing/AbstractWriter/bug4185537.java b/test/jdk/javax/swing/AbstractWriter/bug4185537.java new file mode 100644 index 00000000000..3425f12a83a --- /dev/null +++ b/test/jdk/javax/swing/AbstractWriter/bug4185537.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 1998, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4185537 + * @summary javax.swing.text.AbstractWriter: TOTAL REWRITE COMPLETE. + */ + +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; +import javax.swing.text.AbstractWriter; +import javax.swing.text.BadLocationException; +import javax.swing.text.DefaultStyledDocument; +import javax.swing.text.Document; + +public class bug4185537 { + static char[] chars = {'a', 'b', 'c', 'd', 'e'}; + static StringWriter wr = new StringWriter(); + + public static void main(String[] argv) { + DefaultStyledDocument doc = new DefaultStyledDocument(); + + SimpleWriter sw = new SimpleWriter(wr, doc, 5, 200); + sw.test_getWriter(); + + if (sw.getStartOffset() != 5) { + throw new RuntimeException("getStartOffset fails..."); + } + if (sw.getEndOffset() != 205) { + throw new RuntimeException("getEndOffset fails..."); + } + + sw.setLineSeparator("+"); + if (!sw.getLineSeparator().equals("+")) { + throw new RuntimeException("Doesn't set line separator correctly..."); + } + sw.test_writeLineSeparator(); + + sw.test_write_output(); + sw.test_CurrentLineLength(); + sw.test_getLineLength(); + sw.test_getIndentLevel(); + sw.test_CanWrapLines(); + if (!wr.toString().equals("+abcde")) { + throw new RuntimeException("Test fails..."); + } + try { + wr.close(); + } catch (Exception e) { + System.out.println("Exception..."); + } + } + + static class SimpleWriter extends AbstractWriter { + + public SimpleWriter(Writer w, Document d, int pos, int len) { + super(w, d, pos, len); + } + + void test_writeLineSeparator() { + try { + writeLineSeparator(); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("writeLineSeparator fails..."); + } + } + + void test_getWriter() { + if (getWriter() != wr) throw new RuntimeException("Writer gets incorrect..."); + } + + void test_CurrentLineLength() { + setCurrentLineLength(0); + if (getCurrentLineLength() != 0) throw new RuntimeException("Doesn't set CurrentLineLength..."); + if (!isLineEmpty()) { + throw new RuntimeException("isLineEmpty() should return false..."); + } + } + + void test_getLineLength() { + setLineLength(80); + if (getLineLength() != 80) { + throw new RuntimeException("Default line length doesn't set..."); + } + } + + void test_CanWrapLines() { + setCanWrapLines(true); + if (!getCanWrapLines()) { + throw new RuntimeException("Doesn't set wrapping lines correctly"); + } + } + + void test_getIndentLevel() { + incrIndent(); + if (getIndentLevel() != 1) { + throw new RuntimeException("getIndentLevel() fails..."); + } + } + + void test_write_output() { + try { + write(chars, 0, 3); + } catch (IOException e) { + throw new RuntimeException("write(char[], int, int): unexpected IOException..."); + } + try { + output(chars, 3, 2); + } catch (IOException e) { + throw new RuntimeException("output(char[], int, int): unexpected IOException..."); + } + } + + public void write() throws IOException, BadLocationException { + } + } +} diff --git a/test/jdk/javax/swing/DefaultTableCellRenderer/bug4240870.java b/test/jdk/javax/swing/DefaultTableCellRenderer/bug4240870.java new file mode 100644 index 00000000000..7b032e65940 --- /dev/null +++ b/test/jdk/javax/swing/DefaultTableCellRenderer/bug4240870.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 1999, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4240870 4240855 + * @summary Tests that DefaultTableCellRenderer overrides following methods: + * validate() + * revalidate() + * repaint(long, int, int, int, int) + * repaint(Rectangle) + * firePropertyChange(String, Object, Object) + * firePropertyChange(String, boolean, boolean) + */ + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import javax.swing.table.DefaultTableCellRenderer; + +public class bug4240870 { + public static void main(String[] argv) { + // Test overridden public methods using reflection + String methodName = null; + try { + Class clazz = Class.forName( + "javax.swing.table.DefaultTableCellRenderer"); + Class[] noArgs = {}; + methodName = "validate"; + clazz.getDeclaredMethod(methodName, noArgs); + methodName = "revalidate"; + clazz.getDeclaredMethod(methodName, noArgs); + + Class[] args1 = {long.class, int.class, int.class, + int.class, int.class}; + methodName = "repaint"; + clazz.getDeclaredMethod(methodName, args1); + Class[] args2 = {Class.forName("java.awt.Rectangle")}; + methodName = "repaint"; + clazz.getDeclaredMethod(methodName, args2); + + Class objectClass = Class.forName("java.lang.Object"); + Class stringClass = Class.forName("java.lang.String"); + Class[] args3 = {stringClass, objectClass, objectClass}; + methodName = "firePropertyChange"; + clazz.getDeclaredMethod(methodName, args3); + Class[] args4 = {stringClass, boolean.class, boolean.class}; + clazz.getDeclaredMethod(methodName, args4); + } catch (NoSuchMethodException e) { + throw new RuntimeException("Failed: " + methodName + " not overridden"); + } catch (ClassNotFoundException e) { + } + + // test protected firePropertyChange(String, Object, Object) + Renderer r = new Renderer(); + r.addPropertyChangeListener(new Listener()); + r.test(); + } + + static class Renderer extends DefaultTableCellRenderer { + public void test() { + super.firePropertyChange("text", "old_text", "new_text"); + super.firePropertyChange("stuff", "old_stuff", "new_stuff"); + } + } + + static class Listener implements PropertyChangeListener { + public void propertyChange(PropertyChangeEvent e) { + if (!e.getPropertyName().equals("text")) { + throw new RuntimeException("Failed: firePropertyChange not overridden"); + } + } + } +} diff --git a/test/jdk/javax/swing/JTableHeader/bug4243927.java b/test/jdk/javax/swing/JTableHeader/bug4243927.java new file mode 100644 index 00000000000..a46b1fa86a5 --- /dev/null +++ b/test/jdk/javax/swing/JTableHeader/bug4243927.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 1999, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4243927 + * @summary Tests that methods getAccessibleChild() and getAccessibleAt() + * of class JTableHeader.AccessibleJTableHeader do not throw NPE + */ + +import javax.accessibility.AccessibleComponent; +import javax.accessibility.AccessibleContext; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableColumn; + +public class bug4243927 { + public static void main(String[] argv) { + JTableHeader header = new JTableHeader(); + header.getColumnModel().addColumn(new TableColumn(0)); + + AccessibleContext c = header.getAccessibleContext(); + c.getAccessibleChild(0); + ((AccessibleComponent)c).getAccessibleAt(new java.awt.Point(0,0)); + } +} diff --git a/test/jdk/javax/swing/LookAndFeel/bug4736093.java b/test/jdk/javax/swing/LookAndFeel/bug4736093.java new file mode 100644 index 00000000000..522eb98ab3e --- /dev/null +++ b/test/jdk/javax/swing/LookAndFeel/bug4736093.java @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2002, 2023, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4736093 + * @requires (os.family == "windows") + * @summary REGRESSION: Menu and controls shortcuts are not visible in Win L&F in jdk1.4.1 + * @modules java.desktop/com.sun.java.swing.plaf.windows + * @key headful + */ + +import java.awt.Robot; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.MenuElement; +import javax.swing.MenuSelectionManager; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; + +public class bug4736093 { + static volatile boolean passed = true; + static volatile boolean done = false; + static volatile boolean winlaf = true; + static JFrame mainFrame = null; + static Robot robo; + + public static void main(String args[]) throws Exception { + try { + robo = new Robot(); + + SwingUtilities.invokeAndWait(() -> { + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + } catch (Exception ex) { + winlaf = false; + } + + if (winlaf && WindowsLookAndFeel.isMnemonicHidden()) { + mainFrame = new JFrame("Bug 4736093"); + mainFrame.addWindowListener(new TestStateListener()); + mainFrame.setSize(200, 400); + mainFrame.setLocationRelativeTo(null); + mainFrame.setVisible(true); + } else { + System.out.println("Test is not for this system. Passed."); + } + }); + + robo.waitForIdle(); + robo.delay(1000); + + if (!passed) { + throw new RuntimeException("Test failed."); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (mainFrame != null) { + mainFrame.dispose(); + } + }); + } + } + + public static void addMenuBar() { + JMenuBar mbar = new JMenuBar(); + JMenu menu = new JMenu("File"); + for (int i = 1; i < 5; i++) { + menu.add(new JMenuItem("Menu Item " + i)); + } + mbar.add(menu); + mainFrame.setJMenuBar(mbar); + } + + + public static void checkForMnemonics(boolean expected) { + if (expected != WindowsLookAndFeel.isMnemonicHidden()) { + passed = false; + } + } + + public static class TestStateListener extends WindowAdapter { + public void windowOpened(WindowEvent ev) { + try { + new Thread(new RobotThread()).start(); + } catch (Exception ex) { + throw new RuntimeException("Thread Exception"); + } + } + } + + public static class RobotThread implements Runnable { + public void run() { + MenuElement[] path; + int altKey = java.awt.event.KeyEvent.VK_ALT; + robo.setAutoDelay(3000); // 3 seconds delay + robo.waitForIdle(); + + robo.keyPress(altKey); + robo.delay(1000); + + checkForMnemonics(false); // mnemonics should appear on press + robo.keyRelease(altKey); + robo.delay(1000); + + checkForMnemonics(true); // and disappear on release + robo.keyPress(java.awt.event.KeyEvent.VK_ESCAPE); + robo.keyRelease(java.awt.event.KeyEvent.VK_ESCAPE); + robo.delay(1000); + + addMenuBar(); + robo.delay(1000); + + robo.keyPress(altKey); + robo.delay(1000); + + checkForMnemonics(false); // mnemonics should appear on press + robo.keyRelease(altKey); + robo.delay(1000); + + checkForMnemonics(false); // and stay appeared in selected menu + path = MenuSelectionManager.defaultManager().getSelectedPath(); + if (path.length == 0) { + passed = false; // menu should be selected + } + robo.delay(1000); + + robo.keyPress(altKey); + robo.delay(1000); + + checkForMnemonics(true); // and only now disappear + path = MenuSelectionManager.defaultManager().getSelectedPath(); + if (path.length != 0) { + passed = false; // menu should be deselected + } + robo.keyRelease(altKey); + done = true; + robo.delay(1000); + } + } +} diff --git a/test/lib-test/jdk/test/whitebox/vm_flags/SizeTTest.java b/test/lib-test/jdk/test/whitebox/vm_flags/SizeTTest.java index ae57d6701fd..4dc7a75065f 100644 --- a/test/lib-test/jdk/test/whitebox/vm_flags/SizeTTest.java +++ b/test/lib-test/jdk/test/whitebox/vm_flags/SizeTTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -35,7 +35,7 @@ import jdk.test.lib.Platform; public class SizeTTest { - private static final String FLAG_NAME = "ArrayAllocatorMallocLimit"; + private static final String FLAG_NAME = "LargePageSizeInBytes"; private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE, (1L << 32L) - 1L, 1L << 32L}; private static final Long[] EXPECTED_64 = TESTS; diff --git a/test/lib/jdk/test/lib/apps/LingeredApp.java b/test/lib/jdk/test/lib/apps/LingeredApp.java index 11c2181ebf9..b519083999e 100644 --- a/test/lib/jdk/test/lib/apps/LingeredApp.java +++ b/test/lib/jdk/test/lib/apps/LingeredApp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -587,6 +587,7 @@ public void run() { } } + static class SteadyStateLock {}; /** * This part is the application itself. First arg is optional "forceCrash". @@ -616,7 +617,7 @@ public static void main(String args[]) { Path path = Paths.get(theLockFileName); try { - Object steadyStateObj = new Object(); + Object steadyStateObj = new SteadyStateLock(); synchronized(steadyStateObj) { startSteadyStateThread(steadyStateObj); if (forceCrash) {