From ee7b2e9b3bd2b4607476ae03bb6c9f7e49a43d0e Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Mon, 22 Apr 2024 11:25:53 +0000 Subject: [PATCH 01/26] 8330051: Small ObjectMonitor spinning code cleanups Reviewed-by: dcubed, eosterlund, fbredberg --- src/hotspot/share/runtime/objectMonitor.cpp | 169 +++++++++++--------- src/hotspot/share/runtime/objectMonitor.hpp | 10 +- 2 files changed, 104 insertions(+), 75 deletions(-) diff --git a/src/hotspot/share/runtime/objectMonitor.cpp b/src/hotspot/share/runtime/objectMonitor.cpp index b1fe22444ae8f..d281acdf00699 100644 --- a/src/hotspot/share/runtime/objectMonitor.cpp +++ b/src/hotspot/share/runtime/objectMonitor.cpp @@ -108,19 +108,6 @@ #endif // ndef DTRACE_ENABLED -// Tunables ... -// The knob* variables are effectively final. Once set they should -// never be modified hence. Consider using __read_mostly with GCC. - -int ObjectMonitor::Knob_SpinLimit = 5000; // derived by an external tool - - -static int Knob_Bonus = 100; // spin success bonus -static int Knob_BonusB = 100; // spin success bonus -static int Knob_Penalty = 200; // spin failure penalty -static int Knob_Poverty = 1000; -static int Knob_FixedSpin = 0; -static int Knob_PreSpin = 10; // 20-100 likely better - DEBUG_ONLY(static volatile bool InitDone = false;) OopStorage* ObjectMonitor::_oop_storage = nullptr; @@ -406,7 +393,7 @@ bool ObjectMonitor::enter(JavaThread* current) { // transitions. The following spin is strictly optional ... // Note that if we acquire the monitor from an initial spin // we forgo posting JVMTI events and firing DTRACE probes. - if (TrySpin(current) > 0) { + if (TrySpin(current)) { assert(owner_raw() == current, "must be current: owner=" INTPTR_FORMAT, p2i(owner_raw())); assert(_recursions == 0, "must be 0: recursions=" INTX_FORMAT, _recursions); assert(object()->mark() == markWord::encode(this), @@ -535,18 +522,18 @@ bool ObjectMonitor::enter(JavaThread* current) { // Caveat: TryLock() is not necessarily serializing if it returns failure. // Callers must compensate as needed. -int ObjectMonitor::TryLock(JavaThread* current) { +ObjectMonitor::TryLockResult ObjectMonitor::TryLock(JavaThread* current) { void* own = owner_raw(); - if (own != nullptr) return 0; + if (own != nullptr) return TryLockResult::HasOwner; if (try_set_owner_from(nullptr, current) == nullptr) { assert(_recursions == 0, "invariant"); - return 1; + return TryLockResult::Success; } // The lock had been free momentarily, but we lost the race to the lock. // Interference -- the CAS failed. // We can either return -1 or retry. // Retry doesn't make as much sense because the lock was just acquired. - return -1; + return TryLockResult::Interference; } // Deflate the specified ObjectMonitor if not in-use. Returns true if it @@ -723,7 +710,7 @@ void ObjectMonitor::EnterI(JavaThread* current) { assert(current->thread_state() == _thread_blocked, "invariant"); // Try the lock - TATAS - if (TryLock (current) > 0) { + if (TryLock(current) == TryLockResult::Success) { assert(_succ != current, "invariant"); assert(owner_raw() == current, "invariant"); assert(_Responsible != current, "invariant"); @@ -757,7 +744,7 @@ void ObjectMonitor::EnterI(JavaThread* current) { // to the owner. This has subtle but beneficial affinity // effects. - if (TrySpin(current) > 0) { + if (TrySpin(current)) { assert(owner_raw() == current, "invariant"); assert(_succ != current, "invariant"); assert(_Responsible != current, "invariant"); @@ -794,7 +781,7 @@ void ObjectMonitor::EnterI(JavaThread* current) { // Interference - the CAS failed because _cxq changed. Just retry. // As an optional optimization we retry the lock. - if (TryLock (current) > 0) { + if (TryLock(current) == TryLockResult::Success) { assert(_succ != current, "invariant"); assert(owner_raw() == current, "invariant"); assert(_Responsible != current, "invariant"); @@ -847,7 +834,9 @@ void ObjectMonitor::EnterI(JavaThread* current) { for (;;) { - if (TryLock(current) > 0) break; + if (TryLock(current) == TryLockResult::Success) { + break; + } assert(owner_raw() != current, "invariant"); // park self @@ -862,7 +851,9 @@ void ObjectMonitor::EnterI(JavaThread* current) { current->_ParkEvent->park(); } - if (TryLock(current) > 0) break; + if (TryLock(current) == TryLockResult::Success) { + break; + } if (try_set_owner_from(DEFLATER_MARKER, current) == DEFLATER_MARKER) { // Cancelled the in-progress async deflation by changing owner from @@ -895,7 +886,9 @@ void ObjectMonitor::EnterI(JavaThread* current) { // We can defer clearing _succ until after the spin completes // TrySpin() must tolerate being called with _succ == current. // Try yet another round of adaptive spinning. - if (TrySpin(current) > 0) break; + if (TrySpin(current)) { + break; + } // We can find that we were unpark()ed and redesignated _succ while // we were spinning. That's harmless. If we iterate and call park(), @@ -994,8 +987,9 @@ void ObjectMonitor::ReenterI(JavaThread* current, ObjectWaiter* currentNode) { guarantee(v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant"); assert(owner_raw() != current, "invariant"); - if (TryLock(current) > 0) break; - if (TrySpin(current) > 0) break; + if (TrySpin(current)) { + break; + } { OSThreadContendState osts(current->osthread()); @@ -1012,7 +1006,9 @@ void ObjectMonitor::ReenterI(JavaThread* current, ObjectWaiter* currentNode) { // Try again, but just so we distinguish between futile wakeups and // successful wakeups. The following test isn't algorithmically // necessary, but it helps us maintain sensible statistics. - if (TryLock(current) > 0) break; + if (TryLock(current) == TryLockResult::Success) { + break; + } // The lock is still contested. // Keep a tally of the # of futile wakeups. @@ -1854,32 +1850,65 @@ void ObjectMonitor::notifyAll(TRAPS) { // hysteresis control to damp the transition rate between spinning and // not spinning. -// Spinning: Fixed frequency (100%), vary duration -int ObjectMonitor::TrySpin(JavaThread* current) { - // Dumb, brutal spin. Good for comparative measurements against adaptive spinning. - int ctr = Knob_FixedSpin; - if (ctr != 0) { - while (--ctr >= 0) { - if (TryLock(current) > 0) return 1; - SpinPause(); +int ObjectMonitor::Knob_SpinLimit = 5000; // derived by an external tool + +static int Knob_Bonus = 100; // spin success bonus +static int Knob_Penalty = 200; // spin failure penalty +static int Knob_Poverty = 1000; +static int Knob_FixedSpin = 0; +static int Knob_PreSpin = 10; // 20-100 likely better, but it's not better in my testing. + +inline static int adjust_up(int spin_duration) { + int x = spin_duration; + if (x < ObjectMonitor::Knob_SpinLimit) { + if (x < Knob_Poverty) { + x = Knob_Poverty; } - return 0; + return x + Knob_Bonus; + } else { + return spin_duration; } +} + +inline static int adjust_down(int spin_duration) { + // TODO: Use an AIMD-like policy to adjust _SpinDuration. + // AIMD is globally stable. + int x = spin_duration; + if (x > 0) { + // Consider an AIMD scheme like: x -= (x >> 3) + 100 + // This is globally sample and tends to damp the response. + x -= Knob_Penalty; + if (x < 0) { x = 0; } + return x; + } else { + return spin_duration; + } +} - for (ctr = Knob_PreSpin + 1; --ctr >= 0;) { - if (TryLock(current) > 0) { - // Increase _SpinDuration ... - // Note that we don't clamp SpinDuration precisely at SpinLimit. - // Raising _SpurDuration to the poverty line is key. - int x = _SpinDuration; - if (x < Knob_SpinLimit) { - if (x < Knob_Poverty) x = Knob_Poverty; - _SpinDuration = x + Knob_BonusB; +bool ObjectMonitor::short_fixed_spin(JavaThread* current, int spin_count, bool adapt) { + for (int ctr = 0; ctr < spin_count; ctr++) { + TryLockResult status = TryLock(current); + if (status == TryLockResult::Success) { + if (adapt) { + _SpinDuration = adjust_up(_SpinDuration); } - return 1; + return true; + } else if (status == TryLockResult::Interference) { + break; } SpinPause(); } + return false; +} + +// Spinning: Fixed frequency (100%), vary duration +bool ObjectMonitor::TrySpin(JavaThread* current) { + + // Dumb, brutal spin. Good for comparative measurements against adaptive spinning. + int knob_fixed_spin = Knob_FixedSpin; // 0 (don't spin: default), 2000 good test + if (knob_fixed_spin > 0) { + return short_fixed_spin(current, knob_fixed_spin, false); + } // Admission control - verify preconditions for spinning // @@ -1887,6 +1916,12 @@ int ObjectMonitor::TrySpin(JavaThread* current) { // becoming an absorbing state. Put another way, we spin briefly to // sample, just in case the system load, parallelism, contention, or lock // modality changed. + + int knob_pre_spin = Knob_PreSpin; // 10 (default), 100, 1000 or 2000 + if (short_fixed_spin(current, knob_pre_spin, true)) { + return true; + } + // // Consider the following alternative: // Periodically set _SpinDuration = _SpinLimit and try a long/full @@ -1895,8 +1930,8 @@ int ObjectMonitor::TrySpin(JavaThread* current) { // This takes us into the realm of 1-out-of-N spinning, where we // hold the duration constant but vary the frequency. - ctr = _SpinDuration; - if (ctr <= 0) return 0; + int ctr = _SpinDuration; + if (ctr <= 0) return false; // We're good to spin ... spin ingress. // CONSIDER: use Prefetch::write() to avoid RTS->RTO upgrades @@ -1928,7 +1963,7 @@ int ObjectMonitor::TrySpin(JavaThread* current) { // might update the poll values and we could be in a thread_blocked // state here which is not allowed so just check the poll. if (SafepointMechanism::local_poll_armed(current)) { - goto Abort; // abrupt spin egress + break; } SpinPause(); } @@ -1960,26 +1995,21 @@ int ObjectMonitor::TrySpin(JavaThread* current) { // If we acquired the lock early in the spin cycle it // makes sense to increase _SpinDuration proportionally. // Note that we don't clamp SpinDuration precisely at SpinLimit. - int x = _SpinDuration; - if (x < Knob_SpinLimit) { - if (x < Knob_Poverty) x = Knob_Poverty; - _SpinDuration = x + Knob_Bonus; - } - return 1; + _SpinDuration = adjust_up(_SpinDuration); + return true; } // The CAS failed ... we can take any of the following actions: // * penalize: ctr -= CASPenalty - // * exit spin with prejudice -- goto Abort; + // * exit spin with prejudice -- abort without adapting spinner // * exit spin without prejudice. // * Since CAS is high-latency, retry again immediately. - prv = ox; - goto Abort; + break; } // Did lock ownership change hands ? if (ox != prv && prv != nullptr) { - goto Abort; + break; } prv = ox; @@ -1989,20 +2019,10 @@ int ObjectMonitor::TrySpin(JavaThread* current) { } // Spin failed with prejudice -- reduce _SpinDuration. - // TODO: Use an AIMD-like policy to adjust _SpinDuration. - // AIMD is globally stable. - { - int x = _SpinDuration; - if (x > 0) { - // Consider an AIMD scheme like: x -= (x >> 3) + 100 - // This is globally sample and tends to damp the response. - x -= Knob_Penalty; - if (x < 0) x = 0; - _SpinDuration = x; - } + if (ctr < 0) { + _SpinDuration = adjust_down(_SpinDuration); } - Abort: if (_succ == current) { _succ = nullptr; // Invariant: after setting succ=null a contending thread @@ -2010,9 +2030,12 @@ int ObjectMonitor::TrySpin(JavaThread* current) { // in the normal usage of TrySpin(), but it's safest // to make TrySpin() as foolproof as possible. OrderAccess::fence(); - if (TryLock(current) > 0) return 1; + if (TryLock(current) == TryLockResult::Success) { + return true; + } } - return 0; + + return false; } diff --git a/src/hotspot/share/runtime/objectMonitor.hpp b/src/hotspot/share/runtime/objectMonitor.hpp index 6c0d5213605ad..fdc482a3555d6 100644 --- a/src/hotspot/share/runtime/objectMonitor.hpp +++ b/src/hotspot/share/runtime/objectMonitor.hpp @@ -353,8 +353,14 @@ class ObjectMonitor : public CHeapObj { void EnterI(JavaThread* current); void ReenterI(JavaThread* current, ObjectWaiter* current_node); void UnlinkAfterAcquire(JavaThread* current, ObjectWaiter* current_node); - int TryLock(JavaThread* current); - int TrySpin(JavaThread* current); + + + enum class TryLockResult { Interference = -1, HasOwner = 0, Success = 1 }; + + TryLockResult TryLock(JavaThread* current); + + bool TrySpin(JavaThread* current); + bool short_fixed_spin(JavaThread* current, int spin_count, bool adapt); void ExitEpilog(JavaThread* current, ObjectWaiter* Wakee); // Deflation support From 936a47d7d68c7305993f68db844dc76006b674b1 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Mon, 22 Apr 2024 11:40:22 +0000 Subject: [PATCH 02/26] 8330607: Deprecate -XX:+UseEmptySlotsInSupers Reviewed-by: shade, dcubed --- src/hotspot/share/runtime/arguments.cpp | 1 + src/hotspot/share/runtime/globals.hpp | 3 ++- .../hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 9ff8b87869236..2ea044a97df77 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -502,6 +502,7 @@ static SpecialFlag const special_jvm_flags[] = { { "UseSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() }, { "RegisterFinalizersAtInit", JDK_Version::jdk(22), JDK_Version::jdk(23), JDK_Version::jdk(24) }, { "PreserveAllAnnotations", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, + { "UseEmptySlotsInSupers", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, #if defined(X86) { "UseRTMLocking", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, { "UseRTMDeopt", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) }, diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 693e5660c24bf..9087cb9b4a33e 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -1958,7 +1958,8 @@ const int ObjectAlignmentInBytes = 8; "Use platform unstable time where supported for timestamps only") \ \ product(bool, UseEmptySlotsInSupers, true, \ - "Allow allocating fields in empty slots of super-classes") \ + "(Deprecated) Allow allocating fields in empty slots of " \ + "super-classes") \ \ product(bool, DeoptimizeNMethodBarriersALot, false, DIAGNOSTIC, \ "Make nmethod barriers deoptimise a lot.") \ diff --git a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java index 0f93ee0f43a10..7dc49a051865c 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java +++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java @@ -58,6 +58,7 @@ public class VMDeprecatedOptions { // deprecated non-alias flags: {"PreserveAllAnnotations", "true"}, {"AllowRedefinitionToAddDeleteMethods", "true"}, + {"UseEmptySlotsInSupers", "true"}, // deprecated alias flags (see also aliased_jvm_flags): {"CreateMinidumpOnCrash", "false"} From 3e65d90b4ddb52878ebdc2150790c0333b9c0920 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 22 Apr 2024 13:32:02 +0000 Subject: [PATCH 03/26] 8330820: Remove remnants of operator_new.cpp in build system Reviewed-by: tbell --- make/hotspot/lib/CompileGtest.gmk | 3 +-- make/hotspot/lib/CompileJvm.gmk | 8 -------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/make/hotspot/lib/CompileGtest.gmk b/make/hotspot/lib/CompileGtest.gmk index b59ed049cbcbd..696adb0c95f10 100644 --- a/make/hotspot/lib/CompileGtest.gmk +++ b/make/hotspot/lib/CompileGtest.gmk @@ -89,8 +89,7 @@ $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBJVM, \ EXCLUDES := $(JVM_EXCLUDES), \ EXCLUDE_FILES := gtestLauncher.cpp, \ EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \ - EXTRA_OBJECT_FILES := $(filter-out %/operator_new$(OBJ_SUFFIX), \ - $(BUILD_LIBJVM_ALL_OBJS)), \ + EXTRA_OBJECT_FILES := $(BUILD_LIBJVM_ALL_OBJS), \ DEFAULT_CFLAGS := false, \ CFLAGS := $(JVM_CFLAGS) \ -I$(GTEST_FRAMEWORK_SRC)/googletest/include \ diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk index 47f987092f902..c2ff006402529 100644 --- a/make/hotspot/lib/CompileJvm.gmk +++ b/make/hotspot/lib/CompileJvm.gmk @@ -137,13 +137,6 @@ JVM_STRIPFLAGS ?= $(STRIPFLAGS) # This source set is reused so save in cache. $(call FillFindCache, $(JVM_SRC_DIRS)) -# The global operator new functions defined in operator_new.cpp are intended -# to detect and prevent the VM code from calling them. See more details in -# operator_new.cpp. Exclude operator_new.o when statically linking the VM -# code with JDK natives, as the JDK natives might need to call the global -# operator new. -LIBJVM_STATIC_EXCLUDE_OBJS := operator_new.o - ifeq ($(call isTargetOs, windows), true) ifeq ($(STATIC_LIBS), true) WIN_EXPORT_FILE := $(JVM_OUTPUTDIR)/static-win-exports.def @@ -217,7 +210,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \ RC_FILEDESC := $(HOTSPOT_VM_DISTRO) $(OPENJDK_TARGET_CPU_BITS)-Bit $(JVM_VARIANT) VM, \ PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \ PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \ - STATIC_LIB_EXCLUDE_OBJS := $(LIBJVM_STATIC_EXCLUDE_OBJS), \ )) ifeq ($(call isTargetOs, windows), true) From 7e421ce9d089ce3e36336fca0f603bcbfbbda6c5 Mon Sep 17 00:00:00 2001 From: Roman Kennke Date: Mon, 22 Apr 2024 15:03:09 +0000 Subject: [PATCH 04/26] 8330585: Refactor/rename forwardee handling Reviewed-by: stefank, ayang --- src/hotspot/share/gc/g1/g1OopClosures.inline.hpp | 4 ++-- src/hotspot/share/gc/g1/g1ParScanThreadState.cpp | 4 ++-- .../share/gc/parallel/psPromotionManager.inline.hpp | 4 ++-- src/hotspot/share/gc/shared/preservedMarks.inline.hpp | 2 +- src/hotspot/share/oops/markWord.hpp | 11 +++++++++-- src/hotspot/share/oops/oop.inline.hpp | 7 ++----- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp b/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp index 9eebfbd6a8682..50b3ab203d706 100644 --- a/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp +++ b/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp @@ -227,8 +227,8 @@ void G1ParCopyClosure::do_oop_work(T* p) { if (state.is_in_cset()) { oop forwardee; markWord m = obj->mark(); - if (m.is_marked()) { - forwardee = cast_to_oop(m.decode_pointer()); + if (m.is_forwarded()) { + forwardee = m.forwardee(); } else { forwardee = _par_scan_state->copy_to_survivor_space(state, obj, m); } diff --git a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp index 81169f89a0799..c495889faade6 100644 --- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp +++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp @@ -211,8 +211,8 @@ void G1ParScanThreadState::do_oop_evac(T* p) { } markWord m = obj->mark(); - if (m.is_marked()) { - obj = cast_to_oop(m.decode_pointer()); + if (m.is_forwarded()) { + obj = m.forwardee(); } else { obj = do_copy_to_survivor_space(region_attr, obj, m); } diff --git a/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp b/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp index 730d31893d54c..eb27e9776ed9b 100644 --- a/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp +++ b/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp @@ -145,7 +145,7 @@ inline oop PSPromotionManager::copy_to_survivor_space(oop o) { // in o. There may be multiple threads racing on it, and it may be forwarded // at any time. markWord m = o->mark(); - if (!m.is_marked()) { + if (!m.is_forwarded()) { return copy_unmarked_to_survivor_space(o, m); } else { // Ensure any loads from the forwardee follow all changes that precede @@ -153,7 +153,7 @@ inline oop PSPromotionManager::copy_to_survivor_space(oop o) { // other thread. OrderAccess::acquire(); // Return the already installed forwardee. - return cast_to_oop(m.decode_pointer()); + return m.forwardee(); } } diff --git a/src/hotspot/share/gc/shared/preservedMarks.inline.hpp b/src/hotspot/share/gc/shared/preservedMarks.inline.hpp index aa181b408aefc..fc732fee53402 100644 --- a/src/hotspot/share/gc/shared/preservedMarks.inline.hpp +++ b/src/hotspot/share/gc/shared/preservedMarks.inline.hpp @@ -43,7 +43,7 @@ inline void PreservedMarks::push_if_necessary(oop obj, markWord m) { } inline void PreservedMarks::push_always(oop obj, markWord m) { - assert(!m.is_marked(), "precondition"); + assert(!m.is_forwarded(), "precondition"); PreservedMark elem(obj, m); _stack.push(elem); } diff --git a/src/hotspot/share/oops/markWord.hpp b/src/hotspot/share/oops/markWord.hpp index ba89f947dcfa0..12d6ee73acf94 100644 --- a/src/hotspot/share/oops/markWord.hpp +++ b/src/hotspot/share/oops/markWord.hpp @@ -143,6 +143,9 @@ class markWord { bool is_marked() const { return (mask_bits(value(), lock_mask_in_place) == marked_value); } + bool is_forwarded() const { + return (mask_bits(value(), lock_mask_in_place) == marked_value); + } bool is_neutral() const { // Not locked, or marked - a "clean" neutral state return (mask_bits(value(), lock_mask_in_place) == unlocked_value); } @@ -225,7 +228,7 @@ class markWord { } // used to encode pointers during GC - markWord clear_lock_bits() { return markWord(value() & ~lock_mask_in_place); } + markWord clear_lock_bits() const { return markWord(value() & ~lock_mask_in_place); } // age operations markWord set_marked() { return markWord((value() & ~lock_mask_in_place) | marked_value); } @@ -259,7 +262,11 @@ class markWord { inline static markWord encode_pointer_as_mark(void* p) { return from_pointer(p).set_marked(); } // Recover address of oop from encoded form used in mark - inline void* decode_pointer() { return (void*)clear_lock_bits().value(); } + inline void* decode_pointer() const { return (void*)clear_lock_bits().value(); } + + inline oop forwardee() const { + return cast_to_oop(decode_pointer()); + } }; // Support atomic operations. diff --git a/src/hotspot/share/oops/oop.inline.hpp b/src/hotspot/share/oops/oop.inline.hpp index bd00847869d65..b7dbc7b2224b7 100644 --- a/src/hotspot/share/oops/oop.inline.hpp +++ b/src/hotspot/share/oops/oop.inline.hpp @@ -262,9 +262,7 @@ bool oopDesc::is_gc_marked() const { // Used by scavengers bool oopDesc::is_forwarded() const { - // The extra heap check is needed since the obj might be locked, in which case the - // mark would point to a stack location and have the sentinel bit cleared - return mark().is_marked(); + return mark().is_forwarded(); } // Used by scavengers @@ -289,8 +287,7 @@ oop oopDesc::forward_to_atomic(oop p, markWord compare, atomic_memory_order orde // The forwardee is used when copying during scavenge and mark-sweep. // It does need to clear the low two locking- and GC-related bits. oop oopDesc::forwardee() const { - assert(is_forwarded(), "only decode when actually forwarded"); - return cast_to_oop(mark().decode_pointer()); + return mark().forwardee(); } // The following method needs to be MT safe. From 20be5e095f85d92215df68bb6eeb621b4ed249a1 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Mon, 22 Apr 2024 15:53:14 +0000 Subject: [PATCH 05/26] 8314846: Do not store Klass::_secondary_super_cache in CDS archive Reviewed-by: stuefe, aph --- src/hotspot/share/oops/klass.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/oops/klass.cpp b/src/hotspot/share/oops/klass.cpp index 5b1919a5c4ccd..23a6770251a3d 100644 --- a/src/hotspot/share/oops/klass.cpp +++ b/src/hotspot/share/oops/klass.cpp @@ -726,7 +726,6 @@ void Klass::metaspace_pointers_do(MetaspaceClosure* it) { } it->push(&_name); - it->push(&_secondary_super_cache); it->push(&_secondary_supers); for (int i = 0; i < _primary_super_limit; i++) { it->push(&_primary_supers[i]); @@ -757,6 +756,11 @@ void Klass::remove_unshareable_info() { log_trace(cds, unshareable)("remove: %s", external_name()); } + // _secondary_super_cache may be updated by an is_subtype_of() call + // while ArchiveBuilder is copying metaspace objects. Let's reset it to + // null and let it be repopulated at runtime. + set_secondary_super_cache(nullptr); + set_subklass(nullptr); set_next_sibling(nullptr); set_next_link(nullptr); From 0b9350e8b619bc556f36652cde6f73211be5b85b Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Mon, 22 Apr 2024 16:31:32 +0000 Subject: [PATCH 06/26] 8322992: Javac fails with StackOverflowError when compiling deeply nested synchronized blocks Reviewed-by: jlahoda --- .../classes/com/sun/tools/javac/jvm/Gen.java | 45 +- .../patterns/SOEDeeplyNestedBlocksTest.java | 1187 +++++++++++++++++ 2 files changed, 1214 insertions(+), 18 deletions(-) create mode 100644 test/langtools/tools/javac/patterns/SOEDeeplyNestedBlocksTest.java diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java index 8a546cd3f42ec..37846b8b966aa 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java @@ -1074,29 +1074,38 @@ public void visitSkip(JCSkip tree) { } public void visitBlock(JCBlock tree) { + /* this method is heavily invoked, as expected, for deeply nested blocks, if blocks doesn't happen to have + * patterns there will be an unnecessary tax on memory consumption every time this method is executed, for this + * reason we have created helper methods and here at a higher level we just discriminate depending on the + * presence, or not, of patterns in a given block + */ if (tree.patternMatchingCatch != null) { - Set prevInvocationsWithPatternMatchingCatch = invocationsWithPatternMatchingCatch; - ListBuffer prevRanges = patternMatchingInvocationRanges; - State startState = code.state.dup(); - try { - invocationsWithPatternMatchingCatch = tree.patternMatchingCatch.calls2Handle(); - patternMatchingInvocationRanges = new ListBuffer<>(); - doVisitBlock(tree); - } finally { - Chain skipCatch = code.branch(goto_); - JCCatch handler = tree.patternMatchingCatch.handler(); - code.entryPoint(startState, handler.param.sym.type); - genPatternMatchingCatch(handler, env, patternMatchingInvocationRanges.toList()); - code.resolve(skipCatch); - invocationsWithPatternMatchingCatch = prevInvocationsWithPatternMatchingCatch; - patternMatchingInvocationRanges = prevRanges; - } + visitBlockWithPatterns(tree); } else { - doVisitBlock(tree); + internalVisitBlock(tree); + } + } + + private void visitBlockWithPatterns(JCBlock tree) { + Set prevInvocationsWithPatternMatchingCatch = invocationsWithPatternMatchingCatch; + ListBuffer prevRanges = patternMatchingInvocationRanges; + State startState = code.state.dup(); + try { + invocationsWithPatternMatchingCatch = tree.patternMatchingCatch.calls2Handle(); + patternMatchingInvocationRanges = new ListBuffer<>(); + internalVisitBlock(tree); + } finally { + Chain skipCatch = code.branch(goto_); + JCCatch handler = tree.patternMatchingCatch.handler(); + code.entryPoint(startState, handler.param.sym.type); + genPatternMatchingCatch(handler, env, patternMatchingInvocationRanges.toList()); + code.resolve(skipCatch); + invocationsWithPatternMatchingCatch = prevInvocationsWithPatternMatchingCatch; + patternMatchingInvocationRanges = prevRanges; } } - private void doVisitBlock(JCBlock tree) { + private void internalVisitBlock(JCBlock tree) { int limit = code.nextreg; Env localEnv = env.dup(tree, new GenContext()); genStats(tree.stats, localEnv); diff --git a/test/langtools/tools/javac/patterns/SOEDeeplyNestedBlocksTest.java b/test/langtools/tools/javac/patterns/SOEDeeplyNestedBlocksTest.java new file mode 100644 index 0000000000000..e521f062748cf --- /dev/null +++ b/test/langtools/tools/javac/patterns/SOEDeeplyNestedBlocksTest.java @@ -0,0 +1,1187 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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 8322992 + * @summary Javac fails with StackOverflowError when compiling deeply nested synchronized blocks + * @compile SOEDeeplyNestedBlocksTest.java + */ + +public class SOEDeeplyNestedBlocksTest { + + public static void test() { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + synchronized (SOEDeeplyNestedBlocksTest.class) { + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} From 83c74d7307e258441abb171552e953f1c6d9b98a Mon Sep 17 00:00:00 2001 From: Nizar Benalla Date: Mon, 22 Apr 2024 20:36:43 +0000 Subject: [PATCH 07/26] 8329717: Missing `@since` tags in elements in DocumentationTool and Taglet Reviewed-by: prappo --- .../share/classes/javax/tools/DocumentationTool.java | 4 +++- src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Taglet.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/java.compiler/share/classes/javax/tools/DocumentationTool.java b/src/java.compiler/share/classes/javax/tools/DocumentationTool.java index 4fc5e8db50585..91850b1edf79f 100644 --- a/src/java.compiler/share/classes/javax/tools/DocumentationTool.java +++ b/src/java.compiler/share/classes/javax/tools/DocumentationTool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -188,6 +188,8 @@ enum Location implements JavaFileManager.Location { /** * Location to search for snippets. + * + * @since 18 */ SNIPPET_PATH; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Taglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Taglet.java index b8b9132f6cd4b..1ad67a89fefc4 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Taglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Taglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -96,6 +96,8 @@ public interface Taglet { * @return true if this taglet supports block tags * @implSpec This implementation returns the inverse * result to {@code isInlineTag}. + * + * @since 15 */ default boolean isBlockTag() { return !isInlineTag(); From 1d52234e199c7a38c059c0aa88aea2910f749d48 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Mon, 22 Apr 2024 21:52:22 +0000 Subject: [PATCH 08/26] 8330704: Clean up non-standard use of /** comments in some langtools tests Reviewed-by: iris --- test/langtools/jdk/javadoc/tool/EnablePreviewOption.java | 4 ++-- test/langtools/jdk/javadoc/tool/ReleaseOption.java | 4 ++-- test/langtools/jdk/javadoc/tool/T4696488.java | 4 ++-- test/langtools/jdk/javadoc/tool/T4994049/T4994049.java | 4 ++-- test/langtools/jdk/javadoc/tool/T6551367.java | 4 ++-- test/langtools/jdk/javadoc/tool/TestScriptInComment.java | 4 ++-- test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java | 4 ++-- test/langtools/jdk/javadoc/tool/modules/FilterOptions.java | 4 ++-- test/langtools/jdk/javadoc/tool/modules/PackageOptions.java | 4 ++-- test/langtools/jdk/javadoc/tool/modules/PatchModules.java | 4 ++-- test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java | 4 ++-- test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java | 4 ++-- test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java | 4 ++-- test/langtools/jdk/jshell/HighlightUITest.java | 4 ++-- test/langtools/jdk/jshell/HistoryUITest.java | 4 ++-- test/langtools/jdk/jshell/IndentUITest.java | 4 ++-- test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java | 4 ++-- .../langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java | 4 ++-- test/langtools/jdk/jshell/ToolShiftTabTest.java | 4 ++-- test/langtools/jdk/jshell/ToolTabCommandTest.java | 4 ++-- test/langtools/jdk/jshell/ToolTabSnippetTest.java | 4 ++-- test/langtools/jdk/jshell/UndefinedClassTest.java | 4 ++-- 22 files changed, 44 insertions(+), 44 deletions(-) diff --git a/test/langtools/jdk/javadoc/tool/EnablePreviewOption.java b/test/langtools/jdk/javadoc/tool/EnablePreviewOption.java index 971a2dd546fb8..5b01f50772313 100644 --- a/test/langtools/jdk/javadoc/tool/EnablePreviewOption.java +++ b/test/langtools/jdk/javadoc/tool/EnablePreviewOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8199196 * @summary Test --enable-preview option in javadoc diff --git a/test/langtools/jdk/javadoc/tool/ReleaseOption.java b/test/langtools/jdk/javadoc/tool/ReleaseOption.java index dfee8726f30bb..5a7955099ca02 100644 --- a/test/langtools/jdk/javadoc/tool/ReleaseOption.java +++ b/test/langtools/jdk/javadoc/tool/ReleaseOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ import static jdk.javadoc.internal.tool.Main.Result.*; -/** +/* * @test * @bug 8086737 * @summary Test --release option in javadoc diff --git a/test/langtools/jdk/javadoc/tool/T4696488.java b/test/langtools/jdk/javadoc/tool/T4696488.java index b48c7fac93d22..715f738f53b71 100644 --- a/test/langtools/jdk/javadoc/tool/T4696488.java +++ b/test/langtools/jdk/javadoc/tool/T4696488.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4696488 * @summary javadoc doesn't handle UNC paths for destination directory diff --git a/test/langtools/jdk/javadoc/tool/T4994049/T4994049.java b/test/langtools/jdk/javadoc/tool/T4994049/T4994049.java index 47fb2aa179edd..247db2732cc41 100644 --- a/test/langtools/jdk/javadoc/tool/T4994049/T4994049.java +++ b/test/langtools/jdk/javadoc/tool/T4994049/T4994049.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4994049 * @summary Unit test for SourcePosition.column with respect to tab expansion diff --git a/test/langtools/jdk/javadoc/tool/T6551367.java b/test/langtools/jdk/javadoc/tool/T6551367.java index 875c91a1cf152..815b0b121e4e0 100644 --- a/test/langtools/jdk/javadoc/tool/T6551367.java +++ b/test/langtools/jdk/javadoc/tool/T6551367.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 6551367 * @summary javadoc throws ClassCastException when an link tag tries to reference constructor. diff --git a/test/langtools/jdk/javadoc/tool/TestScriptInComment.java b/test/langtools/jdk/javadoc/tool/TestScriptInComment.java index 3eaa47a36d56f..638e4c180597c 100644 --- a/test/langtools/jdk/javadoc/tool/TestScriptInComment.java +++ b/test/langtools/jdk/javadoc/tool/TestScriptInComment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8138725 8226765 * @summary test --allow-script-in-comments diff --git a/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java b/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java index 006a6489f8d3b..229d729bf402c 100644 --- a/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java +++ b/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8176539 * @summary Test use case when all java files are listed diff --git a/test/langtools/jdk/javadoc/tool/modules/FilterOptions.java b/test/langtools/jdk/javadoc/tool/modules/FilterOptions.java index 8fd9b26cc12e5..e510ea83bc410 100644 --- a/test/langtools/jdk/javadoc/tool/modules/FilterOptions.java +++ b/test/langtools/jdk/javadoc/tool/modules/FilterOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8159305 8167383 * @summary Tests elements filtering options diff --git a/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java b/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java index b6e16dc592d46..2c6624ca19aa8 100644 --- a/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java +++ b/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8159305 * @summary Test modules with packages and subpackages filtering diff --git a/test/langtools/jdk/javadoc/tool/modules/PatchModules.java b/test/langtools/jdk/javadoc/tool/modules/PatchModules.java index 10101a33ec641..ec9e6b3b8940e 100644 --- a/test/langtools/jdk/javadoc/tool/modules/PatchModules.java +++ b/test/langtools/jdk/javadoc/tool/modules/PatchModules.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8175346 * @summary Test patch module options diff --git a/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java b/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java index 2e0d4778401ed..ce86d073e3305 100644 --- a/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java +++ b/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8175346 8175277 * @summary Test release option interactions diff --git a/test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java b/test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java index 889945b236d08..cba4792f16603 100644 --- a/test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java +++ b/test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8010310 * @summary Error processing sources with -private diff --git a/test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java b/test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java index 39a726e3261c7..598b1b63c022b 100644 --- a/test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java +++ b/test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 7091528 8029145 8037484 * @summary ensures javadoc parses unique source files and ignores all class files diff --git a/test/langtools/jdk/jshell/HighlightUITest.java b/test/langtools/jdk/jshell/HighlightUITest.java index ede22e8f01079..954cb33117abb 100644 --- a/test/langtools/jdk/jshell/HighlightUITest.java +++ b/test/langtools/jdk/jshell/HighlightUITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8274148 * @summary Check the UI behavior of snippet highligting diff --git a/test/langtools/jdk/jshell/HistoryUITest.java b/test/langtools/jdk/jshell/HistoryUITest.java index 42e242fe1e6e8..3083fe46688c5 100644 --- a/test/langtools/jdk/jshell/HistoryUITest.java +++ b/test/langtools/jdk/jshell/HistoryUITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8178077 8232856 * @summary Check the UI behavior of editing history. diff --git a/test/langtools/jdk/jshell/IndentUITest.java b/test/langtools/jdk/jshell/IndentUITest.java index 6858277a179fd..d7534b3e6b924 100644 --- a/test/langtools/jdk/jshell/IndentUITest.java +++ b/test/langtools/jdk/jshell/IndentUITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8241950 8247932 * @summary Check the UI behavior of indentation diff --git a/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java b/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java index 409965e2e682e..8ec8ded1741c9 100644 --- a/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java +++ b/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8182297 8242919 8267459 * @summary Verify that pasting multi-line snippets works properly. diff --git a/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java b/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java index 8a7b46fc1c77c..1850f6c363958 100644 --- a/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java +++ b/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8182489 * @summary test history with multiline snippets diff --git a/test/langtools/jdk/jshell/ToolShiftTabTest.java b/test/langtools/jdk/jshell/ToolShiftTabTest.java index 4c36d79c16a40..87f616678cb95 100644 --- a/test/langtools/jdk/jshell/ToolShiftTabTest.java +++ b/test/langtools/jdk/jshell/ToolShiftTabTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8166334 8188894 * @summary test shift-tab shortcuts "fixes" diff --git a/test/langtools/jdk/jshell/ToolTabCommandTest.java b/test/langtools/jdk/jshell/ToolTabCommandTest.java index 9a429bb725300..f2f3111c4faa9 100644 --- a/test/langtools/jdk/jshell/ToolTabCommandTest.java +++ b/test/langtools/jdk/jshell/ToolTabCommandTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8177076 8185840 8178109 8192863 * @modules diff --git a/test/langtools/jdk/jshell/ToolTabSnippetTest.java b/test/langtools/jdk/jshell/ToolTabSnippetTest.java index 86338938c2cdd..252d57f4a6f66 100644 --- a/test/langtools/jdk/jshell/ToolTabSnippetTest.java +++ b/test/langtools/jdk/jshell/ToolTabSnippetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8177076 8185426 8189595 8188072 8221759 8255273 * @modules diff --git a/test/langtools/jdk/jshell/UndefinedClassTest.java b/test/langtools/jdk/jshell/UndefinedClassTest.java index 5c509252bd6fb..eb0cf3699cff9 100644 --- a/test/langtools/jdk/jshell/UndefinedClassTest.java +++ b/test/langtools/jdk/jshell/UndefinedClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8292755 * @summary InternalError seen while throwing undefined exception From 58ad399d196bf2dd701df451004b7815b0820675 Mon Sep 17 00:00:00 2001 From: Scott Gibbons Date: Mon, 22 Apr 2024 22:54:19 +0000 Subject: [PATCH 09/26] 8330821: Rename UnsafeCopyMemory Reviewed-by: kvn, sviswanathan --- .../cpu/aarch64/stubGenerator_aarch64.cpp | 12 +-- src/hotspot/cpu/arm/stubGenerator_arm.cpp | 34 ++++----- src/hotspot/cpu/ppc/stubGenerator_ppc.cpp | 40 +++++----- src/hotspot/cpu/riscv/stubGenerator_riscv.cpp | 12 +-- src/hotspot/cpu/x86/stubGenerator_x86_32.cpp | 20 ++--- src/hotspot/cpu/x86/stubGenerator_x86_64.cpp | 4 +- .../x86/stubGenerator_x86_64_arraycopy.cpp | 76 +++++++++---------- src/hotspot/os/windows/os_windows.cpp | 4 +- src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp | 8 +- .../os_cpu/bsd_aarch64/os_bsd_aarch64.cpp | 8 +- src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp | 8 +- .../os_cpu/linux_aarch64/os_linux_aarch64.cpp | 8 +- src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp | 6 +- src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp | 8 +- .../os_cpu/linux_riscv/os_linux_riscv.cpp | 8 +- src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp | 8 +- src/hotspot/share/runtime/stubRoutines.cpp | 34 ++++----- src/hotspot/share/runtime/stubRoutines.hpp | 20 ++--- 18 files changed, 159 insertions(+), 159 deletions(-) diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp index 4dc674d28c510..29b95fdb2dd0c 100644 --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp @@ -1519,9 +1519,9 @@ class StubGenerator: public StubCodeGenerator { __ push(RegSet::of(d, count), sp); } { - // UnsafeCopyMemory page error: continue after ucm + // UnsafeMemoryAccess page error: continue after unsafe access bool add_entry = !is_oop && (!aligned || sizeof(jlong) == size); - UnsafeCopyMemoryMark ucmm(this, add_entry, true); + UnsafeMemoryAccessMark umam(this, add_entry, true); copy_memory(decorators, is_oop ? T_OBJECT : T_BYTE, aligned, s, d, count, size); } @@ -1590,9 +1590,9 @@ class StubGenerator: public StubCodeGenerator { __ push(RegSet::of(d, count), sp); } { - // UnsafeCopyMemory page error: continue after ucm + // UnsafeMemoryAccess page error: continue after unsafe access bool add_entry = !is_oop && (!aligned || sizeof(jlong) == size); - UnsafeCopyMemoryMark ucmm(this, add_entry, true); + UnsafeMemoryAccessMark umam(this, add_entry, true); copy_memory(decorators, is_oop ? T_OBJECT : T_BYTE, aligned, s, d, count, -size); } if (is_oop) { @@ -8378,8 +8378,8 @@ class StubGenerator: public StubCodeGenerator { SharedRuntime::throw_delayed_StackOverflowError)); // Initialize table for copy memory (arraycopy) check. - if (UnsafeCopyMemory::_table == nullptr) { - UnsafeCopyMemory::create_table(8 + 4); // 8 for copyMemory; 4 for setMemory + if (UnsafeMemoryAccess::_table == nullptr) { + UnsafeMemoryAccess::create_table(8 + 4); // 8 for copyMemory; 4 for setMemory } if (UseCRC32Intrinsics) { diff --git a/src/hotspot/cpu/arm/stubGenerator_arm.cpp b/src/hotspot/cpu/arm/stubGenerator_arm.cpp index 9d526c7ebdca9..0d66a2fbb0a51 100644 --- a/src/hotspot/cpu/arm/stubGenerator_arm.cpp +++ b/src/hotspot/cpu/arm/stubGenerator_arm.cpp @@ -956,8 +956,8 @@ class StubGenerator: public StubCodeGenerator { Label L_skip_pld; { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, unsafe_copy, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, unsafe_copy, true); // predecrease to exit when there is less than count_per_loop __ sub_32(count, count, count_per_loop); @@ -1105,8 +1105,8 @@ class StubGenerator: public StubCodeGenerator { __ push(RegisterSet(R4,R10)); { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, unsafe_copy, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, unsafe_copy, true); __ sub_32(count, count, count_per_loop); const bool prefetch_before = pld_offset < 0; @@ -1761,8 +1761,8 @@ class StubGenerator: public StubCodeGenerator { assert_different_registers(from, to, count, tmp); { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, unsafe_copy, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, unsafe_copy, true); __ align(OptoLoopAlignment); Label L_small_loop; __ BIND(L_small_loop); @@ -1900,8 +1900,8 @@ class StubGenerator: public StubCodeGenerator { __ push(RegisterSet(R4,R10)); { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, unsafe_copy, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, unsafe_copy, true); load_one(Rval, from, wordSize, forward); switch (bytes_per_count) { @@ -2058,8 +2058,8 @@ class StubGenerator: public StubCodeGenerator { int count_required_to_align = 0; { - // UnsafeCopyMemoryMark page error: continue at UnsafeCopyMemory common_error_exit - UnsafeCopyMemoryMark ucmm(this, !aligned, false); + // UnsafeMemoryAccessMark page error: continue at UnsafeMemoryAccess common_error_exit + UnsafeMemoryAccessMark umam(this, !aligned, false); count_required_to_align = from_is_aligned ? 0 : align_src(from, to, count, tmp1, bytes_per_count, forward); assert (small_copy_limit >= count_required_to_align, "alignment could exhaust count"); } @@ -2092,9 +2092,9 @@ class StubGenerator: public StubCodeGenerator { int min_copy; if (forward) { - min_copy = generate_forward_aligned_copy_loop(from, to, count, bytes_per_count, !aligned /*add UnsafeCopyMemory entry*/); + min_copy = generate_forward_aligned_copy_loop(from, to, count, bytes_per_count, !aligned /*add UnsafeMemoryAccess entry*/); } else { - min_copy = generate_backward_aligned_copy_loop(from, to, count, bytes_per_count, !aligned /*add UnsafeCopyMemory entry*/); + min_copy = generate_backward_aligned_copy_loop(from, to, count, bytes_per_count, !aligned /*add UnsafeMemoryAccess entry*/); } assert(small_copy_limit >= count_required_to_align + min_copy, "first loop might exhaust count"); @@ -2105,7 +2105,7 @@ class StubGenerator: public StubCodeGenerator { __ ret(); { - copy_small_array(from, to, count, tmp1, tmp2, bytes_per_count, forward, L_small_array /* entry */, !aligned /*add UnsafeCopyMemory entry*/); + copy_small_array(from, to, count, tmp1, tmp2, bytes_per_count, forward, L_small_array /* entry */, !aligned /*add UnsafeMemoryAccess entry*/); if (status) { __ mov(R0, 0); // OK @@ -2116,7 +2116,7 @@ class StubGenerator: public StubCodeGenerator { if (! to_is_aligned) { __ BIND(L_unaligned_dst); - int min_copy_shifted = align_dst_and_generate_shifted_copy_loop(from, to, count, bytes_per_count, forward, !aligned /*add UnsafeCopyMemory entry*/); + int min_copy_shifted = align_dst_and_generate_shifted_copy_loop(from, to, count, bytes_per_count, forward, !aligned /*add UnsafeMemoryAccess entry*/); assert (small_copy_limit >= count_required_to_align + min_copy_shifted, "first loop might exhaust count"); if (status) { @@ -2862,7 +2862,7 @@ class StubGenerator: public StubCodeGenerator { #endif address ucm_common_error_exit = generate_unsafecopy_common_error_exit(); - UnsafeCopyMemory::set_common_exit_stub_pc(ucm_common_error_exit); + UnsafeMemoryAccess::set_common_exit_stub_pc(ucm_common_error_exit); // these need always status in case they are called from generic_arraycopy StubRoutines::_jbyte_disjoint_arraycopy = generate_primitive_copy(false, "jbyte_disjoint_arraycopy", true, 1, true); @@ -3134,8 +3134,8 @@ class StubGenerator: public StubCodeGenerator { // stub for throwing stack overflow error used both by interpreter and compiler StubRoutines::_throw_StackOverflowError_entry = generate_throw_exception("StackOverflowError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError)); - if (UnsafeCopyMemory::_table == nullptr) { - UnsafeCopyMemory::create_table(32 + 4); // 32 for copyMemory; 4 for setMemory + if (UnsafeMemoryAccess::_table == nullptr) { + UnsafeMemoryAccess::create_table(32 + 4); // 32 for copyMemory; 4 for setMemory } // integer division used both by interpreter and compiler diff --git a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp index 4a9e5476dce5b..63502c00b2341 100644 --- a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp @@ -961,7 +961,7 @@ class StubGenerator: public StubCodeGenerator { // need to copy backwards } - // This is common errorexit stub for UnsafeCopyMemory. + // This is common errorexit stub for UnsafeMemoryAccess. address generate_unsafecopy_common_error_exit() { address start_pc = __ pc(); Register tmp1 = R6_ARG4; @@ -1013,8 +1013,8 @@ class StubGenerator: public StubCodeGenerator { Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8, l_9, l_10; { - // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit - UnsafeCopyMemoryMark ucmm(this, !aligned, false); + // UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit + UnsafeMemoryAccessMark umam(this, !aligned, false); // Don't try anything fancy if arrays don't have many elements. __ li(tmp3, 0); @@ -1195,8 +1195,8 @@ class StubGenerator: public StubCodeGenerator { // that we don't have to optimize it. Label l_1, l_2; { - // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit - UnsafeCopyMemoryMark ucmm(this, !aligned, false); + // UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit + UnsafeMemoryAccessMark umam(this, !aligned, false); __ b(l_2); __ bind(l_1); __ stbx(tmp1, R4_ARG2, R5_ARG3); @@ -1282,8 +1282,8 @@ class StubGenerator: public StubCodeGenerator { Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8, l_9; { - // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit - UnsafeCopyMemoryMark ucmm(this, !aligned, false); + // UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit + UnsafeMemoryAccessMark umam(this, !aligned, false); // don't try anything fancy if arrays don't have many elements __ li(tmp3, 0); __ cmpwi(CCR0, R5_ARG3, 9); @@ -1466,8 +1466,8 @@ class StubGenerator: public StubCodeGenerator { Label l_1, l_2; { - // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit - UnsafeCopyMemoryMark ucmm(this, !aligned, false); + // UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit + UnsafeMemoryAccessMark umam(this, !aligned, false); __ sldi(tmp1, R5_ARG3, 1); __ b(l_2); __ bind(l_1); @@ -1625,8 +1625,8 @@ class StubGenerator: public StubCodeGenerator { address start = __ function_entry(); assert_positive_int(R5_ARG3); { - // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit - UnsafeCopyMemoryMark ucmm(this, !aligned, false); + // UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit + UnsafeMemoryAccessMark umam(this, !aligned, false); generate_disjoint_int_copy_core(aligned); } __ li(R3_RET, 0); // return 0 @@ -1777,8 +1777,8 @@ class StubGenerator: public StubCodeGenerator { array_overlap_test(nooverlap_target, 2); { - // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit - UnsafeCopyMemoryMark ucmm(this, !aligned, false); + // UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit + UnsafeMemoryAccessMark umam(this, !aligned, false); generate_conjoint_int_copy_core(aligned); } @@ -1903,8 +1903,8 @@ class StubGenerator: public StubCodeGenerator { address start = __ function_entry(); assert_positive_int(R5_ARG3); { - // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit - UnsafeCopyMemoryMark ucmm(this, !aligned, false); + // UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit + UnsafeMemoryAccessMark umam(this, !aligned, false); generate_disjoint_long_copy_core(aligned); } __ li(R3_RET, 0); // return 0 @@ -2034,8 +2034,8 @@ class StubGenerator: public StubCodeGenerator { array_overlap_test(nooverlap_target, 3); { - // UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit - UnsafeCopyMemoryMark ucmm(this, !aligned, false); + // UnsafeMemoryAccess page error: continue at UnsafeMemoryAccess common_error_exit + UnsafeMemoryAccessMark umam(this, !aligned, false); generate_conjoint_long_copy_core(aligned); } __ li(R3_RET, 0); // return 0 @@ -3129,7 +3129,7 @@ class StubGenerator: public StubCodeGenerator { // the conjoint stubs use them. address ucm_common_error_exit = generate_unsafecopy_common_error_exit(); - UnsafeCopyMemory::set_common_exit_stub_pc(ucm_common_error_exit); + UnsafeMemoryAccess::set_common_exit_stub_pc(ucm_common_error_exit); // non-aligned disjoint versions StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, "jbyte_disjoint_arraycopy"); @@ -4745,8 +4745,8 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_call_stub_entry = generate_call_stub(StubRoutines::_call_stub_return_address); StubRoutines::_catch_exception_entry = generate_catch_exception(); - if (UnsafeCopyMemory::_table == nullptr) { - UnsafeCopyMemory::create_table(8 + 4); // 8 for copyMemory; 4 for setMemory + if (UnsafeMemoryAccess::_table == nullptr) { + UnsafeMemoryAccess::create_table(8 + 4); // 8 for copyMemory; 4 for setMemory } // Build this early so it's available for the interpreter. diff --git a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp index 8ac8263b30892..a4a92047eaefc 100644 --- a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp @@ -1136,9 +1136,9 @@ class StubGenerator: public StubCodeGenerator { } { - // UnsafeCopyMemory page error: continue after ucm + // UnsafeMemoryAccess page error: continue after unsafe access bool add_entry = !is_oop && (!aligned || sizeof(jlong) == size); - UnsafeCopyMemoryMark ucmm(this, add_entry, true); + UnsafeMemoryAccessMark umam(this, add_entry, true); copy_memory(decorators, is_oop ? T_OBJECT : T_BYTE, aligned, s, d, count, size); } @@ -1212,9 +1212,9 @@ class StubGenerator: public StubCodeGenerator { } { - // UnsafeCopyMemory page error: continue after ucm + // UnsafeMemoryAccess page error: continue after unsafe access bool add_entry = !is_oop && (!aligned || sizeof(jlong) == size); - UnsafeCopyMemoryMark ucmm(this, add_entry, true); + UnsafeMemoryAccessMark umam(this, add_entry, true); copy_memory(decorators, is_oop ? T_OBJECT : T_BYTE, aligned, s, d, count, -size); } @@ -5500,8 +5500,8 @@ static const int64_t right_3_bits = right_n_bits(3); StubRoutines::_forward_exception_entry = generate_forward_exception(); - if (UnsafeCopyMemory::_table == nullptr) { - UnsafeCopyMemory::create_table(8 + 4); // 8 for copyMemory; 4 for setMemory + if (UnsafeMemoryAccess::_table == nullptr) { + UnsafeMemoryAccess::create_table(8 + 4); // 8 for copyMemory; 4 for setMemory } StubRoutines::_call_stub_entry = diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp index 13b036a70aa03..d8067a39177f1 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp @@ -1131,8 +1131,8 @@ class StubGenerator: public StubCodeGenerator { bs->arraycopy_prologue(_masm, decorators, t, from, to, count); { bool add_entry = (t != T_OBJECT && (!aligned || t == T_INT)); - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, add_entry, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, add_entry, true); __ subptr(to, from); // to --> to_from __ cmpl(count, 2< to_from if (UseXMMForArrayCopy) { xmm_copy_forward(from, to_from, count); @@ -1505,8 +1505,8 @@ class StubGenerator: public StubCodeGenerator { __ jump_cc(Assembler::aboveEqual, nooverlap); { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, true, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, true, true); __ jmpb(L_copy_8_bytes); @@ -4121,8 +4121,8 @@ class StubGenerator: public StubCodeGenerator { create_control_words(); // Initialize table for copy memory (arraycopy) check. - if (UnsafeCopyMemory::_table == nullptr) { - UnsafeCopyMemory::create_table(16 + 4); // 16 for copyMemory; 4 for setMemory + if (UnsafeMemoryAccess::_table == nullptr) { + UnsafeMemoryAccess::create_table(16 + 4); // 16 for copyMemory; 4 for setMemory } StubRoutines::x86::_verify_mxcsr_entry = generate_verify_mxcsr(); diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp index 1a66ba6a55b17..63226a560f4df 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp @@ -4057,8 +4057,8 @@ void StubGenerator::generate_initial_stubs() { create_control_words(); // Initialize table for unsafe copy memeory check. - if (UnsafeCopyMemory::_table == nullptr) { - UnsafeCopyMemory::create_table(16 + 4); // 16 for copyMemory; 4 for setMemory + if (UnsafeMemoryAccess::_table == nullptr) { + UnsafeMemoryAccess::create_table(16 + 4); // 16 for copyMemory; 4 for setMemory } // entry points that exist in all platforms Note: This is code diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp index 27406792f60dc..d8f7a6b272bc9 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp @@ -560,8 +560,8 @@ address StubGenerator::generate_disjoint_copy_avx3_masked(address* entry, const int loop_size[] = { 192, 96, 48, 24}; int threshold[] = { 4096, 2048, 1024, 512}; - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true); // 'from', 'to' and 'count' are now valid // temp1 holds remaining count and temp4 holds running count used to compute @@ -730,7 +730,7 @@ address StubGenerator::generate_disjoint_copy_avx3_masked(address* entry, const if (MaxVectorSize == 64) { __ BIND(L_copy_large); - UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, false, ucme_exit_pc); + UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, false, ucme_exit_pc); arraycopy_avx3_large(to, from, temp1, temp2, temp3, temp4, count, xmm1, xmm2, xmm3, xmm4, shift); __ jmp(L_finish); } @@ -859,8 +859,8 @@ address StubGenerator::generate_conjoint_copy_avx3_masked(address* entry, const int loop_size[] = { 192, 96, 48, 24}; int threshold[] = { 4096, 2048, 1024, 512}; - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true); // 'from', 'to' and 'count' are now valid // temp1 holds remaining count. @@ -1318,8 +1318,8 @@ address StubGenerator::generate_disjoint_byte_copy(bool aligned, address* entry, // r9 and r10 may be used to save non-volatile registers { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !aligned, true); // 'from', 'to' and 'count' are now valid __ movptr(byte_count, count); __ shrptr(count, 3); // count => qword_count @@ -1374,7 +1374,7 @@ __ BIND(L_exit); __ ret(0); { - UnsafeCopyMemoryMark ucmm(this, !aligned, false, ucme_exit_pc); + UnsafeMemoryAccessMark umam(this, !aligned, false, ucme_exit_pc); // Copy in multi-bytes chunks copy_bytes_forward(end_from, end_to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, T_BYTE); __ jmp(L_copy_4_bytes); @@ -1432,8 +1432,8 @@ address StubGenerator::generate_conjoint_byte_copy(bool aligned, address nooverl // r9 and r10 may be used to save non-volatile registers { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !aligned, true); // 'from', 'to' and 'count' are now valid __ movptr(byte_count, count); __ shrptr(count, 3); // count => qword_count @@ -1477,8 +1477,8 @@ address StubGenerator::generate_conjoint_byte_copy(bool aligned, address nooverl __ ret(0); { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !aligned, true); // Copy in multi-bytes chunks copy_bytes_backward(from, to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, T_BYTE); } @@ -1549,8 +1549,8 @@ address StubGenerator::generate_disjoint_short_copy(bool aligned, address *entry // r9 and r10 may be used to save non-volatile registers { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !aligned, true); // 'from', 'to' and 'count' are now valid __ movptr(word_count, count); __ shrptr(count, 2); // count => qword_count @@ -1598,7 +1598,7 @@ __ BIND(L_exit); __ ret(0); { - UnsafeCopyMemoryMark ucmm(this, !aligned, false, ucme_exit_pc); + UnsafeMemoryAccessMark umam(this, !aligned, false, ucme_exit_pc); // Copy in multi-bytes chunks copy_bytes_forward(end_from, end_to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, T_SHORT); __ jmp(L_copy_4_bytes); @@ -1624,7 +1624,7 @@ address StubGenerator::generate_fill(BasicType t, bool aligned, const char *name { // Add set memory mark to protect against unsafe accesses faulting - UnsafeCopyMemoryMark usmm(this, ((t == T_BYTE) && !aligned), true); + UnsafeMemoryAccessMark umam(this, ((t == T_BYTE) && !aligned), true); __ generate_fill(t, aligned, to, value, r11, rax, xmm0); } @@ -1685,8 +1685,8 @@ address StubGenerator::generate_conjoint_short_copy(bool aligned, address noover // r9 and r10 may be used to save non-volatile registers { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !aligned, true); // 'from', 'to' and 'count' are now valid __ movptr(word_count, count); __ shrptr(count, 2); // count => qword_count @@ -1722,8 +1722,8 @@ address StubGenerator::generate_conjoint_short_copy(bool aligned, address noover __ ret(0); { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !aligned, true); // Copy in multi-bytes chunks copy_bytes_backward(from, to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, T_SHORT); } @@ -1806,8 +1806,8 @@ address StubGenerator::generate_disjoint_int_oop_copy(bool aligned, bool is_oop, bs->arraycopy_prologue(_masm, decorators, type, from, to, count); { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true); // 'from', 'to' and 'count' are now valid __ movptr(dword_count, count); __ shrptr(count, 1); // count => qword_count @@ -1843,7 +1843,7 @@ __ BIND(L_exit); __ ret(0); { - UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, false, ucme_exit_pc); + UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, false, ucme_exit_pc); // Copy in multi-bytes chunks copy_bytes_forward(end_from, end_to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, is_oop ? T_OBJECT : T_INT); __ jmp(L_copy_4_bytes); @@ -1916,8 +1916,8 @@ address StubGenerator::generate_conjoint_int_oop_copy(bool aligned, bool is_oop, assert_clean_int(count, rax); // Make sure 'count' is clean int. { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true); // 'from', 'to' and 'count' are now valid __ movptr(dword_count, count); __ shrptr(count, 1); // count => qword_count @@ -1949,8 +1949,8 @@ address StubGenerator::generate_conjoint_int_oop_copy(bool aligned, bool is_oop, __ ret(0); { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true); // Copy in multi-bytes chunks copy_bytes_backward(from, to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, is_oop ? T_OBJECT : T_INT); } @@ -2031,8 +2031,8 @@ address StubGenerator::generate_disjoint_long_oop_copy(bool aligned, bool is_oop BasicType type = is_oop ? T_OBJECT : T_LONG; bs->arraycopy_prologue(_masm, decorators, type, from, to, qword_count); { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true); // Copy from low to high addresses. Use 'to' as scratch. __ lea(end_from, Address(from, qword_count, Address::times_8, -8)); @@ -2063,8 +2063,8 @@ address StubGenerator::generate_disjoint_long_oop_copy(bool aligned, bool is_oop } { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true); // Copy in multi-bytes chunks copy_bytes_forward(end_from, end_to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, is_oop ? T_OBJECT : T_LONG); } @@ -2140,8 +2140,8 @@ address StubGenerator::generate_conjoint_long_oop_copy(bool aligned, bool is_oop BasicType type = is_oop ? T_OBJECT : T_LONG; bs->arraycopy_prologue(_masm, decorators, type, from, to, qword_count); { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true); __ jmp(L_copy_bytes); @@ -2167,8 +2167,8 @@ address StubGenerator::generate_conjoint_long_oop_copy(bool aligned, bool is_oop __ ret(0); } { - // UnsafeCopyMemory page error: continue after ucm - UnsafeCopyMemoryMark ucmm(this, !is_oop && !aligned, true); + // UnsafeMemoryAccess page error: continue after unsafe access + UnsafeMemoryAccessMark umam(this, !is_oop && !aligned, true); // Copy in multi-bytes chunks copy_bytes_backward(from, to, qword_count, rax, r10, L_copy_bytes, L_copy_8_bytes, decorators, is_oop ? T_OBJECT : T_LONG); @@ -2628,7 +2628,7 @@ address StubGenerator::generate_unsafe_setmemory(const char *name, // Fill words { Label L_wordsTail, L_wordsLoop, L_wordsTailLoop; - UnsafeCopyMemoryMark usmm(this, true, true); + UnsafeMemoryAccessMark umam(this, true, true); // At this point, we know the lower bit of size is zero and a // multiple of 2 @@ -2642,7 +2642,7 @@ address StubGenerator::generate_unsafe_setmemory(const char *name, // Fill QUADWORDs { Label L_qwordLoop, L_qwordsTail, L_qwordsTailLoop; - UnsafeCopyMemoryMark usmm(this, true, true); + UnsafeMemoryAccessMark umam(this, true, true); // At this point, we know the lower 3 bits of size are zero and a // multiple of 8 @@ -2659,7 +2659,7 @@ address StubGenerator::generate_unsafe_setmemory(const char *name, // Fill DWORDs { Label L_dwordLoop, L_dwordsTail, L_dwordsTailLoop; - UnsafeCopyMemoryMark usmm(this, true, true); + UnsafeMemoryAccessMark umam(this, true, true); // At this point, we know the lower 2 bits of size are zero and a // multiple of 4 diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 37f40ebe59688..ccd7a8f10ce4c 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -2795,12 +2795,12 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr; } - bool is_unsafe_memory_access = (in_native || in_java) && UnsafeCopyMemory::contains_pc(pc); + bool is_unsafe_memory_access = (in_native || in_java) && UnsafeMemoryAccess::contains_pc(pc); if (((in_vm || in_native || is_unsafe_memory_access) && thread->doing_unsafe_access()) || (nm != nullptr && nm->has_unsafe_access())) { address next_pc = Assembler::locate_next_instruction(pc); if (is_unsafe_memory_access) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } return Handle_Exception(exceptionInfo, SharedRuntime::handle_unsafe_access(thread, next_pc)); } diff --git a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp index a3101c0228513..b45d38650c076 100644 --- a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp +++ b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp @@ -340,11 +340,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // underlying file has been truncated. Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob(pc); nmethod* nm = cb ? cb->as_nmethod_or_null() : nullptr; - bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc)); + bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc)); if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) { address next_pc = pc + 4; if (is_unsafe_memory_access) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc); os::Posix::ucontext_set_pc(uc, next_pc); @@ -368,8 +368,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, thread->thread_state() == _thread_in_native) && sig == SIGBUS && thread->doing_unsafe_access()) { address next_pc = pc + 4; - if (UnsafeCopyMemory::contains_pc(pc)) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + if (UnsafeMemoryAccess::contains_pc(pc)) { + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc); os::Posix::ucontext_set_pc(uc, next_pc); diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp index 436c68f5a30cf..ba14cb2ac1280 100644 --- a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp +++ b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp @@ -257,11 +257,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob(pc); nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr; - bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc)); + bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc)); if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) { address next_pc = pc + NativeCall::instruction_size; if (is_unsafe_memory_access) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } @@ -299,8 +299,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, sig == SIGBUS && /* info->si_code == BUS_OBJERR && */ thread->doing_unsafe_access()) { address next_pc = pc + NativeCall::instruction_size; - if (UnsafeCopyMemory::contains_pc(pc)) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + if (UnsafeMemoryAccess::contains_pc(pc)) { + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } diff --git a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp index 35ee2de2aa2da..4e7316e06610a 100644 --- a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp +++ b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp @@ -441,11 +441,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob(pc); nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr; - bool is_unsafe_memory_access = thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc); + bool is_unsafe_memory_access = thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc); if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) { address next_pc = Assembler::locate_next_instruction(pc); if (is_unsafe_memory_access) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } @@ -521,8 +521,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, sig == SIGBUS && /* info->si_code == BUS_OBJERR && */ thread->doing_unsafe_access()) { address next_pc = Assembler::locate_next_instruction(pc); - if (UnsafeCopyMemory::contains_pc(pc)) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + if (UnsafeMemoryAccess::contains_pc(pc)) { + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } diff --git a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp index fc6cbe5faf0e6..9f44fe3aa2520 100644 --- a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp +++ b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp @@ -240,11 +240,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob(pc); nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr; - bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc)); + bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc)); if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) { address next_pc = pc + NativeCall::instruction_size; if (is_unsafe_memory_access) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } @@ -286,8 +286,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, sig == SIGBUS && /* info->si_code == BUS_OBJERR && */ thread->doing_unsafe_access()) { address next_pc = pc + NativeCall::instruction_size; - if (UnsafeCopyMemory::contains_pc(pc)) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + if (UnsafeMemoryAccess::contains_pc(pc)) { + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } diff --git a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp index 5b5364e1117f2..807fa76589713 100644 --- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp +++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp @@ -326,7 +326,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr; if ((nm != nullptr && nm->has_unsafe_access()) || (thread->doing_unsafe_access() && - UnsafeCopyMemory::contains_pc(pc))) { + UnsafeMemoryAccess::contains_pc(pc))) { unsafe_access = true; } } else if (sig == SIGSEGV && @@ -364,8 +364,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // any other suitable exception reason, // so assume it is an unsafe access. address next_pc = pc + Assembler::InstructionSize; - if (UnsafeCopyMemory::contains_pc(pc)) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + if (UnsafeMemoryAccess::contains_pc(pc)) { + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } #ifdef __thumb__ if (uc->uc_mcontext.arm_cpsr & PSR_T_BIT) { diff --git a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp index 89197df449311..1857097bd52cd 100644 --- a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp +++ b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp @@ -355,11 +355,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // underlying file has been truncated. Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob(pc); nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr; - bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc)); + bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc)); if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) { address next_pc = pc + 4; if (is_unsafe_memory_access) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc); os::Posix::ucontext_set_pc(uc, next_pc); @@ -379,8 +379,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, thread->thread_state() == _thread_in_native) && sig == SIGBUS && thread->doing_unsafe_access()) { address next_pc = pc + 4; - if (UnsafeCopyMemory::contains_pc(pc)) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + if (UnsafeMemoryAccess::contains_pc(pc)) { + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc); os::Posix::ucontext_set_pc(uc, next_pc); diff --git a/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp b/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp index ec880236793b6..fcb0e170af16a 100644 --- a/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp +++ b/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp @@ -230,11 +230,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob(pc); nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr; - bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc)); + bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc)); if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) { address next_pc = Assembler::locate_next_instruction(pc); if (is_unsafe_memory_access) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } @@ -272,8 +272,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, sig == SIGBUS && /* info->si_code == BUS_OBJERR && */ thread->doing_unsafe_access()) { address next_pc = Assembler::locate_next_instruction(pc); - if (UnsafeCopyMemory::contains_pc(pc)) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + if (UnsafeMemoryAccess::contains_pc(pc)) { + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } diff --git a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp index 9815ff2c6cefa..6cdb2a5e3f66a 100644 --- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp @@ -260,11 +260,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob(pc); nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr; - bool is_unsafe_memory_access = thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc); + bool is_unsafe_memory_access = thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc); if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) { address next_pc = Assembler::locate_next_instruction(pc); if (is_unsafe_memory_access) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } @@ -315,8 +315,8 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, (sig == SIGBUS && /* info->si_code == BUS_OBJERR && */ thread->doing_unsafe_access())) { address next_pc = Assembler::locate_next_instruction(pc); - if (UnsafeCopyMemory::contains_pc(pc)) { - next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); + if (UnsafeMemoryAccess::contains_pc(pc)) { + next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc); } stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } diff --git a/src/hotspot/share/runtime/stubRoutines.cpp b/src/hotspot/share/runtime/stubRoutines.cpp index 550f289bf3cbb..f52255f504d90 100644 --- a/src/hotspot/share/runtime/stubRoutines.cpp +++ b/src/hotspot/share/runtime/stubRoutines.cpp @@ -41,10 +41,10 @@ #include "opto/runtime.hpp" #endif -UnsafeCopyMemory* UnsafeCopyMemory::_table = nullptr; -int UnsafeCopyMemory::_table_length = 0; -int UnsafeCopyMemory::_table_max_length = 0; -address UnsafeCopyMemory::_common_exit_stub_pc = nullptr; +UnsafeMemoryAccess* UnsafeMemoryAccess::_table = nullptr; +int UnsafeMemoryAccess::_table_length = 0; +int UnsafeMemoryAccess::_table_max_length = 0; +address UnsafeMemoryAccess::_common_exit_stub_pc = nullptr; // Implementation of StubRoutines - for a description // of how to extend it, see the header file. @@ -206,14 +206,14 @@ address StubRoutines::_lookup_secondary_supers_table_stubs[Klass::SECONDARY_SUPE extern void StubGenerator_generate(CodeBuffer* code, StubCodeGenerator::StubsKind kind); // only interface to generators -void UnsafeCopyMemory::create_table(int max_size) { - UnsafeCopyMemory::_table = new UnsafeCopyMemory[max_size]; - UnsafeCopyMemory::_table_max_length = max_size; +void UnsafeMemoryAccess::create_table(int max_size) { + UnsafeMemoryAccess::_table = new UnsafeMemoryAccess[max_size]; + UnsafeMemoryAccess::_table_max_length = max_size; } -bool UnsafeCopyMemory::contains_pc(address pc) { - for (int i = 0; i < UnsafeCopyMemory::_table_length; i++) { - UnsafeCopyMemory* entry = &UnsafeCopyMemory::_table[i]; +bool UnsafeMemoryAccess::contains_pc(address pc) { + for (int i = 0; i < UnsafeMemoryAccess::_table_length; i++) { + UnsafeMemoryAccess* entry = &UnsafeMemoryAccess::_table[i]; if (pc >= entry->start_pc() && pc < entry->end_pc()) { return true; } @@ -221,9 +221,9 @@ bool UnsafeCopyMemory::contains_pc(address pc) { return false; } -address UnsafeCopyMemory::page_error_continue_pc(address pc) { - for (int i = 0; i < UnsafeCopyMemory::_table_length; i++) { - UnsafeCopyMemory* entry = &UnsafeCopyMemory::_table[i]; +address UnsafeMemoryAccess::page_error_continue_pc(address pc) { + for (int i = 0; i < UnsafeMemoryAccess::_table_length; i++) { + UnsafeMemoryAccess* entry = &UnsafeMemoryAccess::_table[i]; if (pc >= entry->start_pc() && pc < entry->end_pc()) { return entry->error_exit_pc(); } @@ -523,20 +523,20 @@ StubRoutines::select_arraycopy_function(BasicType t, bool aligned, bool disjoint #undef RETURN_STUB_PARM } -UnsafeCopyMemoryMark::UnsafeCopyMemoryMark(StubCodeGenerator* cgen, bool add_entry, bool continue_at_scope_end, address error_exit_pc) { +UnsafeMemoryAccessMark::UnsafeMemoryAccessMark(StubCodeGenerator* cgen, bool add_entry, bool continue_at_scope_end, address error_exit_pc) { _cgen = cgen; _ucm_entry = nullptr; if (add_entry) { address err_exit_pc = nullptr; if (!continue_at_scope_end) { - err_exit_pc = error_exit_pc != nullptr ? error_exit_pc : UnsafeCopyMemory::common_exit_stub_pc(); + err_exit_pc = error_exit_pc != nullptr ? error_exit_pc : UnsafeMemoryAccess::common_exit_stub_pc(); } assert(err_exit_pc != nullptr || continue_at_scope_end, "error exit not set"); - _ucm_entry = UnsafeCopyMemory::add_to_table(_cgen->assembler()->pc(), nullptr, err_exit_pc); + _ucm_entry = UnsafeMemoryAccess::add_to_table(_cgen->assembler()->pc(), nullptr, err_exit_pc); } } -UnsafeCopyMemoryMark::~UnsafeCopyMemoryMark() { +UnsafeMemoryAccessMark::~UnsafeMemoryAccessMark() { if (_ucm_entry != nullptr) { _ucm_entry->set_end_pc(_cgen->assembler()->pc()); if (_ucm_entry->error_exit_pc() == nullptr) { diff --git a/src/hotspot/share/runtime/stubRoutines.hpp b/src/hotspot/share/runtime/stubRoutines.hpp index 4cb031799e4b9..fe32c9613c814 100644 --- a/src/hotspot/share/runtime/stubRoutines.hpp +++ b/src/hotspot/share/runtime/stubRoutines.hpp @@ -76,17 +76,17 @@ // 4. implement the corresponding generator function in the platform-dependent // stubGenerator_.cpp file and call the function in generate_all() of that file -class UnsafeCopyMemory : public CHeapObj { +class UnsafeMemoryAccess : public CHeapObj { private: address _start_pc; address _end_pc; address _error_exit_pc; public: static address _common_exit_stub_pc; - static UnsafeCopyMemory* _table; + static UnsafeMemoryAccess* _table; static int _table_length; static int _table_max_length; - UnsafeCopyMemory() : _start_pc(nullptr), _end_pc(nullptr), _error_exit_pc(nullptr) {} + UnsafeMemoryAccess() : _start_pc(nullptr), _end_pc(nullptr), _error_exit_pc(nullptr) {} void set_start_pc(address pc) { _start_pc = pc; } void set_end_pc(address pc) { _end_pc = pc; } void set_error_exit_pc(address pc) { _error_exit_pc = pc; } @@ -97,9 +97,9 @@ class UnsafeCopyMemory : public CHeapObj { static void set_common_exit_stub_pc(address pc) { _common_exit_stub_pc = pc; } static address common_exit_stub_pc() { return _common_exit_stub_pc; } - static UnsafeCopyMemory* add_to_table(address start_pc, address end_pc, address error_exit_pc) { - guarantee(_table_length < _table_max_length, "Incorrect UnsafeCopyMemory::_table_max_length"); - UnsafeCopyMemory* entry = &_table[_table_length]; + static UnsafeMemoryAccess* add_to_table(address start_pc, address end_pc, address error_exit_pc) { + guarantee(_table_length < _table_max_length, "Incorrect UnsafeMemoryAccess::_table_max_length"); + UnsafeMemoryAccess* entry = &_table[_table_length]; entry->set_start_pc(start_pc); entry->set_end_pc(end_pc); entry->set_error_exit_pc(error_exit_pc); @@ -113,13 +113,13 @@ class UnsafeCopyMemory : public CHeapObj { static void create_table(int max_size); }; -class UnsafeCopyMemoryMark : public StackObj { +class UnsafeMemoryAccessMark : public StackObj { private: - UnsafeCopyMemory* _ucm_entry; + UnsafeMemoryAccess* _ucm_entry; StubCodeGenerator* _cgen; public: - UnsafeCopyMemoryMark(StubCodeGenerator* cgen, bool add_entry, bool continue_at_scope_end, address error_exit_pc = nullptr); - ~UnsafeCopyMemoryMark(); + UnsafeMemoryAccessMark(StubCodeGenerator* cgen, bool add_entry, bool continue_at_scope_end, address error_exit_pc = nullptr); + ~UnsafeMemoryAccessMark(); }; class StubRoutines: AllStatic { From 57ebd045eae8ef1bdb5ec96d5eb11d252e08e6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Casta=C3=B1eda=20Lozano?= Date: Tue, 23 Apr 2024 04:18:23 +0000 Subject: [PATCH 10/26] 8330153: C2: dump barrier information for all Mach nodes Reviewed-by: kvn, thartmann --- src/hotspot/share/opto/machnode.cpp | 11 +-- .../compiler/lib/ir_framework/IRNode.java | 6 ++ .../examples/GCBarrierIRExample.java | 75 +++++++++++++++++++ 3 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/GCBarrierIRExample.java diff --git a/src/hotspot/share/opto/machnode.cpp b/src/hotspot/share/opto/machnode.cpp index b2c0028b1a3ab..57361313f8533 100644 --- a/src/hotspot/share/opto/machnode.cpp +++ b/src/hotspot/share/opto/machnode.cpp @@ -548,6 +548,11 @@ void MachNode::dump_spec(outputStream *st) const { if( C->alias_type(t)->is_volatile() ) st->print(" Volatile!"); } + if (barrier_data() != 0) { + st->print(" barrier("); + BarrierSet::barrier_set()->barrier_set_c2()->dump_barrier_data(this, st); + st->print(") "); + } } //------------------------------dump_format------------------------------------ @@ -560,16 +565,12 @@ void MachNode::dump_format(PhaseRegAlloc *ra, outputStream *st) const { //============================================================================= #ifndef PRODUCT void MachTypeNode::dump_spec(outputStream *st) const { + MachNode::dump_spec(st); if (_bottom_type != nullptr) { _bottom_type->dump_on(st); } else { st->print(" null"); } - if (barrier_data() != 0) { - st->print(" barrier("); - BarrierSet::barrier_set()->barrier_set_c2()->dump_barrier_data(this, st); - st->print(")"); - } } #endif diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java index b9a6bcccf1292..366b17786ad58 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java @@ -2076,6 +2076,12 @@ public class IRNode { machOnly(Z_STORE_P_WITH_BARRIER_FLAG, regex); } + public static final String Z_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "Z_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG" + POSTFIX; + static { + String regex = START + "zCompareAndSwapP" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END; + machOnly(Z_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, regex); + } + public static final String Z_GET_AND_SET_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "Z_GET_AND_SET_P_WITH_BARRIER_FLAG" + POSTFIX; static { String regex = START + "(zXChgP)|(zGetAndSetP\\S*)" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END; diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/GCBarrierIRExample.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/GCBarrierIRExample.java new file mode 100644 index 0000000000000..5d714c513f14e --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/GCBarrierIRExample.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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 ir_framework.examples; + +import compiler.lib.ir_framework.*; +import java.lang.invoke.VarHandle; +import java.lang.invoke.MethodHandles; + +/** + * @test + * @bug 8330153 + * @summary Example test that illustrates the use of the IR test framework for + * verification of late-expanded GC barriers. + * @library /test/lib / + * @run driver ir_framework.examples.GCBarrierIRExample + */ + +public class GCBarrierIRExample { + + static class Outer { + Object f; + } + + static final VarHandle fVarHandle; + static { + MethodHandles.Lookup l = MethodHandles.lookup(); + try { + fVarHandle = l.findVarHandle(Outer.class, "f", Object.class); + } catch (Exception e) { + throw new Error(e); + } + } + static Outer o = new Outer(); + static Object oldVal = new Object(); + static Object newVal = new Object(); + + public static void main(String[] args) { + // These rules apply only to collectors that expand barriers at code + // emission, such as ZGC. Because the collector selection flags are not + // whitelisted (see IR framework's README.md file), the user (as opposed + // to jtreg) needs to set these flags here. + TestFramework.runWithFlags("-XX:+UseZGC", "-XX:+ZGenerational"); + } + + @Test + // IR rules can be used to verify collector-specific barrier info (in this + // case, that a ZGC barrier corresponds to a strong OOP reference). Barrier + // info can only be verified after matching, e.g. at the FINAL_CODE phase. + @IR(counts = {IRNode.Z_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, "strong", "1"}, + phase = CompilePhase.FINAL_CODE) + static boolean testBarrierOfCompareAndSwap() { + return fVarHandle.compareAndSet(o, oldVal, newVal); + } +} From 550a1386222462cca10f79a66453d2f08431dfdf Mon Sep 17 00:00:00 2001 From: Nizar Benalla Date: Tue, 23 Apr 2024 05:54:50 +0000 Subject: [PATCH 11/26] 8306928: Duplicate variable assignement in jdk.internal.net.http.AuthenticationFilter#getCredentials Reviewed-by: clanger, jpai --- .../classes/jdk/internal/net/http/AuthenticationFilter.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/AuthenticationFilter.java b/src/java.net.http/share/classes/jdk/internal/net/http/AuthenticationFilter.java index 6e6182a1fb2a2..81acd83c423a7 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/AuthenticationFilter.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/AuthenticationFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -89,7 +89,6 @@ private PasswordAuthentication getCredentials(String header, InetSocketAddress proxyAddress; if (proxy && (proxyAddress = req.proxy()) != null) { // request sent to server through proxy - proxyAddress = req.proxy(); host = proxyAddress.getHostString(); port = proxyAddress.getPort(); protocol = "http"; // we don't support https connection to proxy From 574ba1400e015bf579190828fbdf0618eed48bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Casta=C3=B1eda=20Lozano?= Date: Tue, 23 Apr 2024 06:52:58 +0000 Subject: [PATCH 12/26] 8330862: GCBarrierIRExample fails when a different GC is selected via the command line Reviewed-by: thartmann, dholmes, stefank --- .../ir_framework/examples/GCBarrierIRExample.java | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/GCBarrierIRExample.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/GCBarrierIRExample.java index 5d714c513f14e..e0287fc39fe0a 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/GCBarrierIRExample.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/GCBarrierIRExample.java @@ -33,6 +33,7 @@ * @summary Example test that illustrates the use of the IR test framework for * verification of late-expanded GC barriers. * @library /test/lib / + * @requires vm.gc.ZGenerational * @run driver ir_framework.examples.GCBarrierIRExample */ From 896107705615a3b9363b7a0a3e6703b20fedef70 Mon Sep 17 00:00:00 2001 From: Nizar Benalla Date: Tue, 23 Apr 2024 07:18:52 +0000 Subject: [PATCH 13/26] 8309259: Reduce calls to MethodHandles.lookup() in jdk.internal.net.http.Stream Reviewed-by: pminborg, jpai --- .../share/classes/jdk/internal/net/http/Stream.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java b/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java index c4a7abe2816a5..1bb520a6fb13b 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1724,9 +1724,10 @@ protected void unregister() { private static final VarHandle DEREGISTERED; static { try { - STREAM_STATE = MethodHandles.lookup() + MethodHandles.Lookup lookup = MethodHandles.lookup(); + STREAM_STATE = lookup .findVarHandle(Stream.class, "streamState", int.class); - DEREGISTERED = MethodHandles.lookup() + DEREGISTERED = lookup .findVarHandle(Stream.class, "deRegistered", boolean.class); } catch (Exception x) { throw new ExceptionInInitializerError(x); From daa5a4bd124d539daa3c67a3e29dcd0eee20c44d Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Tue, 23 Apr 2024 08:00:07 +0000 Subject: [PATCH 14/26] 8330802: Desugar switch in Locale::createLocale Reviewed-by: alanb, liach, rriggs, naoto, mchung --- src/java.base/share/classes/java/util/Locale.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/java.base/share/classes/java/util/Locale.java b/src/java.base/share/classes/java/util/Locale.java index bcdf32d6f8bcb..0f8474ec12d48 100644 --- a/src/java.base/share/classes/java/util/Locale.java +++ b/src/java.base/share/classes/java/util/Locale.java @@ -995,11 +995,11 @@ static Locale getInstance(BaseLocale baseloc, LocaleExtensions extensions) { private static final ReferencedKeyMap LOCALE_CACHE = ReferencedKeyMap.create(true, ConcurrentHashMap::new); private static Locale createLocale(Object key) { - return switch (key) { - case BaseLocale base -> new Locale(base, null); - case LocaleKey lk -> new Locale(lk.base, lk.exts); - default -> throw new InternalError("should not happen"); - }; + if (key instanceof BaseLocale base) { + return new Locale(base, null); + } + LocaleKey lk = (LocaleKey)key; + return new Locale(lk.base, lk.exts); } private static final class LocaleKey { From 281f9bdeb9d6870346b12e6c62a58f7984b1b133 Mon Sep 17 00:00:00 2001 From: Feilong Jiang Date: Tue, 23 Apr 2024 08:00:18 +0000 Subject: [PATCH 15/26] 8330735: RISC-V: No need to move sp to tmp register in set_last_Java_frame Reviewed-by: fyang --- src/hotspot/cpu/riscv/macroAssembler_riscv.cpp | 16 ++++++---------- src/hotspot/cpu/riscv/macroAssembler_riscv.hpp | 2 +- src/hotspot/cpu/riscv/stubGenerator_riscv.cpp | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp index 1b5a3cf571f96..1cd7ac98b3490 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp @@ -228,20 +228,16 @@ void MacroAssembler::check_and_handle_popframe(Register java_thread) {} // has to be reset to 0. This is required to allow proper stack traversal. void MacroAssembler::set_last_Java_frame(Register last_java_sp, Register last_java_fp, - Register last_java_pc, - Register tmp) { + Register last_java_pc) { if (last_java_pc->is_valid()) { - sd(last_java_pc, Address(xthread, - JavaThread::frame_anchor_offset() + - JavaFrameAnchor::last_Java_pc_offset())); + sd(last_java_pc, Address(xthread, + JavaThread::frame_anchor_offset() + + JavaFrameAnchor::last_Java_pc_offset())); } // determine last_java_sp register - if (last_java_sp == sp) { - mv(tmp, sp); - last_java_sp = tmp; - } else if (!last_java_sp->is_valid()) { + if (!last_java_sp->is_valid()) { last_java_sp = esp; } @@ -262,7 +258,7 @@ void MacroAssembler::set_last_Java_frame(Register last_java_sp, la(tmp, last_java_pc); sd(tmp, Address(xthread, JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset())); - set_last_Java_frame(last_java_sp, last_java_fp, noreg, tmp); + set_last_Java_frame(last_java_sp, last_java_fp, noreg); } void MacroAssembler::set_last_Java_frame(Register last_java_sp, diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp index 1abf156070786..a46f3d5779e09 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp @@ -146,7 +146,7 @@ class MacroAssembler: public Assembler { // last Java Frame (fills frame anchor) void set_last_Java_frame(Register last_java_sp, Register last_java_fp, address last_java_pc, Register tmp); void set_last_Java_frame(Register last_java_sp, Register last_java_fp, Label &last_java_pc, Register tmp); - void set_last_Java_frame(Register last_java_sp, Register last_java_fp, Register last_java_pc, Register tmp); + void set_last_Java_frame(Register last_java_sp, Register last_java_fp, Register last_java_pc); // thread in the default location (xthread) void reset_last_Java_frame(bool clear_fp); diff --git a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp index a4a92047eaefc..9712f8c326c02 100644 --- a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp @@ -2434,7 +2434,7 @@ class StubGenerator: public StubCodeGenerator { __ membar(__ LoadLoad); } - __ set_last_Java_frame(sp, fp, ra, t0); + __ set_last_Java_frame(sp, fp, ra); __ enter(); __ add(t1, sp, wordSize); From 1a6da3d5f0ac57e173340a117a9368c190a34e8b Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Tue, 23 Apr 2024 11:05:23 +0000 Subject: [PATCH 16/26] 8330822: Remove ModRefBarrierSet::write_ref_array_work Reviewed-by: gli, tschatzl --- src/hotspot/share/gc/g1/g1BarrierSet.hpp | 2 -- src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp | 4 ---- src/hotspot/share/gc/shared/cardTableBarrierSet.cpp | 4 ---- src/hotspot/share/gc/shared/cardTableBarrierSet.hpp | 2 -- src/hotspot/share/gc/shared/modRefBarrierSet.hpp | 3 --- src/hotspot/share/gc/shared/modRefBarrierSet.inline.hpp | 2 +- 6 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1BarrierSet.hpp b/src/hotspot/share/gc/g1/g1BarrierSet.hpp index c2f5b9dc06846..6984fcc4953ab 100644 --- a/src/hotspot/share/gc/g1/g1BarrierSet.hpp +++ b/src/hotspot/share/gc/g1/g1BarrierSet.hpp @@ -74,8 +74,6 @@ class G1BarrierSet: public CardTableBarrierSet { inline void write_region(MemRegion mr); void write_region(JavaThread* thread, MemRegion mr); - inline void write_ref_array_work(MemRegion mr); - template void write_ref_field_post(T* field); void write_ref_field_post_slow(volatile CardValue* byte); diff --git a/src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp b/src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp index 19901a76ae843..2fcbd5a173130 100644 --- a/src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp +++ b/src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp @@ -72,10 +72,6 @@ inline void G1BarrierSet::write_region(MemRegion mr) { write_region(JavaThread::current(), mr); } -inline void G1BarrierSet::write_ref_array_work(MemRegion mr) { - write_region(mr); -} - template inline void G1BarrierSet::write_ref_field_post(T* field) { volatile CardValue* byte = _card_table->byte_for(field); diff --git a/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp b/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp index d7a84b1ca56d2..1d4c4775b33f7 100644 --- a/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp +++ b/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp @@ -80,10 +80,6 @@ CardTableBarrierSet::~CardTableBarrierSet() { delete _card_table; } -void CardTableBarrierSet::write_ref_array_work(MemRegion mr) { - _card_table->dirty_MemRegion(mr); -} - void CardTableBarrierSet::write_region(MemRegion mr) { _card_table->dirty_MemRegion(mr); } diff --git a/src/hotspot/share/gc/shared/cardTableBarrierSet.hpp b/src/hotspot/share/gc/shared/cardTableBarrierSet.hpp index b52cfef9a5993..f21b99d3c8def 100644 --- a/src/hotspot/share/gc/shared/cardTableBarrierSet.hpp +++ b/src/hotspot/share/gc/shared/cardTableBarrierSet.hpp @@ -70,8 +70,6 @@ class CardTableBarrierSet: public ModRefBarrierSet { write_region(mr); } - void write_ref_array_work(MemRegion mr); - public: // Record a reference update. Note that these versions are precise! // The scanning code has to handle the fact that the write barrier may be diff --git a/src/hotspot/share/gc/shared/modRefBarrierSet.hpp b/src/hotspot/share/gc/shared/modRefBarrierSet.hpp index 8355e8fc50f96..fb66c2fa0110b 100644 --- a/src/hotspot/share/gc/shared/modRefBarrierSet.hpp +++ b/src/hotspot/share/gc/shared/modRefBarrierSet.hpp @@ -68,9 +68,6 @@ class ModRefBarrierSet: public BarrierSet { // at the address "start", which may not necessarily be HeapWord-aligned inline void write_ref_array(HeapWord* start, size_t count); - protected: - virtual void write_ref_array_work(MemRegion mr) = 0; - public: // The ModRef abstraction introduces pre and post barriers template diff --git a/src/hotspot/share/gc/shared/modRefBarrierSet.inline.hpp b/src/hotspot/share/gc/shared/modRefBarrierSet.inline.hpp index 45422167eadc5..fab8ba5766967 100644 --- a/src/hotspot/share/gc/shared/modRefBarrierSet.inline.hpp +++ b/src/hotspot/share/gc/shared/modRefBarrierSet.inline.hpp @@ -54,7 +54,7 @@ void ModRefBarrierSet::write_ref_array(HeapWord* start, size_t count) { // If compressed oops were not being used, these should already be aligned assert(UseCompressedOops || (aligned_start == start && aligned_end == end), "Expected heap word alignment of start and end"); - write_ref_array_work(MemRegion(aligned_start, aligned_end)); + write_region(MemRegion(aligned_start, aligned_end)); } template From d9d926d6699b7b2e1fcce206cbe03e1de661c2ac Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Tue, 23 Apr 2024 11:05:35 +0000 Subject: [PATCH 17/26] 8330145: Serial: Refactor SerialHeap::scan_evacuated_objs Reviewed-by: gli, tschatzl --- src/hotspot/share/gc/serial/cardTableRS.cpp | 5 +-- src/hotspot/share/gc/serial/cardTableRS.hpp | 2 +- .../share/gc/serial/defNewGeneration.cpp | 23 +--------- .../share/gc/serial/defNewGeneration.hpp | 15 ------- .../gc/serial/defNewGeneration.inline.hpp | 43 ------------------- src/hotspot/share/gc/serial/generation.hpp | 26 ----------- src/hotspot/share/gc/serial/serialFullGC.cpp | 4 -- src/hotspot/share/gc/serial/serialHeap.cpp | 33 ++++++++++---- src/hotspot/share/gc/serial/serialHeap.hpp | 7 +-- .../share/gc/serial/serialHeap.inline.hpp | 1 - .../share/gc/serial/tenuredGeneration.cpp | 12 +----- .../share/gc/serial/tenuredGeneration.hpp | 11 +---- .../gc/serial/tenuredGeneration.inline.hpp | 6 --- 13 files changed, 34 insertions(+), 154 deletions(-) delete mode 100644 src/hotspot/share/gc/serial/defNewGeneration.inline.hpp diff --git a/src/hotspot/share/gc/serial/cardTableRS.cpp b/src/hotspot/share/gc/serial/cardTableRS.cpp index 71492a8468dee..2ed384f124fd7 100644 --- a/src/hotspot/share/gc/serial/cardTableRS.cpp +++ b/src/hotspot/share/gc/serial/cardTableRS.cpp @@ -31,12 +31,11 @@ #include "memory/iterator.inline.hpp" #include "utilities/align.hpp" -void CardTableRS::scan_old_to_young_refs(TenuredGeneration* tg, HeapWord* saved_mark_word) { +void CardTableRS::scan_old_to_young_refs(TenuredGeneration* tg, HeapWord* saved_top) { const MemRegion ur = tg->used_region(); - const MemRegion urasm = MemRegion(tg->space()->bottom(), saved_mark_word); + const MemRegion urasm = MemRegion(tg->space()->bottom(), saved_top); assert(ur.contains(urasm), - "Did you forget to call save_marks()? " "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in " "[" PTR_FORMAT ", " PTR_FORMAT ")", p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end())); diff --git a/src/hotspot/share/gc/serial/cardTableRS.hpp b/src/hotspot/share/gc/serial/cardTableRS.hpp index c12cd906482bd..ee4ac31bf5f5e 100644 --- a/src/hotspot/share/gc/serial/cardTableRS.hpp +++ b/src/hotspot/share/gc/serial/cardTableRS.hpp @@ -60,7 +60,7 @@ class CardTableRS : public CardTable { public: CardTableRS(MemRegion whole_heap); - void scan_old_to_young_refs(TenuredGeneration* tg, HeapWord* saved_mark_word); + void scan_old_to_young_refs(TenuredGeneration* tg, HeapWord* saved_top); void inline_write_ref_field_gc(void* field) { CardValue* byte = byte_for(field); diff --git a/src/hotspot/share/gc/serial/defNewGeneration.cpp b/src/hotspot/share/gc/serial/defNewGeneration.cpp index 008ea957b9e79..b0641c7d69f6e 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp @@ -24,7 +24,6 @@ #include "precompiled.hpp" #include "gc/serial/cardTableRS.hpp" -#include "gc/serial/defNewGeneration.inline.hpp" #include "gc/serial/serialGcRefProcProxyTask.hpp" #include "gc/serial/serialHeap.inline.hpp" #include "gc/serial/serialStringDedup.inline.hpp" @@ -678,9 +677,6 @@ void DefNewGeneration::collect(bool full, // The preserved marks should be empty at the start of the GC. _preserved_marks_set.init(1); - assert(heap->no_allocs_since_save_marks(), - "save marks have not been newly set."); - YoungGenScanClosure young_gen_cl(this); OldGenScanClosure old_gen_cl(this); @@ -688,9 +684,6 @@ void DefNewGeneration::collect(bool full, &young_gen_cl, &old_gen_cl); - assert(heap->no_allocs_since_save_marks(), - "save marks have not been newly set."); - { StrongRootsScope srs(0); RootScanClosure root_cl{this}; @@ -700,13 +693,14 @@ void DefNewGeneration::collect(bool full, NMethodToOopClosure::FixRelocations, false /* keepalive_nmethods */); + HeapWord* saved_top_in_old_gen = _old_gen->space()->top(); heap->process_roots(SerialHeap::SO_ScavengeCodeCache, &root_cl, &cld_cl, &cld_cl, &code_cl); - _old_gen->scan_old_to_young_refs(); + _old_gen->scan_old_to_young_refs(saved_top_in_old_gen); } // "evacuate followers". @@ -723,16 +717,12 @@ void DefNewGeneration::collect(bool full, _gc_tracer->report_tenuring_threshold(tenuring_threshold()); pt.print_all_references(); } - assert(heap->no_allocs_since_save_marks(), "save marks have not been newly set."); { AdjustWeakRootClosure cl{this}; WeakProcessor::weak_oops_do(&is_alive, &cl); } - // Verify that the usage of keep_alive didn't copy any objects. - assert(heap->no_allocs_since_save_marks(), "save marks have not been newly set."); - _string_dedup_requests.flush(); if (!_promotion_failed) { @@ -892,15 +882,6 @@ void DefNewGeneration::drain_promo_failure_scan_stack() { } } -void DefNewGeneration::save_marks() { - set_saved_mark_word(); -} - - -bool DefNewGeneration::no_allocs_since_save_marks() { - return saved_mark_at_top(); -} - void DefNewGeneration::contribute_scratch(void*& scratch, size_t& num_words) { if (_promotion_failed) { return; diff --git a/src/hotspot/share/gc/serial/defNewGeneration.hpp b/src/hotspot/share/gc/serial/defNewGeneration.hpp index bdcb34b6389e4..0418d6e459fab 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.hpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.hpp @@ -171,10 +171,6 @@ class DefNewGeneration: public Generation { ContiguousSpace* from() const { return _from_space; } ContiguousSpace* to() const { return _to_space; } - HeapWord* saved_mark_word() const { return _saved_mark_word; } - void set_saved_mark_word() { _saved_mark_word = to()->top(); } - bool saved_mark_at_top() { return _saved_mark_word == _to_space->top(); } - // Space enquiries size_t capacity() const; size_t used() const; @@ -243,17 +239,6 @@ class DefNewGeneration: public Generation { // Save the tops for eden, from, and to void record_spaces_top(); - // Accessing marks - void save_marks(); - - bool no_allocs_since_save_marks(); - - // Need to declare the full complement of closures, whether we'll - // override them or not, or get message from the compiler: - // oop_since_save_marks_iterate_nv hides virtual function... - template - void oop_since_save_marks_iterate(OopClosureType* cl); - // For Old collection (part of running Full GC), the DefNewGeneration can // contribute the free part of "to-space" as the scratch space. void contribute_scratch(void*& scratch, size_t& num_words); diff --git a/src/hotspot/share/gc/serial/defNewGeneration.inline.hpp b/src/hotspot/share/gc/serial/defNewGeneration.inline.hpp deleted file mode 100644 index 3b129ade49986..0000000000000 --- a/src/hotspot/share/gc/serial/defNewGeneration.inline.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - * - */ - -#ifndef SHARE_GC_SERIAL_DEFNEWGENERATION_INLINE_HPP -#define SHARE_GC_SERIAL_DEFNEWGENERATION_INLINE_HPP - -#include "gc/serial/defNewGeneration.hpp" - -#include "gc/serial/cardTableRS.hpp" -#include "gc/shared/space.inline.hpp" -#include "oops/access.inline.hpp" -#include "utilities/devirtualizer.inline.hpp" - -// Methods of protected closure types - -template -void DefNewGeneration::oop_since_save_marks_iterate(OopClosureType* cl) { - Generation::oop_since_save_marks_iterate_impl(cl, to(), _saved_mark_word); - set_saved_mark_word(); -} - -#endif // SHARE_GC_SERIAL_DEFNEWGENERATION_INLINE_HPP diff --git a/src/hotspot/share/gc/serial/generation.hpp b/src/hotspot/share/gc/serial/generation.hpp index 800abc2e3c428..70978f358797a 100644 --- a/src/hotspot/share/gc/serial/generation.hpp +++ b/src/hotspot/share/gc/serial/generation.hpp @@ -200,32 +200,6 @@ class Generation: public CHeapObj { void set_gc_manager(GCMemoryManager* gc_manager) { _gc_manager = gc_manager; } - - // Apply "blk->do_oop" to the addresses of all reference fields in objects - // starting with the _saved_mark_word, which was noted during a generation's - // save_marks and is required to denote the head of an object. - // Fields in objects allocated by applications of the closure - // *are* included in the iteration. - // Updates saved_mark_word to point to just after the last object iterated over. - template - void oop_since_save_marks_iterate_impl(OopClosureType* blk, ContiguousSpace* space, HeapWord* saved_mark_word); }; -template -void Generation::oop_since_save_marks_iterate_impl(OopClosureType* blk, ContiguousSpace* space, HeapWord* saved_mark_word) { - HeapWord* t; - HeapWord* p = saved_mark_word; - assert(p != nullptr, "expected saved mark"); - - const intx interval = PrefetchScanIntervalInBytes; - do { - t = space->top(); - while (p < t) { - Prefetch::write(p, interval); - oop m = cast_to_oop(p); - p += m->oop_iterate_size(blk); - } - } while (t < space->top()); -} - #endif // SHARE_GC_SERIAL_GENERATION_HPP diff --git a/src/hotspot/share/gc/serial/serialFullGC.cpp b/src/hotspot/share/gc/serial/serialFullGC.cpp index 296874abcd023..88284fd63c054 100644 --- a/src/hotspot/share/gc/serial/serialFullGC.cpp +++ b/src/hotspot/share/gc/serial/serialFullGC.cpp @@ -748,10 +748,6 @@ void SerialFullGC::invoke_at_safepoint(bool clear_all_softrefs) { restore_marks(); - // Set saved marks for allocation profiler (and other things? -- dld) - // (Should this be in general part?) - gch->save_marks(); - deallocate_stacks(); SerialFullGC::_string_dedup_requests->flush(); diff --git a/src/hotspot/share/gc/serial/serialHeap.cpp b/src/hotspot/share/gc/serial/serialHeap.cpp index 84d941fbdb764..44fedd3f94063 100644 --- a/src/hotspot/share/gc/serial/serialHeap.cpp +++ b/src/hotspot/share/gc/serial/serialHeap.cpp @@ -30,7 +30,6 @@ #include "code/codeCache.hpp" #include "compiler/oopMap.hpp" #include "gc/serial/cardTableRS.hpp" -#include "gc/serial/defNewGeneration.inline.hpp" #include "gc/serial/serialFullGC.hpp" #include "gc/serial/serialHeap.inline.hpp" #include "gc/serial/serialMemoryPools.hpp" @@ -757,17 +756,33 @@ void SerialHeap::process_roots(ScanningOption so, } } -bool SerialHeap::no_allocs_since_save_marks() { - return _young_gen->no_allocs_since_save_marks() && - _old_gen->no_allocs_since_save_marks(); +template +static void oop_iterate_from(OopClosureType* blk, ContiguousSpace* space, HeapWord** from) { + assert(*from != nullptr, "precondition"); + HeapWord* t; + HeapWord* p = *from; + + const intx interval = PrefetchScanIntervalInBytes; + do { + t = space->top(); + while (p < t) { + Prefetch::write(p, interval); + p += cast_to_oop(p)->oop_iterate_size(blk); + } + } while (t < space->top()); + + *from = space->top(); } void SerialHeap::scan_evacuated_objs(YoungGenScanClosure* young_cl, OldGenScanClosure* old_cl) { + ContiguousSpace* to_space = young_gen()->to(); do { - young_gen()->oop_since_save_marks_iterate(young_cl); - old_gen()->oop_since_save_marks_iterate(old_cl); - } while (!no_allocs_since_save_marks()); + oop_iterate_from(young_cl, to_space, &_young_gen_saved_top); + oop_iterate_from(old_cl, old_gen()->space(), &_old_gen_saved_top); + // Recheck to-space only, because postcondition of oop_iterate_from is no + // unscanned objs + } while (_young_gen_saved_top != to_space->top()); guarantee(young_gen()->promo_failure_scan_is_complete(), "Failed to finish scan"); } @@ -934,8 +949,8 @@ bool SerialHeap::is_maximal_no_gc() const { } void SerialHeap::save_marks() { - _young_gen->save_marks(); - _old_gen->save_marks(); + _young_gen_saved_top = _young_gen->to()->top(); + _old_gen_saved_top = _old_gen->space()->top(); } void SerialHeap::verify(VerifyOption option /* ignored */) { diff --git a/src/hotspot/share/gc/serial/serialHeap.hpp b/src/hotspot/share/gc/serial/serialHeap.hpp index d13b8706c22e2..4a88412ced680 100644 --- a/src/hotspot/share/gc/serial/serialHeap.hpp +++ b/src/hotspot/share/gc/serial/serialHeap.hpp @@ -85,7 +85,8 @@ class SerialHeap : public CollectedHeap { private: DefNewGeneration* _young_gen; TenuredGeneration* _old_gen; - + HeapWord* _young_gen_saved_top; + HeapWord* _old_gen_saved_top; private: // The singleton CardTable Remembered Set. CardTableRS* _rem_set; @@ -279,10 +280,6 @@ class SerialHeap : public CollectedHeap { // in other generations, it should call this method. void save_marks(); - // Returns "true" iff no allocations have occurred since the last - // call to "save_marks". - bool no_allocs_since_save_marks(); - // Returns true if an incremental collection is likely to fail. // We optionally consult the young gen, if asked to do so; // otherwise we base our answer on whether the previous incremental diff --git a/src/hotspot/share/gc/serial/serialHeap.inline.hpp b/src/hotspot/share/gc/serial/serialHeap.inline.hpp index 750c0e9c31134..3279f24881e54 100644 --- a/src/hotspot/share/gc/serial/serialHeap.inline.hpp +++ b/src/hotspot/share/gc/serial/serialHeap.inline.hpp @@ -27,7 +27,6 @@ #include "gc/serial/serialHeap.hpp" -#include "gc/serial/defNewGeneration.inline.hpp" #include "gc/serial/tenuredGeneration.inline.hpp" class ScavengeHelper { diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.cpp b/src/hotspot/share/gc/serial/tenuredGeneration.cpp index a86450249a784..3e9dde0942d88 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.cpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.cpp @@ -280,8 +280,8 @@ HeapWord* TenuredGeneration::block_start(const void* addr) const { } } -void TenuredGeneration::scan_old_to_young_refs() { - _rs->scan_old_to_young_refs(this, saved_mark_word()); +void TenuredGeneration::scan_old_to_young_refs(HeapWord* saved_top_in_old_gen) { + _rs->scan_old_to_young_refs(this, saved_top_in_old_gen); } TenuredGeneration::TenuredGeneration(ReservedSpace rs, @@ -504,14 +504,6 @@ void TenuredGeneration::complete_loaded_archive_space(MemRegion archive_space) { } } -void TenuredGeneration::save_marks() { - set_saved_mark_word(); -} - -bool TenuredGeneration::no_allocs_since_save_marks() { - return saved_mark_at_top(); -} - void TenuredGeneration::gc_epilogue() { // update the generation and space performance counters update_counters(); diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.hpp b/src/hotspot/share/gc/serial/tenuredGeneration.hpp index dce6609a19b47..bb34ad8d2c282 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.hpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.hpp @@ -90,8 +90,6 @@ class TenuredGeneration: public Generation { TenuredSpace* space() const { return _the_space; } HeapWord* saved_mark_word() const { return _saved_mark_word; } - void set_saved_mark_word() { _saved_mark_word = _the_space->top(); } - bool saved_mark_at_top() { return _saved_mark_word == space()->top(); } // Grow generation with specified size (returns false if unable to grow) bool grow_by(size_t bytes); @@ -114,7 +112,7 @@ class TenuredGeneration: public Generation { HeapWord* block_start(const void* addr) const; - void scan_old_to_young_refs(); + void scan_old_to_young_refs(HeapWord* saved_top_in_old_gen); bool is_in(const void* p) const; @@ -139,13 +137,6 @@ class TenuredGeneration: public Generation { virtual inline HeapWord* allocate(size_t word_size, bool is_tlab); virtual inline HeapWord* par_allocate(size_t word_size, bool is_tlab); - template - void oop_since_save_marks_iterate(OopClosureType* cl); - - void save_marks(); - - bool no_allocs_since_save_marks(); - virtual void collect(bool full, bool clear_all_soft_refs, size_t size, diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp b/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp index 62bd523d2d9ed..253a72d3c28f4 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp @@ -61,10 +61,4 @@ HeapWord* TenuredGeneration::par_allocate(size_t word_size, return _the_space->par_allocate(word_size); } -template -void TenuredGeneration::oop_since_save_marks_iterate(OopClosureType* blk) { - Generation::oop_since_save_marks_iterate_impl(blk, _the_space, _saved_mark_word); - set_saved_mark_word(); -} - #endif // SHARE_GC_SERIAL_TENUREDGENERATION_INLINE_HPP From 3bd6982ec3dd48970450cc0da9c25d755924f449 Mon Sep 17 00:00:00 2001 From: Adam Sotona Date: Tue, 23 Apr 2024 11:07:58 +0000 Subject: [PATCH 18/26] 8326150: Typo in the documentation for jdk.jshell Reviewed-by: jlahoda --- src/jdk.jshell/share/classes/module-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jdk.jshell/share/classes/module-info.java b/src/jdk.jshell/share/classes/module-info.java index fa44d2996f101..9266fd0fed55e 100644 --- a/src/jdk.jshell/share/classes/module-info.java +++ b/src/jdk.jshell/share/classes/module-info.java @@ -35,7 +35,7 @@ * and programmatically launching the existing Java shell tool. *

* The {@link jdk.jshell} is the package for creating 'snippet' evaluating tools. - * Generally, this is only package that would be needed for creating tools. + * Generally, this is the only package that would be needed for creating tools. *

*

* The {@link jdk.jshell.spi} package specifies a Service Provider Interface (SPI) From fcb4a8ba26fe1de596331b0a2f89c5c7c24e7f9e Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Tue, 23 Apr 2024 11:31:11 +0000 Subject: [PATCH 19/26] 8330578: The VM creates instance of abstract class VirtualMachineError Reviewed-by: iklam, dlong, jwaters, dholmes --- src/hotspot/share/cds/heapShared.cpp | 2 +- src/hotspot/share/classfile/systemDictionary.cpp | 4 ++-- src/hotspot/share/classfile/verifier.cpp | 4 ++-- src/hotspot/share/memory/universe.cpp | 16 ++++++++-------- src/hotspot/share/memory/universe.hpp | 4 ++-- src/hotspot/share/oops/instanceKlass.cpp | 1 + src/hotspot/share/oops/method.cpp | 2 +- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/hotspot/share/cds/heapShared.cpp b/src/hotspot/share/cds/heapShared.cpp index a9dd5de9f4adf..202042e622e0b 100644 --- a/src/hotspot/share/cds/heapShared.cpp +++ b/src/hotspot/share/cds/heapShared.cpp @@ -1395,7 +1395,7 @@ void HeapShared::check_default_subgraph_classes() { name == vmSymbols::java_lang_String() || name == vmSymbols::java_lang_ArithmeticException() || name == vmSymbols::java_lang_NullPointerException() || - name == vmSymbols::java_lang_VirtualMachineError() || + name == vmSymbols::java_lang_InternalError() || name == vmSymbols::object_array_signature() || name == vmSymbols::byte_array_signature() || name == vmSymbols::char_array_signature(), diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp index 71ede3d9e0071..3a6c372cc501d 100644 --- a/src/hotspot/share/classfile/systemDictionary.cpp +++ b/src/hotspot/share/classfile/systemDictionary.cpp @@ -2009,9 +2009,9 @@ Method* SystemDictionary::find_method_handle_intrinsic(vmIntrinsicID iid, } } - // Throw VirtualMachineError or the pending exception in the JavaThread + // Throw OOM or the pending exception in the JavaThread if (throw_error && !HAS_PENDING_EXCEPTION) { - THROW_MSG_NULL(vmSymbols::java_lang_VirtualMachineError(), + THROW_MSG_NULL(vmSymbols::java_lang_OutOfMemoryError(), "Out of space in CodeCache for method handle intrinsic"); } return nullptr; diff --git a/src/hotspot/share/classfile/verifier.cpp b/src/hotspot/share/classfile/verifier.cpp index 743bd9d06ba6c..a66fbf645f55f 100644 --- a/src/hotspot/share/classfile/verifier.cpp +++ b/src/hotspot/share/classfile/verifier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -255,7 +255,7 @@ bool Verifier::verify(InstanceKlass* klass, bool should_verify_class, TRAPS) { // or one of it's superclasses, we're in trouble and are going // to infinitely recurse when we try to initialize the exception. // So bail out here by throwing the preallocated VM error. - THROW_OOP_(Universe::virtual_machine_error_instance(), false); + THROW_OOP_(Universe::internal_error_instance(), false); } kls = kls->super(); } diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp index 237eac5017cb2..e640482aa04da 100644 --- a/src/hotspot/share/memory/universe.cpp +++ b/src/hotspot/share/memory/universe.cpp @@ -229,7 +229,7 @@ class BuiltinException { static BuiltinException _null_ptr_exception; static BuiltinException _arithmetic_exception; -static BuiltinException _virtual_machine_error; +static BuiltinException _internal_error; objArrayOop Universe::the_empty_class_array () { return (objArrayOop)_the_empty_class_array.resolve(); @@ -246,7 +246,7 @@ oop Universe::the_min_jint_string() { return _the_min_jint_string. oop Universe::null_ptr_exception_instance() { return _null_ptr_exception.instance(); } oop Universe::arithmetic_exception_instance() { return _arithmetic_exception.instance(); } -oop Universe::virtual_machine_error_instance() { return _virtual_machine_error.instance(); } +oop Universe::internal_error_instance() { return _internal_error.instance(); } oop Universe::the_null_sentinel() { return _the_null_sentinel.resolve(); } @@ -302,7 +302,7 @@ void Universe::set_archived_basic_type_mirror_index(BasicType t, int index) { void Universe::archive_exception_instances() { _null_ptr_exception.store_in_cds(); _arithmetic_exception.store_in_cds(); - _virtual_machine_error.store_in_cds(); + _internal_error.store_in_cds(); } void Universe::load_archived_object_instances() { @@ -318,7 +318,7 @@ void Universe::load_archived_object_instances() { _null_ptr_exception.load_from_cds(); _arithmetic_exception.load_from_cds(); - _virtual_machine_error.load_from_cds(); + _internal_error.load_from_cds(); } } #endif @@ -334,7 +334,7 @@ void Universe::serialize(SerializeClosure* f) { } _null_ptr_exception.serialize(f); _arithmetic_exception.serialize(f); - _virtual_machine_error.serialize(f); + _internal_error.serialize(f); #endif f->do_ptr(&_fillerArrayKlass); @@ -1092,13 +1092,13 @@ bool universe_post_init() { _arithmetic_exception.init_if_empty(vmSymbols::java_lang_ArithmeticException(), CHECK_false); // Virtual Machine Error for when we get into a situation we can't resolve - Klass* k = vmClasses::VirtualMachineError_klass(); + Klass* k = vmClasses::InternalError_klass(); bool linked = InstanceKlass::cast(k)->link_class_or_fail(CHECK_false); if (!linked) { - tty->print_cr("Unable to link/verify VirtualMachineError class"); + tty->print_cr("Unable to link/verify InternalError class"); return false; // initialization failed } - _virtual_machine_error.init_if_empty(vmSymbols::java_lang_VirtualMachineError(), CHECK_false); + _internal_error.init_if_empty(vmSymbols::java_lang_InternalError(), CHECK_false); Handle msg = java_lang_String::create_from_str("/ by zero", CHECK_false); java_lang_Throwable::set_message(Universe::arithmetic_exception_instance(), msg()); diff --git a/src/hotspot/share/memory/universe.hpp b/src/hotspot/share/memory/universe.hpp index 09e00bb24a0b7..19acbdc09b21b 100644 --- a/src/hotspot/share/memory/universe.hpp +++ b/src/hotspot/share/memory/universe.hpp @@ -229,8 +229,8 @@ class Universe: AllStatic { static oop null_ptr_exception_instance(); static oop arithmetic_exception_instance(); - static oop virtual_machine_error_instance(); - static oop vm_exception() { return virtual_machine_error_instance(); } + static oop internal_error_instance(); + static oop vm_exception() { return internal_error_instance(); } static Array* the_array_interfaces_array() { return _the_array_interfaces_array; } static uintx the_array_interfaces_bitmap() { return _the_array_interfaces_bitmap; } diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index 0b5c975931026..0069f336e886b 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -1509,6 +1509,7 @@ instanceOop InstanceKlass::register_finalizer(instanceOop i, TRAPS) { } instanceOop InstanceKlass::allocate_instance(TRAPS) { + assert(!is_abstract() && !is_interface(), "Should not create this object"); size_t size = size_helper(); // Query before forming handle. return (instanceOop)Universe::heap()->obj_allocate(this, size, CHECK_NULL); } diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp index d2e25feef4022..f5c35abb683a2 100644 --- a/src/hotspot/share/oops/method.cpp +++ b/src/hotspot/share/oops/method.cpp @@ -1276,7 +1276,7 @@ address Method::make_adapters(const methodHandle& mh, TRAPS) { // Java exception object. vm_exit_during_initialization("Out of space in CodeCache for adapters"); } else { - THROW_MSG_NULL(vmSymbols::java_lang_VirtualMachineError(), "Out of space in CodeCache for adapters"); + THROW_MSG_NULL(vmSymbols::java_lang_OutOfMemoryError(), "Out of space in CodeCache for adapters"); } } From a92ad03946d296510c8c2ac18278608e8032b3f3 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Tue, 23 Apr 2024 12:14:57 +0000 Subject: [PATCH 20/26] 8329995: Restricted access to `/proc` can cause JFR initialization to crash Reviewed-by: dholmes, egahlin --- src/hotspot/os/linux/os_perf_linux.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/os/linux/os_perf_linux.cpp b/src/hotspot/os/linux/os_perf_linux.cpp index cca41a12ee199..87abbebe25faf 100644 --- a/src/hotspot/os/linux/os_perf_linux.cpp +++ b/src/hotspot/os/linux/os_perf_linux.cpp @@ -847,7 +847,7 @@ SystemProcessInterface::SystemProcesses::ProcessIterator::ProcessIterator() { bool SystemProcessInterface::SystemProcesses::ProcessIterator::initialize() { _dir = os::opendir("/proc"); _entry = nullptr; - _valid = true; + _valid = _dir != nullptr; // May be null if /proc is not accessible. next_process(); return true; From 6158da5e9569f4260bd6d968c940c9979583118a Mon Sep 17 00:00:00 2001 From: Oli Gillespie Date: Tue, 23 Apr 2024 12:37:36 +0000 Subject: [PATCH 21/26] 8330108: Increase CipherInputStream buffer size Reviewed-by: ascarpino, shade --- .../share/classes/javax/crypto/CipherInputStream.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/javax/crypto/CipherInputStream.java b/src/java.base/share/classes/javax/crypto/CipherInputStream.java index d9b8c989b547b..546bdf0808db2 100644 --- a/src/java.base/share/classes/javax/crypto/CipherInputStream.java +++ b/src/java.base/share/classes/javax/crypto/CipherInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -84,8 +84,8 @@ public class CipherInputStream extends FilterInputStream { /* the buffer holding data that have been read in from the underlying stream, but have not been processed by the cipher - engine. the size 512 bytes is somewhat randomly chosen */ - private final byte[] ibuffer = new byte[512]; + engine. */ + private final byte[] ibuffer = new byte[8192]; // having reached the end of the underlying input stream private boolean done = false; From 3d5eeac3a38ece4a23ea6da2dfe5939d64e81cea Mon Sep 17 00:00:00 2001 From: Alexey Ivanov Date: Tue, 23 Apr 2024 12:57:24 +0000 Subject: [PATCH 22/26] 8289770: Remove Windows version macro from ShellFolder2.cpp Reviewed-by: jwaters, tr, serb --- .../native/libawt/windows/ShellFolder2.cpp | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp b/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp index b3f13a5bf8260..335281ad5d720 100644 --- a/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp +++ b/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -119,17 +119,6 @@ static jstring lsSize; static jstring lsType; static jstring lsDate; -// Some macros from awt.h, because it is not included in release -#ifndef IS_WIN2000 -#define IS_WIN2000 (LOBYTE(LOWORD(::GetVersion())) >= 5) -#endif -#ifndef IS_WINXP -#define IS_WINXP ((IS_WIN2000 && HIBYTE(LOWORD(::GetVersion())) >= 1) || LOBYTE(LOWORD(::GetVersion())) > 5) -#endif -#ifndef IS_WINVISTA -#define IS_WINVISTA (!(::GetVersion() & 0x80000000) && LOBYTE(LOWORD(::GetVersion())) >= 6) -#endif - extern "C" { @@ -1090,12 +1079,10 @@ JNIEXPORT jintArray JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconBits // XP supports alpha in some icons, and depending on device. // This should take precedence over the icon mask bits. BOOL hasAlpha = FALSE; - if (IS_WINXP) { - for (int i = 0; i < nBits; i++) { - if ((colorBits[i] & 0xff000000) != 0) { - hasAlpha = TRUE; - break; - } + for (int i = 0; i < nBits; i++) { + if ((colorBits[i] & 0xff000000) != 0) { + hasAlpha = TRUE; + break; } } if (!hasAlpha) { From 2ea89268a1af501fef4c1505a487e9ef5d5bda87 Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Tue, 23 Apr 2024 15:01:09 +0000 Subject: [PATCH 23/26] 8330961: Remove redundant public specifier in ModRefBarrierSet Reviewed-by: tschatzl --- src/hotspot/share/gc/shared/modRefBarrierSet.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hotspot/share/gc/shared/modRefBarrierSet.hpp b/src/hotspot/share/gc/shared/modRefBarrierSet.hpp index fb66c2fa0110b..395ebbc3d1830 100644 --- a/src/hotspot/share/gc/shared/modRefBarrierSet.hpp +++ b/src/hotspot/share/gc/shared/modRefBarrierSet.hpp @@ -68,7 +68,6 @@ class ModRefBarrierSet: public BarrierSet { // at the address "start", which may not necessarily be HeapWord-aligned inline void write_ref_array(HeapWord* start, size_t count); - public: // The ModRef abstraction introduces pre and post barriers template class AccessBarrier: public BarrierSet::AccessBarrier { From 383fe6eaab423a1218c9915362f691472e3773e7 Mon Sep 17 00:00:00 2001 From: Matias Saavedra Silva Date: Tue, 23 Apr 2024 15:02:27 +0000 Subject: [PATCH 24/26] 8330388: Remove invokedynamic cache index encoding Reviewed-by: cjplummer, dlong, coleenp --- .../cpu/aarch64/interp_masm_aarch64.cpp | 5 -- src/hotspot/cpu/arm/interp_masm_arm.cpp | 5 -- src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp | 2 - src/hotspot/cpu/riscv/interp_masm_riscv.cpp | 7 --- src/hotspot/cpu/s390/interp_masm_s390.cpp | 6 -- src/hotspot/cpu/x86/interp_masm_x86.cpp | 5 -- src/hotspot/share/c1/c1_Runtime1.cpp | 3 +- src/hotspot/share/cds/classListParser.cpp | 2 +- src/hotspot/share/ci/ciEnv.cpp | 13 ++-- src/hotspot/share/ci/ciReplay.cpp | 1 - src/hotspot/share/ci/ciStreams.cpp | 7 +-- .../share/classfile/resolutionErrors.hpp | 3 +- .../share/interpreter/abstractInterpreter.cpp | 5 +- .../share/interpreter/bootstrapInfo.cpp | 2 +- .../share/interpreter/bootstrapInfo.hpp | 1 - src/hotspot/share/interpreter/bytecode.cpp | 2 +- .../share/interpreter/bytecodeTracer.cpp | 3 +- .../share/interpreter/interpreterRuntime.cpp | 2 +- .../share/interpreter/linkResolver.cpp | 5 +- src/hotspot/share/interpreter/rewriter.cpp | 5 +- .../interpreter/zero/bytecodeInterpreter.cpp | 2 +- src/hotspot/share/jvmci/jvmciCompilerToVM.cpp | 23 +++----- src/hotspot/share/jvmci/jvmciRuntime.cpp | 5 +- src/hotspot/share/oops/constantPool.cpp | 23 +++----- src/hotspot/share/oops/constantPool.hpp | 14 +---- .../share/oops/constantPool.inline.hpp | 2 +- src/hotspot/share/oops/cpCache.cpp | 6 +- .../prims/jvmtiClassFileReconstituter.cpp | 2 +- src/hotspot/share/prims/methodComparator.cpp | 7 +-- src/hotspot/share/prims/whitebox.cpp | 6 -- .../interpreter/BytecodeWithCPIndex.java | 11 +--- .../sun/jvm/hotspot/oops/ConstantPool.java | 12 ---- .../hotspot/tools/jcore/ByteCodeRewriter.java | 16 +++-- .../jdk/vm/ci/hotspot/CompilerToVM.java | 20 +++---- .../vm/ci/hotspot/HotSpotConstantPool.java | 59 ++++--------------- .../jdk/vm/ci/hotspot/CompilerToVMHelper.java | 4 +- .../compilerToVM/ConstantPoolTestsHelper.java | 2 +- 37 files changed, 88 insertions(+), 210 deletions(-) diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp index b5625b7fc6134..da38f1d12e70f 100644 --- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp @@ -190,11 +190,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index, } else if (index_size == sizeof(u4)) { // assert(EnableInvokeDynamic, "giant index used only for JSR 292"); ldrw(index, Address(rbcp, bcp_offset)); - // Check if the secondary index definition is still ~x, otherwise - // we have to change the following assembler code to calculate the - // plain index. - assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line"); - eonw(index, index, zr); // convert to plain index } else if (index_size == sizeof(u1)) { load_unsigned_byte(index, Address(rbcp, bcp_offset)); } else { diff --git a/src/hotspot/cpu/arm/interp_masm_arm.cpp b/src/hotspot/cpu/arm/interp_masm_arm.cpp index 635acd781f9f1..ba161e360bee4 100644 --- a/src/hotspot/cpu/arm/interp_masm_arm.cpp +++ b/src/hotspot/cpu/arm/interp_masm_arm.cpp @@ -211,11 +211,6 @@ void InterpreterMacroAssembler::get_index_at_bcp(Register index, int bcp_offset, orr(index, tmp_reg, AsmOperand(index, lsl, BitsPerByte)); ldrb(tmp_reg, Address(Rbcp, bcp_offset)); orr(index, tmp_reg, AsmOperand(index, lsl, BitsPerByte)); - // Check if the secondary index definition is still ~x, otherwise - // we have to change the following assembler code to calculate the - // plain index. - assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line"); - mvn_32(index, index); // convert to plain index } else if (index_size == sizeof(u1)) { ldrb(index, Address(Rbcp, bcp_offset)); } else { diff --git a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp index 94ef1b3c9d2be..cdb8a742dcdf8 100644 --- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp @@ -444,8 +444,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register Rdst, int bcp_of } else { lwa(Rdst, bcp_offset, R14_bcp); } - assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line"); - nand(Rdst, Rdst, Rdst); // convert to plain index } else if (index_size == sizeof(u1)) { lbz(Rdst, bcp_offset, R14_bcp); } else { diff --git a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp index 497918e6c05c6..a770482b12189 100644 --- a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp +++ b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp @@ -216,13 +216,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index, } } else if (index_size == sizeof(u4)) { load_int_misaligned(index, Address(xbcp, bcp_offset), tmp, false); - - // Check if the secondary index definition is still ~x, otherwise - // we have to change the following assembler code to calculate the - // plain index. - assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line"); - xori(index, index, -1); - sign_extend(index, index, 32); } else if (index_size == sizeof(u1)) { load_unsigned_byte(index, Address(xbcp, bcp_offset)); } else { diff --git a/src/hotspot/cpu/s390/interp_masm_s390.cpp b/src/hotspot/cpu/s390/interp_masm_s390.cpp index 9ee38c619f0b0..bc7996c270fa0 100644 --- a/src/hotspot/cpu/s390/interp_masm_s390.cpp +++ b/src/hotspot/cpu/s390/interp_masm_s390.cpp @@ -324,12 +324,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index, int bcp_o } else if (index_size == sizeof(u4)) { load_sized_value(index, param, 4, false); - - // Check if the secondary index definition is still ~x, otherwise - // we have to change the following assembler code to calculate the - // plain index. - assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line"); - not_(index); // Convert to plain index. } else if (index_size == sizeof(u1)) { z_llgc(index, param); } else { diff --git a/src/hotspot/cpu/x86/interp_masm_x86.cpp b/src/hotspot/cpu/x86/interp_masm_x86.cpp index 33570f3155b15..4329b0b6411bb 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.cpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp @@ -463,11 +463,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index, load_unsigned_short(index, Address(_bcp_register, bcp_offset)); } else if (index_size == sizeof(u4)) { movl(index, Address(_bcp_register, bcp_offset)); - // Check if the secondary index definition is still ~x, otherwise - // we have to change the following assembler code to calculate the - // plain index. - assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line"); - notl(index); // convert to plain index } else if (index_size == sizeof(u1)) { load_unsigned_byte(index, Address(_bcp_register, bcp_offset)); } else { diff --git a/src/hotspot/share/c1/c1_Runtime1.cpp b/src/hotspot/share/c1/c1_Runtime1.cpp index ffebe38964495..31ae3f6bee09d 100644 --- a/src/hotspot/share/c1/c1_Runtime1.cpp +++ b/src/hotspot/share/c1/c1_Runtime1.cpp @@ -1059,8 +1059,7 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* current, Runtime1::StubID stub_ break; } case Bytecodes::_invokedynamic: { - int indy_index = pool->decode_invokedynamic_index(index); - appendix = Handle(current, pool->cache()->set_dynamic_call(info, indy_index)); + appendix = Handle(current, pool->cache()->set_dynamic_call(info, index)); break; } default: fatal("unexpected bytecode for load_appendix_patching_id"); diff --git a/src/hotspot/share/cds/classListParser.cpp b/src/hotspot/share/cds/classListParser.cpp index e2099620a7761..b17da725deb3f 100644 --- a/src/hotspot/share/cds/classListParser.cpp +++ b/src/hotspot/share/cds/classListParser.cpp @@ -591,7 +591,7 @@ void ClassListParser::resolve_indy_impl(Symbol* class_name_symbol, TRAPS) { LinkResolver::resolve_invoke(info, recv, pool, - ConstantPool::encode_invokedynamic_index(indy_index), + indy_index, Bytecodes::_invokedynamic, CHECK); break; } diff --git a/src/hotspot/share/ci/ciEnv.cpp b/src/hotspot/share/ci/ciEnv.cpp index 40abaa06df269..5861ac3ac3395 100644 --- a/src/hotspot/share/ci/ciEnv.cpp +++ b/src/hotspot/share/ci/ciEnv.cpp @@ -869,10 +869,8 @@ ciMethod* ciEnv::get_method_by_index_impl(const constantPoolHandle& cpool, // Jump through a patchable call site, which is initially a deopt routine. // Patch the call site to the nmethod entry point of the static compiled lambda form. // As with other two-component call sites, both values must be independently verified. - int indy_index = cpool->decode_invokedynamic_index(index); - assert (indy_index >= 0, "should be"); - assert(indy_index < cpool->cache()->resolved_indy_entries_length(), "impossible"); - Method* adapter = cpool->resolved_indy_entry_at(indy_index)->method(); + assert(index < cpool->cache()->resolved_indy_entries_length(), "impossible"); + Method* adapter = cpool->resolved_indy_entry_at(index)->method(); // Resolved if the adapter is non null. if (adapter != nullptr) { return get_method(adapter); @@ -1499,21 +1497,20 @@ void ciEnv::record_call_site_method(Thread* thread, Method* adapter) { // Process an invokedynamic call site and record any dynamic locations. void ciEnv::process_invokedynamic(const constantPoolHandle &cp, int indy_index, JavaThread* thread) { - int index = cp->decode_invokedynamic_index(indy_index); - ResolvedIndyEntry* indy_info = cp->resolved_indy_entry_at(index); + ResolvedIndyEntry* indy_info = cp->resolved_indy_entry_at(indy_index); if (indy_info->method() != nullptr) { // process the adapter Method* adapter = indy_info->method(); record_call_site_method(thread, adapter); // process the appendix - oop appendix = cp->resolved_reference_from_indy(index); + oop appendix = cp->resolved_reference_from_indy(indy_index); { RecordLocation fp(this, ""); record_call_site_obj(thread, appendix); } // process the BSM int pool_index = indy_info->constant_pool_index(); - BootstrapInfo bootstrap_specifier(cp, pool_index, index); + BootstrapInfo bootstrap_specifier(cp, pool_index, indy_index); oop bsm = cp->resolve_possibly_cached_constant_at(bootstrap_specifier.bsm_index(), thread); { RecordLocation fp(this, ""); diff --git a/src/hotspot/share/ci/ciReplay.cpp b/src/hotspot/share/ci/ciReplay.cpp index 6edbadcec4f2f..5fa30f864114f 100644 --- a/src/hotspot/share/ci/ciReplay.cpp +++ b/src/hotspot/share/ci/ciReplay.cpp @@ -416,7 +416,6 @@ class CompileReplay : public StackObj { int pool_index = 0; if (bytecode.is_invokedynamic()) { - index = cp->decode_invokedynamic_index(index); cp->cache()->set_dynamic_call(callInfo, index); appendix = cp->resolved_reference_from_indy(index); diff --git a/src/hotspot/share/ci/ciStreams.cpp b/src/hotspot/share/ci/ciStreams.cpp index 47c1ee76bf38e..8220910d74c34 100644 --- a/src/hotspot/share/ci/ciStreams.cpp +++ b/src/hotspot/share/ci/ciStreams.cpp @@ -470,7 +470,7 @@ ciMethod* ciBytecodeStream::get_method(bool& will_link, ciSignature* *declared_s bool ciBytecodeStream::has_appendix() { VM_ENTRY_MARK; constantPoolHandle cpool(THREAD, _method->get_Method()->constants()); - return ConstantPool::has_appendix_at_if_loaded(cpool, get_method_index()); + return ConstantPool::has_appendix_at_if_loaded(cpool, get_method_index(), cur_bc()); } // ------------------------------------------------------------------ @@ -481,7 +481,7 @@ bool ciBytecodeStream::has_appendix() { ciObject* ciBytecodeStream::get_appendix() { VM_ENTRY_MARK; constantPoolHandle cpool(THREAD, _method->get_Method()->constants()); - oop appendix_oop = ConstantPool::appendix_at_if_loaded(cpool, get_method_index()); + oop appendix_oop = ConstantPool::appendix_at_if_loaded(cpool, get_method_index(), cur_bc()); return CURRENT_ENV->get_object(appendix_oop); } @@ -493,7 +493,7 @@ ciObject* ciBytecodeStream::get_appendix() { bool ciBytecodeStream::has_local_signature() { GUARDED_VM_ENTRY( constantPoolHandle cpool(Thread::current(), _method->get_Method()->constants()); - return ConstantPool::has_local_signature_at_if_loaded(cpool, get_method_index()); + return ConstantPool::has_local_signature_at_if_loaded(cpool, get_method_index(), cur_bc()); ) } @@ -543,4 +543,3 @@ int ciBytecodeStream::get_method_signature_index(const constantPoolHandle& cpool return cpool->signature_ref_index_at(name_and_type_index); ) } - diff --git a/src/hotspot/share/classfile/resolutionErrors.hpp b/src/hotspot/share/classfile/resolutionErrors.hpp index ad6d793c6c0f7..7eff7816b2e33 100644 --- a/src/hotspot/share/classfile/resolutionErrors.hpp +++ b/src/hotspot/share/classfile/resolutionErrors.hpp @@ -58,9 +58,8 @@ class ResolutionErrorTable : AllStatic { static const int CPCACHE_INDEX_MANGLE_VALUE = 1000000; // This function is used to encode an invokedynamic index to differentiate it from a - // constant pool index. It assumes it is being called with a index that is less than 0 + // constant pool index. static int encode_indy_index(int index) { - assert(index < 0, "Unexpected non-negative cpCache index"); return index + CPCACHE_INDEX_MANGLE_VALUE; } }; diff --git a/src/hotspot/share/interpreter/abstractInterpreter.cpp b/src/hotspot/share/interpreter/abstractInterpreter.cpp index 0b67ea4a8f9c1..2fad5ba39ef5c 100644 --- a/src/hotspot/share/interpreter/abstractInterpreter.cpp +++ b/src/hotspot/share/interpreter/abstractInterpreter.cpp @@ -261,7 +261,7 @@ bool AbstractInterpreter::is_not_reached(const methodHandle& method, int bci) { switch (code) { case Bytecodes::_invokedynamic: { assert(invoke_bc.has_index_u4(code), "sanity"); - int method_index = cpool->decode_invokedynamic_index(invoke_bc.get_index_u4(code)); + int method_index = invoke_bc.get_index_u4(code); return cpool->resolved_indy_entry_at(method_index)->is_resolved(); } case Bytecodes::_invokevirtual: // fall-through @@ -394,8 +394,7 @@ address AbstractInterpreter::deopt_continue_after_entry(Method* method, address // (NOT needed for the old calling convention) if (!is_top_frame) { int index = Bytes::get_native_u4(bcp+1); - int indy_index = method->constants()->decode_invokedynamic_index(index); - method->constants()->resolved_indy_entry_at(indy_index)->set_num_parameters(callee_parameters); + method->constants()->resolved_indy_entry_at(index)->set_num_parameters(callee_parameters); } break; } diff --git a/src/hotspot/share/interpreter/bootstrapInfo.cpp b/src/hotspot/share/interpreter/bootstrapInfo.cpp index 7efbbeb284ef5..e3efe2a750436 100644 --- a/src/hotspot/share/interpreter/bootstrapInfo.cpp +++ b/src/hotspot/share/interpreter/bootstrapInfo.cpp @@ -74,7 +74,7 @@ bool BootstrapInfo::resolve_previously_linked_invokedynamic(CallInfo& result, TR Exceptions::wrap_dynamic_exception(/* is_indy */ true, CHECK_false); return true; } else if (indy_entry->resolution_failed()) { - int encoded_index = ResolutionErrorTable::encode_indy_index(ConstantPool::encode_invokedynamic_index(_indy_index)); + int encoded_index = ResolutionErrorTable::encode_indy_index(_indy_index); ConstantPool::throw_resolution_error(_pool, encoded_index, CHECK_false); // Doesn't necessarily need to be resolved yet return true; } else { diff --git a/src/hotspot/share/interpreter/bootstrapInfo.hpp b/src/hotspot/share/interpreter/bootstrapInfo.hpp index d73d43893293a..d480e69f3688d 100644 --- a/src/hotspot/share/interpreter/bootstrapInfo.hpp +++ b/src/hotspot/share/interpreter/bootstrapInfo.hpp @@ -76,7 +76,6 @@ class BootstrapInfo : public StackObj { // derived accessors InstanceKlass* caller() const { return _pool->pool_holder(); } oop caller_mirror() const { return caller()->java_mirror(); } - int decode_indy_index() const { return ConstantPool::decode_invokedynamic_index(_indy_index); } int bsms_attr_index() const { return _pool->bootstrap_methods_attribute_index(_bss_index); } int bsm_index() const { return _pool->bootstrap_method_ref_index_at(_bss_index); } //int argc() is eagerly cached in _argc diff --git a/src/hotspot/share/interpreter/bytecode.cpp b/src/hotspot/share/interpreter/bytecode.cpp index fdaf022c69f2f..de45e8ae3db6f 100644 --- a/src/hotspot/share/interpreter/bytecode.cpp +++ b/src/hotspot/share/interpreter/bytecode.cpp @@ -179,7 +179,7 @@ int Bytecode_member_ref::pool_index() const { ResolvedIndyEntry* Bytecode_member_ref::resolved_indy_entry() const { int index = this->index(); assert(invoke_code() == Bytecodes::_invokedynamic, "should not call this"); - return cpcache()->resolved_indy_entry_at(ConstantPool::decode_invokedynamic_index(index)); + return cpcache()->resolved_indy_entry_at(index); } ResolvedMethodEntry* Bytecode_member_ref::resolved_method_entry() const { diff --git a/src/hotspot/share/interpreter/bytecodeTracer.cpp b/src/hotspot/share/interpreter/bytecodeTracer.cpp index 624f2b621c161..b7617c38602d2 100644 --- a/src/hotspot/share/interpreter/bytecodeTracer.cpp +++ b/src/hotspot/share/interpreter/bytecodeTracer.cpp @@ -555,8 +555,7 @@ void BytecodePrinter::print_attributes(int bci, outputStream* st) { int indy_index; int cp_index; if (is_linked()) { - int i = get_native_index_u4(); - indy_index = ConstantPool::decode_invokedynamic_index(i); + indy_index = get_native_index_u4(); cp_index = constants()->resolved_indy_entry_at(indy_index)->constant_pool_index(); } else { indy_index = -1; diff --git a/src/hotspot/share/interpreter/interpreterRuntime.cpp b/src/hotspot/share/interpreter/interpreterRuntime.cpp index 5f8dcbbf2adad..7d12797007b69 100644 --- a/src/hotspot/share/interpreter/interpreterRuntime.cpp +++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp @@ -959,7 +959,7 @@ void InterpreterRuntime::resolve_invokedynamic(JavaThread* current) { index, bytecode, CHECK); } // end JvmtiHideSingleStepping - pool->cache()->set_dynamic_call(info, pool->decode_invokedynamic_index(index)); + pool->cache()->set_dynamic_call(info, index); } // This function is the interface to the assembly code. It returns the resolved diff --git a/src/hotspot/share/interpreter/linkResolver.cpp b/src/hotspot/share/interpreter/linkResolver.cpp index 7b5b62ac07576..9b80550130fec 100644 --- a/src/hotspot/share/interpreter/linkResolver.cpp +++ b/src/hotspot/share/interpreter/linkResolver.cpp @@ -1779,11 +1779,10 @@ void LinkResolver::resolve_handle_call(CallInfo& result, } void LinkResolver::resolve_invokedynamic(CallInfo& result, const constantPoolHandle& pool, int indy_index, TRAPS) { - int index = pool->decode_invokedynamic_index(indy_index); - int pool_index = pool->resolved_indy_entry_at(index)->constant_pool_index(); + int pool_index = pool->resolved_indy_entry_at(indy_index)->constant_pool_index(); // Resolve the bootstrap specifier (BSM + optional arguments). - BootstrapInfo bootstrap_specifier(pool, pool_index, index); + BootstrapInfo bootstrap_specifier(pool, pool_index, indy_index); // Check if CallSite has been bound already or failed already, and short circuit: { diff --git a/src/hotspot/share/interpreter/rewriter.cpp b/src/hotspot/share/interpreter/rewriter.cpp index 07ea1e2e2044b..6266ffcd2276e 100644 --- a/src/hotspot/share/interpreter/rewriter.cpp +++ b/src/hotspot/share/interpreter/rewriter.cpp @@ -305,15 +305,14 @@ void Rewriter::rewrite_invokedynamic(address bcp, int offset, bool reverse) { // must have a five-byte instruction format. (Of course, other JVM // implementations can use the bytes for other purposes.) // Note: We use native_u4 format exclusively for 4-byte indexes. - Bytes::put_native_u4(p, ConstantPool::encode_invokedynamic_index(_invokedynamic_index)); + Bytes::put_native_u4(p, (u2)_invokedynamic_index); _invokedynamic_index++; // Collect invokedynamic information before creating ResolvedInvokeDynamicInfo array _initialized_indy_entries.push(ResolvedIndyEntry((u2)resolved_index, (u2)cp_index)); } else { // Should do nothing since we are not patching this bytecode - int cache_index = ConstantPool::decode_invokedynamic_index( - Bytes::get_native_u4(p)); + int cache_index = Bytes::get_native_u4(p); int cp_index = _initialized_indy_entries.at(cache_index).constant_pool_index(); assert(_pool->tag_at(cp_index).is_invoke_dynamic(), "wrong index"); // zero out 4 bytes diff --git a/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp index f8b194da7b7e8..abebfc998fdf7 100644 --- a/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp +++ b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp @@ -2247,7 +2247,7 @@ void BytecodeInterpreter::run(interpreterState istate) { } CASE(_invokedynamic): { - u4 index = cp->constant_pool()->decode_invokedynamic_index(Bytes::get_native_u4(pc+1)); // index is originally negative + u4 index = Bytes::get_native_u4(pc+1); ResolvedIndyEntry* indy_info = cp->resolved_indy_entry_at(index); if (!indy_info->is_resolved()) { CALL_VM(InterpreterRuntime::resolve_from_cache(THREAD, (Bytecodes::Code)opcode), diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp index 0d9c92cad518a..fb06abe9174ef 100644 --- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp +++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp @@ -910,9 +910,9 @@ C2V_VMENTRY_NULL(jobject, lookupKlassInPool, (JNIEnv* env, jobject, ARGUMENT_PAI return JVMCIENV->get_jobject(result); C2V_END -C2V_VMENTRY_NULL(jobject, lookupAppendixInPool, (JNIEnv* env, jobject, ARGUMENT_PAIR(cp), jint which)) +C2V_VMENTRY_NULL(jobject, lookupAppendixInPool, (JNIEnv* env, jobject, ARGUMENT_PAIR(cp), jint which, jint opcode)) constantPoolHandle cp(THREAD, UNPACK_PAIR(ConstantPool, cp)); - oop appendix_oop = ConstantPool::appendix_at_if_loaded(cp, which); + oop appendix_oop = ConstantPool::appendix_at_if_loaded(cp, which, Bytecodes::Code(opcode)); return JVMCIENV->get_jobject(JVMCIENV->get_object_constant(appendix_oop)); C2V_END @@ -1629,16 +1629,11 @@ C2V_VMENTRY_NULL(jobject, iterateFrames, (JNIEnv* env, jobject compilerToVM, job return nullptr; C2V_END -C2V_VMENTRY_0(int, decodeIndyIndexToCPIndex, (JNIEnv* env, jobject, ARGUMENT_PAIR(cp), jint encoded_indy_index, jboolean resolve)) - if (!ConstantPool::is_invokedynamic_index(encoded_indy_index)) { - JVMCI_THROW_MSG_0(IllegalStateException, err_msg("not an encoded indy index %d", encoded_indy_index)); - } - +C2V_VMENTRY_0(int, decodeIndyIndexToCPIndex, (JNIEnv* env, jobject, ARGUMENT_PAIR(cp), jint indy_index, jboolean resolve)) constantPoolHandle cp(THREAD, UNPACK_PAIR(ConstantPool, cp)); CallInfo callInfo; - int indy_index = cp->decode_invokedynamic_index(encoded_indy_index); if (resolve) { - LinkResolver::resolve_invoke(callInfo, Handle(), cp, encoded_indy_index, Bytecodes::_invokedynamic, CHECK_0); + LinkResolver::resolve_invoke(callInfo, Handle(), cp, indy_index, Bytecodes::_invokedynamic, CHECK_0); cp->cache()->set_dynamic_call(callInfo, indy_index); } return cp->resolved_indy_entry_at(indy_index)->constant_pool_index(); @@ -1671,7 +1666,7 @@ C2V_VMENTRY(void, resolveInvokeHandleInPool, (JNIEnv* env, jobject, ARGUMENT_PAI } C2V_END -C2V_VMENTRY_0(jint, isResolvedInvokeHandleInPool, (JNIEnv* env, jobject, ARGUMENT_PAIR(cp), jint index)) +C2V_VMENTRY_0(jint, isResolvedInvokeHandleInPool, (JNIEnv* env, jobject, ARGUMENT_PAIR(cp), jint index, jint opcode)) constantPoolHandle cp(THREAD, UNPACK_PAIR(ConstantPool, cp)); ResolvedMethodEntry* entry = cp->cache()->resolved_method_entry_at(index); if (entry->is_resolved(Bytecodes::_invokehandle)) { @@ -1705,8 +1700,8 @@ C2V_VMENTRY_0(jint, isResolvedInvokeHandleInPool, (JNIEnv* env, jobject, ARGUMEN return Bytecodes::_invokevirtual; } - if (cp->is_invokedynamic_index(index)) { - if (cp->resolved_indy_entry_at(cp->decode_invokedynamic_index(index))->is_resolved()) { + if ((Bytecodes::Code)opcode == Bytecodes::_invokedynamic) { + if (cp->resolved_indy_entry_at(index)->is_resolved()) { return Bytecodes::_invokedynamic; } } @@ -3228,7 +3223,7 @@ JNINativeMethod CompilerToVM::methods[] = { {CC "lookupSignatureInPool", CC "(" HS_CONSTANT_POOL2 "II)" STRING, FN_PTR(lookupSignatureInPool)}, {CC "lookupKlassRefIndexInPool", CC "(" HS_CONSTANT_POOL2 "II)I", FN_PTR(lookupKlassRefIndexInPool)}, {CC "lookupKlassInPool", CC "(" HS_CONSTANT_POOL2 "I)Ljava/lang/Object;", FN_PTR(lookupKlassInPool)}, - {CC "lookupAppendixInPool", CC "(" HS_CONSTANT_POOL2 "I)" OBJECTCONSTANT, FN_PTR(lookupAppendixInPool)}, + {CC "lookupAppendixInPool", CC "(" HS_CONSTANT_POOL2 "II)" OBJECTCONSTANT, FN_PTR(lookupAppendixInPool)}, {CC "lookupMethodInPool", CC "(" HS_CONSTANT_POOL2 "IB" HS_METHOD2 ")" HS_METHOD, FN_PTR(lookupMethodInPool)}, {CC "lookupConstantInPool", CC "(" HS_CONSTANT_POOL2 "IZ)" JAVACONSTANT, FN_PTR(lookupConstantInPool)}, {CC "resolveBootstrapMethod", CC "(" HS_CONSTANT_POOL2 "I)[" OBJECT, FN_PTR(resolveBootstrapMethod)}, @@ -3240,7 +3235,7 @@ JNINativeMethod CompilerToVM::methods[] = { {CC "decodeMethodIndexToCPIndex", CC "(" HS_CONSTANT_POOL2 "I)I", FN_PTR(decodeMethodIndexToCPIndex)}, {CC "decodeIndyIndexToCPIndex", CC "(" HS_CONSTANT_POOL2 "IZ)I", FN_PTR(decodeIndyIndexToCPIndex)}, {CC "resolveInvokeHandleInPool", CC "(" HS_CONSTANT_POOL2 "I)V", FN_PTR(resolveInvokeHandleInPool)}, - {CC "isResolvedInvokeHandleInPool", CC "(" HS_CONSTANT_POOL2 "I)I", FN_PTR(isResolvedInvokeHandleInPool)}, + {CC "isResolvedInvokeHandleInPool", CC "(" HS_CONSTANT_POOL2 "II)I", FN_PTR(isResolvedInvokeHandleInPool)}, {CC "resolveMethod", CC "(" HS_KLASS2 HS_METHOD2 HS_KLASS2 ")" HS_METHOD, FN_PTR(resolveMethod)}, {CC "getSignaturePolymorphicHolders", CC "()[" STRING, FN_PTR(getSignaturePolymorphicHolders)}, {CC "getVtableIndexForInterfaceMethod", CC "(" HS_KLASS2 HS_METHOD2 ")I", FN_PTR(getVtableIndexForInterfaceMethod)}, diff --git a/src/hotspot/share/jvmci/jvmciRuntime.cpp b/src/hotspot/share/jvmci/jvmciRuntime.cpp index 6bab80ddae6a1..2e588373cdf1d 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp @@ -1856,9 +1856,8 @@ Method* JVMCIRuntime::get_method_by_index_impl(const constantPoolHandle& cpool, int index, Bytecodes::Code bc, InstanceKlass* accessor) { if (bc == Bytecodes::_invokedynamic) { - int indy_index = cpool->decode_invokedynamic_index(index); - if (cpool->resolved_indy_entry_at(indy_index)->is_resolved()) { - return cpool->resolved_indy_entry_at(indy_index)->method(); + if (cpool->resolved_indy_entry_at(index)->is_resolved()) { + return cpool->resolved_indy_entry_at(index)->method(); } return nullptr; diff --git a/src/hotspot/share/oops/constantPool.cpp b/src/hotspot/share/oops/constantPool.cpp index 9d521e032ff76..b540ec6c160ac 100644 --- a/src/hotspot/share/oops/constantPool.cpp +++ b/src/hotspot/share/oops/constantPool.cpp @@ -652,32 +652,29 @@ Method* ConstantPool::method_at_if_loaded(const constantPoolHandle& cpool, } -bool ConstantPool::has_appendix_at_if_loaded(const constantPoolHandle& cpool, int which) { +bool ConstantPool::has_appendix_at_if_loaded(const constantPoolHandle& cpool, int which, Bytecodes::Code code) { if (cpool->cache() == nullptr) return false; // nothing to load yet - if (is_invokedynamic_index(which)) { - int indy_index = decode_invokedynamic_index(which); - return cpool->resolved_indy_entry_at(indy_index)->has_appendix(); + if (code == Bytecodes::_invokedynamic) { + return cpool->resolved_indy_entry_at(which)->has_appendix(); } else { return cpool->resolved_method_entry_at(which)->has_appendix(); } } -oop ConstantPool::appendix_at_if_loaded(const constantPoolHandle& cpool, int which) { +oop ConstantPool::appendix_at_if_loaded(const constantPoolHandle& cpool, int which, Bytecodes::Code code) { if (cpool->cache() == nullptr) return nullptr; // nothing to load yet - if (is_invokedynamic_index(which)) { - int indy_index = decode_invokedynamic_index(which); - return cpool->resolved_reference_from_indy(indy_index); + if (code == Bytecodes::_invokedynamic) { + return cpool->resolved_reference_from_indy(which); } else { return cpool->cache()->appendix_if_resolved(which); } } -bool ConstantPool::has_local_signature_at_if_loaded(const constantPoolHandle& cpool, int which) { +bool ConstantPool::has_local_signature_at_if_loaded(const constantPoolHandle& cpool, int which, Bytecodes::Code code) { if (cpool->cache() == nullptr) return false; // nothing to load yet - if (is_invokedynamic_index(which)) { - int indy_index = decode_invokedynamic_index(which); - return cpool->resolved_indy_entry_at(indy_index)->has_local_signature(); + if (code == Bytecodes::_invokedynamic) { + return cpool->resolved_indy_entry_at(which)->has_local_signature(); } else { return cpool->resolved_method_entry_at(which)->has_local_signature(); } @@ -739,8 +736,6 @@ u2 ConstantPool::uncached_klass_ref_index_at(int cp_index) { } u2 ConstantPool::klass_ref_index_at(int index, Bytecodes::Code code) { - guarantee(!ConstantPool::is_invokedynamic_index(index), - "an invokedynamic instruction does not have a klass"); assert(code != Bytecodes::_invokedynamic, "an invokedynamic instruction does not have a klass"); return uncached_klass_ref_index_at(to_cp_index(index, code)); diff --git a/src/hotspot/share/oops/constantPool.hpp b/src/hotspot/share/oops/constantPool.hpp index eec628b1e5bd3..e48229749f387 100644 --- a/src/hotspot/share/oops/constantPool.hpp +++ b/src/hotspot/share/oops/constantPool.hpp @@ -248,14 +248,6 @@ class ConstantPool : public Metadata { void allocate_resolved_klasses(ClassLoaderData* loader_data, int num_klasses, TRAPS); void initialize_unresolved_klasses(ClassLoaderData* loader_data, TRAPS); - // Invokedynamic indexes. - // They must look completely different from normal indexes. - // The main reason is that byte swapping is sometimes done on normal indexes. - // Finally, it is helpful for debugging to tell the two apart. - static bool is_invokedynamic_index(int i) { return (i < 0); } - static int decode_invokedynamic_index(int i) { assert(is_invokedynamic_index(i), ""); return ~i; } - static int encode_invokedynamic_index(int i) { assert(!is_invokedynamic_index(i), ""); return ~i; } - // Given the per-instruction index of an indy instruction, report the // main constant pool entry for its bootstrap specifier. // From there, uncached_name/signature_ref_at will get the name/type. @@ -761,9 +753,9 @@ class ConstantPool : public Metadata { // Used by compiler to prevent classloading. static Method* method_at_if_loaded (const constantPoolHandle& this_cp, int which); - static bool has_appendix_at_if_loaded (const constantPoolHandle& this_cp, int which); - static oop appendix_at_if_loaded (const constantPoolHandle& this_cp, int which); - static bool has_local_signature_at_if_loaded (const constantPoolHandle& this_cp, int which); + static bool has_appendix_at_if_loaded (const constantPoolHandle& this_cp, int which, Bytecodes::Code code); + static oop appendix_at_if_loaded (const constantPoolHandle& this_cp, int which, Bytecodes::Code code); + static bool has_local_signature_at_if_loaded (const constantPoolHandle& this_cp, int which, Bytecodes::Code code); static Klass* klass_at_if_loaded (const constantPoolHandle& this_cp, int which); // Routines currently used for annotations (only called by jvm.cpp) but which might be used in the diff --git a/src/hotspot/share/oops/constantPool.inline.hpp b/src/hotspot/share/oops/constantPool.inline.hpp index 6700e6678e640..e216f33c896d6 100644 --- a/src/hotspot/share/oops/constantPool.inline.hpp +++ b/src/hotspot/share/oops/constantPool.inline.hpp @@ -69,7 +69,7 @@ inline oop ConstantPool::appendix_if_resolved(int method_index) const { } inline u2 ConstantPool::invokedynamic_bootstrap_ref_index_at(int indy_index) const { - return cache()->resolved_indy_entry_at(decode_invokedynamic_index(indy_index))->constant_pool_index(); + return cache()->resolved_indy_entry_at(indy_index)->constant_pool_index(); } inline ResolvedIndyEntry* ConstantPool::resolved_indy_entry_at(int index) { diff --git a/src/hotspot/share/oops/cpCache.cpp b/src/hotspot/share/oops/cpCache.cpp index ccab0a04a0bf8..03dbce19f2e7e 100644 --- a/src/hotspot/share/oops/cpCache.cpp +++ b/src/hotspot/share/oops/cpCache.cpp @@ -570,8 +570,7 @@ bool ConstantPoolCache::save_and_throw_indy_exc( Symbol* error = PENDING_EXCEPTION->klass()->name(); const char* message = java_lang_Throwable::message_as_utf8(PENDING_EXCEPTION); - int encoded_index = ResolutionErrorTable::encode_indy_index( - ConstantPool::encode_invokedynamic_index(index)); + int encoded_index = ResolutionErrorTable::encode_indy_index(index); SystemDictionary::add_resolution_error(cpool, encoded_index, error, message); resolved_indy_entry_at(index)->set_resolution_failed(); return true; @@ -590,8 +589,7 @@ oop ConstantPoolCache::set_dynamic_call(const CallInfo &call_info, int index) { // Before we got here, another thread got a LinkageError exception during // resolution. Ignore our success and throw their exception. guarantee(index >= 0, "Invalid indy index"); - int encoded_index = ResolutionErrorTable::encode_indy_index( - ConstantPool::encode_invokedynamic_index(index)); + int encoded_index = ResolutionErrorTable::encode_indy_index(index); JavaThread* THREAD = JavaThread::current(); // For exception macros. constantPoolHandle cp(THREAD, constant_pool()); ConstantPool::throw_resolution_error(cp, encoded_index, THREAD); diff --git a/src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp b/src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp index 08e25c793a621..8d7ffdf4835ba 100644 --- a/src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp +++ b/src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp @@ -1066,7 +1066,7 @@ void JvmtiClassFileReconstituter::copy_bytecodes(const methodHandle& mh, int pool_index; if (is_invokedynamic) { cpci = Bytes::get_native_u4(bcp+1); - pool_index = mh->constants()->resolved_indy_entry_at(mh->constants()->decode_invokedynamic_index(cpci))->constant_pool_index(); + pool_index = mh->constants()->resolved_indy_entry_at(cpci)->constant_pool_index(); } else { // cache cannot be pre-fetched since some classes won't have it yet pool_index = mh->constants()->resolved_method_entry_at(cpci)->constant_pool_index(); diff --git a/src/hotspot/share/prims/methodComparator.cpp b/src/hotspot/share/prims/methodComparator.cpp index c681ec42a0144..ac4b59a6d9a25 100644 --- a/src/hotspot/share/prims/methodComparator.cpp +++ b/src/hotspot/share/prims/methodComparator.cpp @@ -120,9 +120,6 @@ bool MethodComparator::args_same(Bytecodes::Code const c_old, Bytecodes::Code c int index_old = s_old->get_index_u4(); int index_new = s_new->get_index_u4(); - int indy_index_old = old_cp->decode_invokedynamic_index(index_old); - int indy_index_new = new_cp->decode_invokedynamic_index(index_new); - // Check if the names of classes, field/method names and signatures at these indexes // are the same. Indices which are really into constantpool cache (rather than constant // pool itself) are accepted by the constantpool query routines below. @@ -131,8 +128,8 @@ bool MethodComparator::args_same(Bytecodes::Code const c_old, Bytecodes::Code c (old_cp->signature_ref_at(index_old, c_old) != new_cp->signature_ref_at(index_new, c_old))) return false; - int cpi_old = old_cp->cache()->resolved_indy_entry_at(indy_index_old)->constant_pool_index(); - int cpi_new = new_cp->cache()->resolved_indy_entry_at(indy_index_new)->constant_pool_index(); + int cpi_old = old_cp->cache()->resolved_indy_entry_at(index_old)->constant_pool_index(); + int cpi_new = new_cp->cache()->resolved_indy_entry_at(index_new)->constant_pool_index(); if ((old_cp->uncached_name_ref_at(cpi_old) != new_cp->uncached_name_ref_at(cpi_new)) || (old_cp->uncached_signature_ref_at(cpi_old) != new_cp->uncached_signature_ref_at(cpi_new))) return false; diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index f8dc972d06836..54fb62180bf17 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -1884,10 +1884,6 @@ WB_ENTRY(jobjectArray, WB_GetResolvedReferences(JNIEnv* env, jobject wb, jclass return (jobjectArray)JNIHandles::make_local(THREAD, resolved_refs); WB_END -WB_ENTRY(jint, WB_ConstantPoolEncodeIndyIndex(JNIEnv* env, jobject wb, jint index)) - return ConstantPool::encode_invokedynamic_index(index); -WB_END - WB_ENTRY(jint, WB_getFieldEntriesLength(JNIEnv* env, jobject wb, jclass klass)) InstanceKlass* ik = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve(klass))); ConstantPool* cp = ik->constants(); @@ -2845,8 +2841,6 @@ static JNINativeMethod methods[] = { {CC"forceClassLoaderStatsSafepoint", CC"()V", (void*)&WB_ForceClassLoaderStatsSafepoint }, {CC"getConstantPool0", CC"(Ljava/lang/Class;)J", (void*)&WB_GetConstantPool }, {CC"getResolvedReferences0", CC"(Ljava/lang/Class;)[Ljava/lang/Object;", (void*)&WB_GetResolvedReferences}, - {CC"encodeConstantPoolIndyIndex0", - CC"(I)I", (void*)&WB_ConstantPoolEncodeIndyIndex}, {CC"getFieldEntriesLength0", CC"(Ljava/lang/Class;)I", (void*)&WB_getFieldEntriesLength}, {CC"getFieldCPIndex0", CC"(Ljava/lang/Class;I)I", (void*)&WB_getFieldCPIndex}, {CC"getMethodEntriesLength0", CC"(Ljava/lang/Class;)I", (void*)&WB_getMethodEntriesLength}, diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithCPIndex.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithCPIndex.java index ba37332c8519d..3647a951b8dc3 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithCPIndex.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithCPIndex.java @@ -24,8 +24,8 @@ package sun.jvm.hotspot.interpreter; -import sun.jvm.hotspot.oops.*; -import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.oops.ConstantPoolCache; +import sun.jvm.hotspot.oops.Method; // any bytecode with constant pool index @@ -37,12 +37,7 @@ public abstract class BytecodeWithCPIndex extends Bytecode { // the constant pool index for this bytecode public int index() { if (code() == Bytecodes._invokedynamic) { - int index = getIndexU4(); - if (ConstantPool.isInvokedynamicIndex(index)) { - return ConstantPool.decodeInvokedynamicIndex(index); - } else { - return index; - } + return getIndexU4(); } else { return getIndexU2(code(), false); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java index 70ccc01533e09..8c25f54d92c62 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java @@ -306,18 +306,6 @@ public Symbol uncachedGetSignatureRefAt(int cp_index) { return getSymbolAt(signatureIndex); } - public static boolean isInvokedynamicIndex(int i) { return (i < 0); } - - public static int decodeInvokedynamicIndex(int i) { Assert.that(isInvokedynamicIndex(i), ""); return ~i; } - - // The invokedynamic points at a CP cache entry. This entry points back - // at the original CP entry (CONSTANT_InvokeDynamic) and also (via f2) at an entry - // in the resolved_references array (which provides the appendix argument). - public int invokedynamicCPCacheIndex(int index) { - Assert.that(isInvokedynamicIndex(index), "should be a invokedynamic index"); - return decodeInvokedynamicIndex(index); - } - public int uncachedGetNameAndTypeRefIndexAt(int cp_index) { if (getTagAt(cp_index).isInvokeDynamic() || getTagAt(cp_index).isDynamicConstant()) { int poolIndex = invokeDynamicNameAndTypeRefIndexAt(cp_index); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java index 60d2a3edafe7e..2ed2106c02d33 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java @@ -24,13 +24,17 @@ package sun.jvm.hotspot.tools.jcore; -import sun.jvm.hotspot.oops.*; -import sun.jvm.hotspot.interpreter.*; -import sun.jvm.hotspot.utilities.*; -import sun.jvm.hotspot.runtime.*; import java.security.AccessController; import java.security.PrivilegedAction; +import sun.jvm.hotspot.interpreter.Bytecodes; +import sun.jvm.hotspot.oops.ConstantPool; +import sun.jvm.hotspot.oops.ConstantPoolCache; +import sun.jvm.hotspot.oops.Method; +import sun.jvm.hotspot.runtime.Bytes; +import sun.jvm.hotspot.runtime.VM; +import sun.jvm.hotspot.utilities.Assert; + public class ByteCodeRewriter { private Method method; @@ -133,8 +137,8 @@ public void rewrite() { } case Bytecodes._invokedynamic: { - int cpci = method.getNativeIntArg(bci + 1); - cpoolIndex = (short) cpCache.getIndyEntryAt(~cpci).getConstantPoolIndex(); + int indy_index = method.getNativeIntArg(bci + 1); + cpoolIndex = (short) cpCache.getIndyEntryAt(indy_index).getConstantPoolIndex(); writeShort(code, bci + 1, cpoolIndex); writeShort(code, bci + 3, (short)0); // clear out trailing bytes break; diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java index e9fea0ce6ca64..14646fd027521 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java @@ -23,9 +23,6 @@ package jdk.vm.ci.hotspot; -import static jdk.vm.ci.common.InitTimer.timer; -import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; - import java.lang.reflect.Executable; import java.lang.reflect.Field; @@ -35,8 +32,10 @@ import jdk.vm.ci.code.InvalidInstalledCodeException; import jdk.vm.ci.code.stack.InspectedFrameVisitor; import jdk.vm.ci.common.InitTimer; +import static jdk.vm.ci.common.InitTimer.timer; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option; +import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; import jdk.vm.ci.meta.Constant; import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.meta.JavaConstant; @@ -429,11 +428,10 @@ private native HotSpotResolvedJavaMethodImpl lookupMethodInPool(HotSpotConstantP long callerMethodPointer); /** - * Converts the encoded indy index operand of an invokedynamic instruction + * Converts the indy index operand of an invokedynamic instruction * to an index directly into {@code constantPool}. * * @param resolve if {@true}, then resolve the entry (which may call a bootstrap method) - * @throws IllegalArgumentException if {@code encoded_indy_index} is not an encoded indy index * @return {@code JVM_CONSTANT_InvokeDynamic} constant pool entry index for the invokedynamic */ int decodeIndyIndexToCPIndex(HotSpotConstantPool constantPool, int encoded_indy_index, boolean resolve) { @@ -535,11 +533,11 @@ void resolveInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi) { * opcode of the instruction for which the resolution was performed ({@code invokedynamic} or * {@code invokevirtual}), or {@code -1} otherwise. */ - int isResolvedInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi) { - return isResolvedInvokeHandleInPool(constantPool, constantPool.getConstantPoolPointer(), cpi); + int isResolvedInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi, int opcode) { + return isResolvedInvokeHandleInPool(constantPool, constantPool.getConstantPoolPointer(), cpi, opcode); } - private native int isResolvedInvokeHandleInPool(HotSpotConstantPool constantPool, long constantPoolPointer, int cpi); + private native int isResolvedInvokeHandleInPool(HotSpotConstantPool constantPool, long constantPoolPointer, int cpi, int opcode); /** * Gets the list of type names (in the format of {@link JavaType#getName()}) denoting the @@ -596,11 +594,11 @@ private native HotSpotResolvedObjectTypeImpl resolveFieldInPool(HotSpotConstantP * Otherwise, it's treated as a constant pool cache index * for INVOKE{VIRTUAL,SPECIAL,STATIC,INTERFACE}. */ - HotSpotObjectConstantImpl lookupAppendixInPool(HotSpotConstantPool constantPool, int which) { - return lookupAppendixInPool(constantPool, constantPool.getConstantPoolPointer(), which); + HotSpotObjectConstantImpl lookupAppendixInPool(HotSpotConstantPool constantPool, int which, int opcode) { + return lookupAppendixInPool(constantPool, constantPool.getConstantPoolPointer(), which, opcode); } - private native HotSpotObjectConstantImpl lookupAppendixInPool(HotSpotConstantPool constantPool, long constantPoolPointer, int which); + private native HotSpotObjectConstantImpl lookupAppendixInPool(HotSpotConstantPool constantPool, long constantPoolPointer, int which, int opcode); /** * Installs the result of a compilation into the code cache. diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java index 1065d45a4fc52..f4f8736a2feda 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java @@ -22,19 +22,16 @@ */ package jdk.vm.ci.hotspot; -import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM; -import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; -import static jdk.vm.ci.hotspot.HotSpotVMConfig.config; -import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; - import java.util.AbstractList; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.common.NativeImageReinitialize; +import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM; +import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; +import static jdk.vm.ci.hotspot.HotSpotVMConfig.config; +import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; import jdk.vm.ci.meta.ConstantPool; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaField; @@ -259,13 +256,6 @@ private HotSpotResolvedObjectType getHolder() { return holder; } - /** - * See {@code ConstantPool::is_invokedynamic_index}. - */ - private static boolean isInvokedynamicIndex(int index) { - return index < 0; - } - /** * Gets the raw {@code ConstantPool*} value for the this constant pool. */ @@ -708,15 +698,7 @@ public JavaConstant lookupAppendix(int rawIndex, int opcode) { if (!Bytecodes.isInvoke(opcode)) { throw new IllegalArgumentException("expected an invoke bytecode for " + rawIndex + ", got " + opcode); } - - if (opcode == Bytecodes.INVOKEDYNAMIC) { - if (!isInvokedynamicIndex(rawIndex)) { - throw new IllegalArgumentException("expected a raw index for INVOKEDYNAMIC but got " + rawIndex); - } - return compilerToVM().lookupAppendixInPool(this, rawIndex); - } else { - return compilerToVM().lookupAppendixInPool(this, rawIndex); - } + return compilerToVM().lookupAppendixInPool(this, rawIndex, opcode); } /** @@ -735,26 +717,17 @@ private static JavaType getJavaType(final Object type) { @Override public JavaMethod lookupMethod(int rawIndex, int opcode, ResolvedJavaMethod caller) { - int which; // interpretation depends on opcode - if (opcode == Bytecodes.INVOKEDYNAMIC) { - if (!isInvokedynamicIndex(rawIndex)) { - throw new IllegalArgumentException("expected a raw index for INVOKEDYNAMIC but got " + rawIndex); - } - which = rawIndex; - } else { - which = rawIndex; - } - final HotSpotResolvedJavaMethod method = compilerToVM().lookupMethodInPool(this, which, (byte) opcode, (HotSpotResolvedJavaMethodImpl) caller); + final HotSpotResolvedJavaMethod method = compilerToVM().lookupMethodInPool(this, rawIndex, (byte) opcode, (HotSpotResolvedJavaMethodImpl) caller); if (method != null) { return method; } else { // Get the method's name and signature. - String name = compilerToVM().lookupNameInPool(this, which, opcode); - HotSpotSignature signature = new HotSpotSignature(runtime(), compilerToVM().lookupSignatureInPool(this, which, opcode)); + String name = compilerToVM().lookupNameInPool(this, rawIndex, opcode); + HotSpotSignature signature = new HotSpotSignature(runtime(), compilerToVM().lookupSignatureInPool(this, rawIndex, opcode)); if (opcode == Bytecodes.INVOKEDYNAMIC) { return new UnresolvedJavaMethod(name, signature, runtime().getMethodHandleClass()); } else { - final int klassIndex = getKlassRefIndexAt(which, opcode); + final int klassIndex = getKlassRefIndexAt(rawIndex, opcode); final Object type = compilerToVM().lookupKlassInPool(this, klassIndex); return new UnresolvedJavaMethod(name, signature, getJavaType(type)); } @@ -853,14 +826,10 @@ public JavaField lookupField(int rawIndex, ResolvedJavaMethod method, int opcode * @return constant pool index */ private int indyIndexConstantPoolIndex(int rawIndex, int opcode) { - if (isInvokedynamicIndex(rawIndex)) { - if (opcode != Bytecodes.INVOKEDYNAMIC) { - throw new IllegalArgumentException("expected INVOKEDYNAMIC at " + rawIndex + ", got " + opcode); - } - return compilerToVM().decodeIndyIndexToCPIndex(this, rawIndex, false); - } else { - throw new IllegalArgumentException("expected a raw index for INVOKEDYNAMIC but got " + rawIndex); + if (opcode != Bytecodes.INVOKEDYNAMIC) { + throw new IllegalArgumentException("expected INVOKEDYNAMIC at " + rawIndex + ", got " + opcode); } + return compilerToVM().decodeIndyIndexToCPIndex(this, rawIndex, false); } @Override @@ -884,10 +853,6 @@ public void loadReferencedType(int rawIndex, int opcode, boolean initialize) { cpi = rawIndex; break; case Bytecodes.INVOKEDYNAMIC: { - // invokedynamic indices are different from constant pool cache indices - if (!isInvokedynamicIndex(rawIndex)) { - throw new IllegalArgumentException("must use invokedynamic index but got " + rawIndex); - } cpi = compilerToVM().decodeIndyIndexToCPIndex(this, rawIndex, true); break; } diff --git a/test/hotspot/jtreg/compiler/jvmci/common/patches/jdk.internal.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java b/test/hotspot/jtreg/compiler/jvmci/common/patches/jdk.internal.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java index 7310f37f8ab91..6e1a8221a7375 100644 --- a/test/hotspot/jtreg/compiler/jvmci/common/patches/jdk.internal.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java +++ b/test/hotspot/jtreg/compiler/jvmci/common/patches/jdk.internal.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java @@ -144,8 +144,8 @@ public static HotSpotResolvedObjectType resolveFieldInPool( } public static Object lookupAppendixInPool( - ConstantPool constantPool, int cpi) { - return CTVM.lookupAppendixInPool((HotSpotConstantPool) constantPool, cpi); + ConstantPool constantPool, int cpi, int opcode) { + return CTVM.lookupAppendixInPool((HotSpotConstantPool) constantPool, cpi, opcode); } public static int installCode(TargetDescription target, diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java index bbbdf79fdafa5..2a222c0a0eca5 100644 --- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java +++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java @@ -80,7 +80,7 @@ public int getCPCacheIndex(int cpi) { if (constantPoolSS.getTagAt(cpi).equals(Tag.INVOKEDYNAMIC)) { for (int indy_index = 0; indy_index < WB.getIndyInfoLength(this.klass); indy_index++) { if (WB.getIndyCPIndex(this.klass, indy_index) == cpi) { - return ~indy_index; + return indy_index; } } } From b6518a5db08959a5d1a22ccff9c1795ce7f9bf85 Mon Sep 17 00:00:00 2001 From: Matias Saavedra Silva Date: Tue, 23 Apr 2024 15:07:55 +0000 Subject: [PATCH 25/26] 8329417: Remove objects with no pointers from relocation bitmap Reviewed-by: ccheung, iklam --- src/hotspot/share/cds/archiveBuilder.cpp | 22 ++++++++++++++++++++++ src/hotspot/share/cds/archiveBuilder.hpp | 13 +++++++++++-- src/hotspot/share/cds/filemap.cpp | 17 +++++++++++------ src/hotspot/share/cds/filemap.hpp | 12 +++++++++--- src/hotspot/share/cds/metaspaceShared.cpp | 1 + 5 files changed, 54 insertions(+), 11 deletions(-) diff --git a/src/hotspot/share/cds/archiveBuilder.cpp b/src/hotspot/share/cds/archiveBuilder.cpp index 0eee36eec2110..51399f03434f6 100644 --- a/src/hotspot/share/cds/archiveBuilder.cpp +++ b/src/hotspot/share/cds/archiveBuilder.cpp @@ -77,6 +77,7 @@ ArchiveBuilder::SourceObjList::~SourceObjList() { void ArchiveBuilder::SourceObjList::append(SourceObjInfo* src_info) { // Save this source object for copying + src_info->set_id(_objs->length()); _objs->append(src_info); // Prepare for marking the pointers in this source object @@ -94,6 +95,7 @@ void ArchiveBuilder::SourceObjList::append(SourceObjInfo* src_info) { void ArchiveBuilder::SourceObjList::remember_embedded_pointer(SourceObjInfo* src_info, MetaspaceClosure::Ref* ref) { // src_obj contains a pointer. Remember the location of this pointer in _ptrmap, // so that we can copy/relocate it later. + src_info->set_has_embedded_pointer(); address src_obj = src_info->source_addr(); address* field_addr = ref->addr(); assert(src_info->ptrmap_start() < _total_bytes, "sanity"); @@ -589,6 +591,26 @@ char* ArchiveBuilder::ro_strdup(const char* s) { return archived_str; } +// The objects that have embedded pointers will sink +// towards the end of the list. This ensures we have a maximum +// number of leading zero bits in the relocation bitmap. +int ArchiveBuilder::compare_src_objs(SourceObjInfo** a, SourceObjInfo** b) { + if ((*a)->has_embedded_pointer() && !(*b)->has_embedded_pointer()) { + return 1; + } else if (!(*a)->has_embedded_pointer() && (*b)->has_embedded_pointer()) { + return -1; + } else { + // This is necessary to keep the sorting order stable. Otherwise the + // archive's contents may not be deterministic. + return (*a)->id() - (*b)->id(); + } +} + +void ArchiveBuilder::sort_metadata_objs() { + _rw_src_objs.objs()->sort(compare_src_objs); + _ro_src_objs.objs()->sort(compare_src_objs); +} + void ArchiveBuilder::dump_rw_metadata() { ResourceMark rm; log_info(cds)("Allocating RW objects ... "); diff --git a/src/hotspot/share/cds/archiveBuilder.hpp b/src/hotspot/share/cds/archiveBuilder.hpp index e6ac2e7ac4ea6..dab369265b0b4 100644 --- a/src/hotspot/share/cds/archiveBuilder.hpp +++ b/src/hotspot/share/cds/archiveBuilder.hpp @@ -126,15 +126,18 @@ class ArchiveBuilder : public StackObj { uintx _ptrmap_start; // The bit-offset of the start of this object (inclusive) uintx _ptrmap_end; // The bit-offset of the end of this object (exclusive) bool _read_only; + bool _has_embedded_pointer; FollowMode _follow_mode; int _size_in_bytes; + int _id; // Each object has a unique serial ID, starting from zero. The ID is assigned + // when the object is added into _source_objs. MetaspaceObj::Type _msotype; address _source_addr; // The source object to be copied. address _buffered_addr; // The copy of this object insider the buffer. public: SourceObjInfo(MetaspaceClosure::Ref* ref, bool read_only, FollowMode follow_mode) : - _ptrmap_start(0), _ptrmap_end(0), _read_only(read_only), _follow_mode(follow_mode), - _size_in_bytes(ref->size() * BytesPerWord), _msotype(ref->msotype()), + _ptrmap_start(0), _ptrmap_end(0), _read_only(read_only), _has_embedded_pointer(false), _follow_mode(follow_mode), + _size_in_bytes(ref->size() * BytesPerWord), _id(0), _msotype(ref->msotype()), _source_addr(ref->obj()) { if (follow_mode == point_to_it) { _buffered_addr = ref->obj(); @@ -164,7 +167,11 @@ class ArchiveBuilder : public StackObj { uintx ptrmap_start() const { return _ptrmap_start; } // inclusive uintx ptrmap_end() const { return _ptrmap_end; } // exclusive bool read_only() const { return _read_only; } + bool has_embedded_pointer() const { return _has_embedded_pointer; } + void set_has_embedded_pointer() { _has_embedded_pointer = true; } int size_in_bytes() const { return _size_in_bytes; } + int id() const { return _id; } + void set_id(int i) { _id = i; } address source_addr() const { return _source_addr; } address buffered_addr() const { if (_follow_mode != set_to_null) { @@ -384,6 +391,8 @@ class ArchiveBuilder : public StackObj { char* ro_strdup(const char* s); + static int compare_src_objs(SourceObjInfo** a, SourceObjInfo** b); + void sort_metadata_objs(); void dump_rw_metadata(); void dump_ro_metadata(); void relocate_metaspaceobj_embedded_pointers(); diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index 707a1de6fd1e5..2182865ebaacc 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -293,6 +293,8 @@ void FileMapHeader::print(outputStream* st) { st->print_cr("- heap_roots_offset: " SIZE_FORMAT, _heap_roots_offset); st->print_cr("- _heap_oopmap_start_pos: " SIZE_FORMAT, _heap_oopmap_start_pos); st->print_cr("- _heap_ptrmap_start_pos: " SIZE_FORMAT, _heap_ptrmap_start_pos); + st->print_cr("- _rw_ptrmap_start_pos: " SIZE_FORMAT, _rw_ptrmap_start_pos); + st->print_cr("- _ro_ptrmap_start_pos: " SIZE_FORMAT, _ro_ptrmap_start_pos); st->print_cr("- allow_archiving_with_java_agent:%d", _allow_archiving_with_java_agent); st->print_cr("- use_optimized_module_handling: %d", _use_optimized_module_handling); st->print_cr("- has_full_module_graph %d", _has_full_module_graph); @@ -1580,7 +1582,7 @@ static size_t write_bitmap(const CHeapBitMap* map, char* output, size_t offset) // lots of leading zeros. size_t FileMapInfo::remove_bitmap_leading_zeros(CHeapBitMap* map) { size_t old_zeros = map->find_first_set_bit(0); - size_t old_size = map->size_in_bytes(); + size_t old_size = map->size(); // Slice and resize bitmap map->truncate(old_zeros, map->size()); @@ -1589,13 +1591,16 @@ size_t FileMapInfo::remove_bitmap_leading_zeros(CHeapBitMap* map) { size_t new_zeros = map->find_first_set_bit(0); assert(new_zeros == 0, "Should have removed leading zeros"); ) - - assert(map->size_in_bytes() < old_size, "Map size should have decreased"); + assert(map->size() <= old_size, "sanity"); return old_zeros; } -char* FileMapInfo::write_bitmap_region(const CHeapBitMap* rw_ptrmap, const CHeapBitMap* ro_ptrmap, ArchiveHeapInfo* heap_info, +char* FileMapInfo::write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap, ArchiveHeapInfo* heap_info, size_t &size_in_bytes) { + size_t removed_rw_zeros = remove_bitmap_leading_zeros(rw_ptrmap); + size_t removed_ro_zeros = remove_bitmap_leading_zeros(ro_ptrmap); + header()->set_rw_ptrmap_start_pos(removed_rw_zeros); + header()->set_ro_ptrmap_start_pos(removed_ro_zeros); size_in_bytes = rw_ptrmap->size_in_bytes() + ro_ptrmap->size_in_bytes(); if (heap_info->is_used()) { @@ -1942,9 +1947,9 @@ bool FileMapInfo::relocate_pointers_in_core_regions(intx addr_delta) { address valid_new_base = (address)header()->mapped_base_address(); address valid_new_end = (address)mapped_end(); - SharedDataRelocator rw_patcher((address*)rw_patch_base, (address*)rw_patch_end, valid_old_base, valid_old_end, + SharedDataRelocator rw_patcher((address*)rw_patch_base + header()->rw_ptrmap_start_pos(), (address*)rw_patch_end, valid_old_base, valid_old_end, valid_new_base, valid_new_end, addr_delta); - SharedDataRelocator ro_patcher((address*)ro_patch_base, (address*)ro_patch_end, valid_old_base, valid_old_end, + SharedDataRelocator ro_patcher((address*)ro_patch_base + header()->ro_ptrmap_start_pos(), (address*)ro_patch_end, valid_old_base, valid_old_end, valid_new_base, valid_new_end, addr_delta); rw_ptrmap.iterate(&rw_patcher); ro_ptrmap.iterate(&ro_patcher); diff --git a/src/hotspot/share/cds/filemap.hpp b/src/hotspot/share/cds/filemap.hpp index a7f1c23d00a8e..54881b8d2375d 100644 --- a/src/hotspot/share/cds/filemap.hpp +++ b/src/hotspot/share/cds/filemap.hpp @@ -229,6 +229,8 @@ class FileMapHeader: private CDSFileMapHeaderBase { // of the archived heap objects, in bytes. size_t _heap_oopmap_start_pos; // The first bit in the oopmap corresponds to this position in the heap. size_t _heap_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the heap. + size_t _rw_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the rw region + size_t _ro_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the ro region char* from_mapped_offset(size_t offset) const { return mapped_base_address() + offset; } @@ -269,8 +271,10 @@ class FileMapHeader: private CDSFileMapHeaderBase { bool compressed_oops() const { return _compressed_oops; } bool compressed_class_pointers() const { return _compressed_class_ptrs; } size_t heap_roots_offset() const { return _heap_roots_offset; } - size_t heap_oopmap_start_pos() const { return _heap_oopmap_start_pos;} - size_t heap_ptrmap_start_pos() const { return _heap_ptrmap_start_pos;} + size_t heap_oopmap_start_pos() const { return _heap_oopmap_start_pos; } + size_t heap_ptrmap_start_pos() const { return _heap_ptrmap_start_pos; } + size_t rw_ptrmap_start_pos() const { return _rw_ptrmap_start_pos; } + size_t ro_ptrmap_start_pos() const { return _ro_ptrmap_start_pos; } // FIXME: These should really return int jshort max_used_path_index() const { return _max_used_path_index; } jshort app_module_paths_start_index() const { return _app_module_paths_start_index; } @@ -284,6 +288,8 @@ class FileMapHeader: private CDSFileMapHeaderBase { void set_heap_roots_offset(size_t n) { _heap_roots_offset = n; } void set_heap_oopmap_start_pos(size_t n) { _heap_oopmap_start_pos = n; } void set_heap_ptrmap_start_pos(size_t n) { _heap_ptrmap_start_pos = n; } + void set_rw_ptrmap_start_pos(size_t n) { _rw_ptrmap_start_pos = n; } + void set_ro_ptrmap_start_pos(size_t n) { _ro_ptrmap_start_pos = n; } void copy_base_archive_name(const char* name); void set_shared_path_table(SharedPathTable table) { @@ -440,7 +446,7 @@ class FileMapInfo : public CHeapObj { void write_region(int region, char* base, size_t size, bool read_only, bool allow_exec); size_t remove_bitmap_leading_zeros(CHeapBitMap* map); - char* write_bitmap_region(const CHeapBitMap* rw_ptrmap, const CHeapBitMap* ro_ptrmap, ArchiveHeapInfo* heap_info, + char* write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap, ArchiveHeapInfo* heap_info, size_t &size_in_bytes); size_t write_heap_region(ArchiveHeapInfo* heap_info); void write_bytes(const void* buffer, size_t count); diff --git a/src/hotspot/share/cds/metaspaceShared.cpp b/src/hotspot/share/cds/metaspaceShared.cpp index b13ef2101a9bf..c7d14f83d036a 100644 --- a/src/hotspot/share/cds/metaspaceShared.cpp +++ b/src/hotspot/share/cds/metaspaceShared.cpp @@ -513,6 +513,7 @@ void VM_PopulateDumpSharedSpace::doit() { char* cloned_vtables = CppVtables::dumptime_init(&builder); + builder.sort_metadata_objs(); builder.dump_rw_metadata(); builder.dump_ro_metadata(); builder.relocate_metaspaceobj_embedded_pointers(); From b07e1531b375b9d8117e218355e70272e27e1225 Mon Sep 17 00:00:00 2001 From: Guoxiong Li Date: Tue, 23 Apr 2024 15:22:17 +0000 Subject: [PATCH 26/26] 8330362: G1: Inline offset array element accessor in G1BlockOffsetTable Reviewed-by: ayang, tschatzl --- src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp | 7 +------ src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp index bc14730594d22..ff66c2af4090b 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp @@ -43,17 +43,12 @@ G1BlockOffsetTable::G1BlockOffsetTable(MemRegion heap, G1RegionToSpaceMapper* st p2i(bot_reserved.start()), bot_reserved.byte_size(), p2i(bot_reserved.end())); } -void G1BlockOffsetTable::set_offset_array_raw(uint8_t* addr, uint8_t offset) { - Atomic::store(addr, offset); -} - void G1BlockOffsetTable::set_offset_array(uint8_t* addr, uint8_t offset) { check_address(addr, "Block offset table address out of range"); - set_offset_array_raw(addr, offset); + Atomic::store(addr, offset); } void G1BlockOffsetTable::set_offset_array(uint8_t* addr, HeapWord* high, HeapWord* low) { - check_address(addr, "Block offset table address out of range"); assert(high >= low, "addresses out of order"); size_t offset = pointer_delta(high, low); check_offset(offset, "offset too large"); diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp index a0e6129f1a099..4b254c7e42a5f 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp @@ -56,7 +56,6 @@ class G1BlockOffsetTable: public CHeapObj { // For performance these have to devolve to array accesses in product builds. inline uint8_t offset_array(uint8_t* addr) const; - inline void set_offset_array_raw(uint8_t* addr, uint8_t offset); inline void set_offset_array(uint8_t* addr, uint8_t offset); inline void set_offset_array(uint8_t* addr, HeapWord* high, HeapWord* low);