diff --git a/8151920-Region-liveness-printing-is-broken.patch b/8151920-Region-liveness-printing-is-broken.patch new file mode 100644 index 0000000000000000000000000000000000000000..407429b7a8accc5199928bf338e7c51c6c35173e --- /dev/null +++ b/8151920-Region-liveness-printing-is-broken.patch @@ -0,0 +1,206 @@ +From d086e0fa52edfe78b8899aa9ad8ade637f4090dc Mon Sep 17 00:00:00 2001 +Date: Mon, 30 Jun 2025 15:08:15 +0800 +Subject: 8151920: Region liveness printing is broken + +--- + .../gc_implementation/g1/concurrentMark.cpp | 50 ------------------ + .../gc_implementation/g1/concurrentMark.hpp | 17 ------ + hotspot/src/share/vm/memory/universe.cpp | 5 ++ + .../test/gc/g1/TestRegionLivenessPrint.java | 52 +++++++++++++++++++ + 4 files changed, 57 insertions(+), 67 deletions(-) + create mode 100644 hotspot/test/gc/g1/TestRegionLivenessPrint.java + +diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +index 457002859..d18a43d84 100644 +--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp ++++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +@@ -3961,8 +3961,6 @@ G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name) + : _out(out), + _total_used_bytes(0), _total_capacity_bytes(0), + _total_prev_live_bytes(0), _total_next_live_bytes(0), +- _hum_used_bytes(0), _hum_capacity_bytes(0), +- _hum_prev_live_bytes(0), _hum_next_live_bytes(0), + _total_remset_bytes(0), _total_strong_code_roots_bytes(0) { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + MemRegion g1_reserved = g1h->g1_reserved(); +@@ -4003,36 +4001,6 @@ G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name) + "(bytes)", "(bytes)"); + } + +-// It takes as a parameter a reference to one of the _hum_* fields, it +-// deduces the corresponding value for a region in a humongous region +-// series (either the region size, or what's left if the _hum_* field +-// is < the region size), and updates the _hum_* field accordingly. +-size_t G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* hum_bytes) { +- size_t bytes = 0; +- // The > 0 check is to deal with the prev and next live bytes which +- // could be 0. +- if (*hum_bytes > 0) { +- bytes = MIN2(HeapRegion::GrainBytes, *hum_bytes); +- *hum_bytes -= bytes; +- } +- return bytes; +-} +- +-// It deduces the values for a region in a humongous region series +-// from the _hum_* fields and updates those accordingly. It assumes +-// that that _hum_* fields have already been set up from the "starts +-// humongous" region and we visit the regions in address order. +-void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes, +- size_t* capacity_bytes, +- size_t* prev_live_bytes, +- size_t* next_live_bytes) { +- assert(_hum_used_bytes > 0 && _hum_capacity_bytes > 0, "pre-condition"); +- *used_bytes = get_hum_bytes(&_hum_used_bytes); +- *capacity_bytes = get_hum_bytes(&_hum_capacity_bytes); +- *prev_live_bytes = get_hum_bytes(&_hum_prev_live_bytes); +- *next_live_bytes = get_hum_bytes(&_hum_next_live_bytes); +-} +- + bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) { + const char* type = r->get_type_str(); + HeapWord* bottom = r->bottom(); +@@ -4045,24 +4013,6 @@ bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) { + size_t remset_bytes = r->rem_set()->mem_size(); + size_t strong_code_roots_bytes = r->rem_set()->strong_code_roots_mem_size(); + +- if (r->startsHumongous()) { +- assert(_hum_used_bytes == 0 && _hum_capacity_bytes == 0 && +- _hum_prev_live_bytes == 0 && _hum_next_live_bytes == 0, +- "they should have been zeroed after the last time we used them"); +- // Set up the _hum_* fields. +- _hum_capacity_bytes = capacity_bytes; +- _hum_used_bytes = used_bytes; +- _hum_prev_live_bytes = prev_live_bytes; +- _hum_next_live_bytes = next_live_bytes; +- get_hum_bytes(&used_bytes, &capacity_bytes, +- &prev_live_bytes, &next_live_bytes); +- end = bottom + HeapRegion::GrainWords; +- } else if (r->continuesHumongous()) { +- get_hum_bytes(&used_bytes, &capacity_bytes, +- &prev_live_bytes, &next_live_bytes); +- assert(end == bottom + HeapRegion::GrainWords, "invariant"); +- } +- + _total_used_bytes += used_bytes; + _total_capacity_bytes += capacity_bytes; + _total_prev_live_bytes += prev_live_bytes; +diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp +index e4da1dfdc..d1c0c9fd1 100644 +--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp ++++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp +@@ -1154,18 +1154,6 @@ private: + size_t _total_prev_live_bytes; + size_t _total_next_live_bytes; + +- // These are set up when we come across a "stars humongous" region +- // (as this is where most of this information is stored, not in the +- // subsequent "continues humongous" regions). After that, for every +- // region in a given humongous region series we deduce the right +- // values for it by simply subtracting the appropriate amount from +- // these fields. All these values should reach 0 after we've visited +- // the last region in the series. +- size_t _hum_used_bytes; +- size_t _hum_capacity_bytes; +- size_t _hum_prev_live_bytes; +- size_t _hum_next_live_bytes; +- + // Accumulator for the remembered set size + size_t _total_remset_bytes; + +@@ -1184,11 +1172,6 @@ private: + return (double) val / (double) M; + } + +- // See the .cpp file. +- size_t get_hum_bytes(size_t* hum_bytes); +- void get_hum_bytes(size_t* used_bytes, size_t* capacity_bytes, +- size_t* prev_live_bytes, size_t* next_live_bytes); +- + public: + // The header and footer are printed in the constructor and + // destructor respectively. +diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp +index 8641d490f..64dea8980 100644 +--- a/hotspot/src/share/vm/memory/universe.cpp ++++ b/hotspot/src/share/vm/memory/universe.cpp +@@ -64,6 +64,7 @@ + #include "runtime/init.hpp" + #include "runtime/java.hpp" + #include "runtime/javaCalls.hpp" ++#include "runtime/logAsyncWriter.hpp" + #include "runtime/sharedRuntime.hpp" + #include "runtime/synchronizer.hpp" + #include "runtime/thread.inline.hpp" +@@ -1436,6 +1437,10 @@ void Universe::verify(VerifyOption option, const char* prefix, bool silent) { + } + if (!silent) gclog_or_tty->print_cr("]"); + ++ if (!silent && UseAsyncGCLog) { ++ AsyncLogWriter::flush(); ++ } ++ + _verify_in_progress = false; + } + +diff --git a/hotspot/test/gc/g1/TestRegionLivenessPrint.java b/hotspot/test/gc/g1/TestRegionLivenessPrint.java +new file mode 100644 +index 000000000..0b9521283 +--- /dev/null ++++ b/hotspot/test/gc/g1/TestRegionLivenessPrint.java +@@ -0,0 +1,52 @@ ++/* ++ * Copyright (c) 2016, 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 TestRegionLivenessPrint.java ++ * @bug 8151920 ++ * @requires vm.gc=="G1" | vm.gc=="null" ++ * @summary Make sure that G1 does not assert when printing region liveness data on a humongous continues region. ++ * @key gc ++ * @library /testlibrary /testlibrary/whitebox /test/lib ++ * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox TestRegionLivenessPrint ++ * @run main ClassFileInstaller sun.hotspot.WhiteBox ++ * sun.hotspot.WhiteBox$WhiteBoxPermission ++ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC -Xmx128M -XX:G1HeapRegionSize=1m -XX:+G1PrintRegionLivenessInfo TestRegionLivenessPrint ++ */ ++ ++import sun.hotspot.WhiteBox; ++ ++public class TestRegionLivenessPrint { ++ ++ static byte[] bigobj = new byte[1024* 1024 * 2]; ++ ++ public static void main(String[] args) throws InterruptedException { ++ WhiteBox wb = WhiteBox.getWhiteBox(); ++ // Run a concurrent mark cycle to trigger the liveness accounting log messages. ++ wb.g1StartConcMarkCycle(); ++ while (wb.g1InConcurrentMark()) { ++ Thread.sleep(100); ++ } ++ } ++ ++} +-- +2.23.0 + diff --git a/openjdk-1.8.0.spec b/openjdk-1.8.0.spec index 70ff89607eafd14b749537cf2a8e6f276b5a452d..ee33d1c7dc7a36093506116acdf9a1711627b851 100644 --- a/openjdk-1.8.0.spec +++ b/openjdk-1.8.0.spec @@ -953,7 +953,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r Name: java-%{javaver}-%{origin} Version: %{javaver}.%{updatever}.%{buildver} -Release: 6 +Release: 7 # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons # and this change was brought into RHEL-4. java-1.5.0-ibm packages # also included the epoch in their virtual provides. This created a @@ -1379,6 +1379,7 @@ Patch464: 8026976-ECParameters-Point-does-not-match-field-size.patch Patch465: Add-JitProfileCache-feature.patch Patch466: jprofilecache-should-set-log-permission.patch Patch467: set-JProfilecache-feature-experimental.patch +Patch468: 8151920-Region-liveness-printing-is-broken.patch ############################################# # @@ -2064,6 +2065,7 @@ pushd %{top_level_dir_name} %patch465 -p1 %patch466 -p1 %patch467 -p1 +%patch468 -p1 %endif %ifarch loongarch64 @@ -3050,6 +3052,9 @@ cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect %endif %changelog +* Mon Jun 30 2025 neu-mobi -1:1.8.0.452.b09-7 +- add 8151920-Region-liveness-printing-is-broken.patch + * Thu Jun 19 2025 Dingli Zhang -1:1.8.0.452.b09-6 - Split patches for riscv64 to fix build in prep stage