From b1d9dbc4ee6cdb2a4153c291f3b1aa72d42bcc90 Mon Sep 17 00:00:00 2001 From: Benshuai5D Date: Sat, 17 May 2025 11:32:25 +0800 Subject: [PATCH] add heapdump-bug-fix.patch --- heapdump-bug-fix.patch | 103 +++++++++++++++++++++++++++++++++++++++++ openjdk-21.spec | 7 ++- 2 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 heapdump-bug-fix.patch diff --git a/heapdump-bug-fix.patch b/heapdump-bug-fix.patch new file mode 100644 index 0000000..0533acb --- /dev/null +++ b/heapdump-bug-fix.patch @@ -0,0 +1,103 @@ +From 04681c0e50c884ef1835af026cee6ce8d8a826bc Mon Sep 17 00:00:00 2001 +Date: Wed, 14 May 2025 16:34:14 +0800 +Subject: heapdump bug fix + +--- + make/common/NativeCompilation.gmk | 4 ++-- + src/hotspot/os_cpu/linux_arm/linux_arm_32.S | 2 ++ + src/hotspot/share/services/heapDumper.cpp | 21 ++++++++++++++------- + 3 files changed, 18 insertions(+), 9 deletions(-) + +diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk +index fbf2f62e0..4106c9de8 100644 +--- a/make/common/NativeCompilation.gmk ++++ b/make/common/NativeCompilation.gmk +@@ -795,7 +795,7 @@ define SetupNativeCompilationBody + ifeq ($$($1_COMPILE_WITH_DEBUG_SYMBOLS), true) + $1_EXTRA_CFLAGS += $$(CFLAGS_DEBUG_SYMBOLS) + $1_EXTRA_CXXFLAGS += $$(CFLAGS_DEBUG_SYMBOLS) +- ifeq ($(findstring $(OPENJDK_TARGET_CPU), arm), ) ++ ifneq ($(findstring $(OPENJDK_TARGET_CPU), arm), ) + $1_EXTRA_CFLAGS := $(filter-out -gdwarf-aranges,$(1_EXTRA_CFLAGS)) + $1_EXTRA_CXXFLAGS := $(filter-out -gdwarf-aranges,$(1_EXTRA_CXXFLAGS)) + endif +@@ -904,7 +904,7 @@ define SetupNativeCompilationBody + $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).gch + $1_USE_PCH_FLAGS := -I$$($1_OBJECT_DIR)/precompiled + else ifeq ($(TOOLCHAIN_TYPE), clang) +- ifeq ($(findstring $(OPENJDK_TARGET_CPU), arm), ) ++ ifneq ($(findstring $(OPENJDK_TARGET_CPU), arm), ) + $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).gch + $1_USE_PCH_FLAGS := -I$$($1_OBJECT_DIR)/precompiled + else +diff --git a/src/hotspot/os_cpu/linux_arm/linux_arm_32.S b/src/hotspot/os_cpu/linux_arm/linux_arm_32.S +index cfac173b1..aa839a1e3 100644 +--- a/src/hotspot/os_cpu/linux_arm/linux_arm_32.S ++++ b/src/hotspot/os_cpu/linux_arm/linux_arm_32.S +@@ -28,6 +28,8 @@ + # point or use it in the same manner as does the server + # compiler. + ++ .globl _Copy_conjoint_bytes ++ .type _Copy_conjoint_bytes, %function + .globl _Copy_arrayof_conjoint_bytes + .type _Copy_arrayof_conjoint_bytes, %function + .globl _Copy_disjoint_words +diff --git a/src/hotspot/share/services/heapDumper.cpp b/src/hotspot/share/services/heapDumper.cpp +index bbef3bfa1..6f7f9afdc 100644 +--- a/src/hotspot/share/services/heapDumper.cpp ++++ b/src/hotspot/share/services/heapDumper.cpp +@@ -2492,8 +2492,20 @@ class VM_HeapDumper : public VM_GC_Operation, public WorkerTask { + assert(_global_writer == nullptr, "Error"); + _global_writer = _local_writer; + } ++ void set_dump_instance_fields_descriptors() { ++ assert(_dump_instance_fields_descriptors == nullptr, "Error"); ++ assert(_global_writer != nullptr, "Error"); ++ if(_global_writer->getHeapDumpRedactLevel() == REDACT_ANNOTATION) { ++ _dump_instance_fields_descriptors = DumperSupport::dump_instance_annotation_field_descriptors; ++ } else if(_global_writer->getHeapDumpRedactLevel() == REDACT_DIYRULES) { ++ _dump_instance_fields_descriptors = DumperSupport::dump_instance_diyrules_field_descriptors; ++ } else { ++ _dump_instance_fields_descriptors = DumperSupport::dump_instance_field_descriptors; ++ } ++ } + void clear_global_dumper() { _global_dumper = nullptr; } + void clear_global_writer() { _global_writer = nullptr; } ++ void clear_dump_instance_fields_descriptors() { _dump_instance_fields_descriptors = nullptr; } + + bool skip_operation() const; + +@@ -2536,13 +2548,6 @@ class VM_HeapDumper : public VM_GC_Operation, public WorkerTask { + _dumper_controller = nullptr; + _poi = nullptr; + _large_object_list = new (std::nothrow) HeapDumpLargeObjectList(); +- if(writer->getHeapDumpRedactLevel() == REDACT_ANNOTATION) { +- _dump_instance_fields_descriptors = DumperSupport::dump_instance_annotation_field_descriptors; +- } else if(writer->getHeapDumpRedactLevel() == REDACT_DIYRULES) { +- _dump_instance_fields_descriptors = DumperSupport::dump_instance_diyrules_field_descriptors; +- } else { +- _dump_instance_fields_descriptors = DumperSupport::dump_instance_field_descriptors; +- } + + if (oome) { + assert(!Thread::current()->is_VM_thread(), "Dump from OutOfMemoryError cannot be called by the VMThread"); +@@ -2807,6 +2812,7 @@ void VM_HeapDumper::doit() { + // the following should be safe. + set_global_dumper(); + set_global_writer(); ++ set_dump_instance_fields_descriptors(); + + WorkerThreads* workers = ch->safepoint_workers(); + if (workers == nullptr) { +@@ -2832,6 +2838,7 @@ void VM_HeapDumper::doit() { + // Now we clear the global variables, so that a future dumper can run. + clear_global_dumper(); + clear_global_writer(); ++ clear_dump_instance_fields_descriptors(); + } + + void VM_HeapDumper::work(uint worker_id) { +-- +2.43.0.windows.1 + diff --git a/openjdk-21.spec b/openjdk-21.spec index 8363d6d..98ce7a8 100644 --- a/openjdk-21.spec +++ b/openjdk-21.spec @@ -905,7 +905,7 @@ Name: java-21-%{origin} Version: %{newjavaver}.%{buildver} # This package needs `.rolling` as part of Release so as to not conflict on install with # java-X-openjdk. I.e. when latest rolling release is also an LTS release packaged as -Release: 4 +Release: 5 # 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 @@ -1036,6 +1036,7 @@ Patch85: huawei-Adapt-to-clang-build-toolchain.patch #21.0.7 Patch87: huawei-fix-build-fail-realpath.patch Patch88: 8352716-tz-Update-Timezone-Data-to-2025b.patch +Patch89: heapdump-bug-fix.patch ############################################ # # LoongArch64 specific patches @@ -1338,6 +1339,7 @@ pushd %{top_level_dir_name} %patch85 -p1 %patch87 -p1 %patch88 -p1 +%patch89 -p1 popd # openjdk %endif @@ -1913,6 +1915,9 @@ cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect %changelog +* Sat May 17 2025 Benshuai5D - 1:21.0.7.6-5 +- add heapdump-bug-fix.patch + * Wed May 14 2025 Dingli Zhang - 1:21.0.7.6-4 - add Backport-JDK-8352673-RISC-V-Vector-can-t-be-turned-o.patch - add Backport-JDK-8355878-RISC-V-jdk-incubator-vector-Dou.patch -- Gitee