From 2e6838a20d52e9fa0a3b7322f2cb548e034b5d83 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Wed, 28 May 2025 15:49:34 +0000 Subject: [PATCH] 8357307: VM GC operations should have a public gc_succeeded() Reviewed-by: ayang, iwalulya --- src/hotspot/share/gc/g1/g1VMOperations.hpp | 4 +--- src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp | 2 +- src/hotspot/share/gc/serial/serialHeap.cpp | 2 +- src/hotspot/share/gc/shared/collectedHeap.cpp | 2 +- src/hotspot/share/gc/shared/gcVMOperations.hpp | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1VMOperations.hpp b/src/hotspot/share/gc/g1/g1VMOperations.hpp index d046dfaa4e8..a201d57db76 100644 --- a/src/hotspot/share/gc/g1/g1VMOperations.hpp +++ b/src/hotspot/share/gc/g1/g1VMOperations.hpp @@ -41,7 +41,6 @@ public: VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true) { } VMOp_Type type() const override { return VMOp_G1CollectFull; } void doit() override; - bool gc_succeeded() const { return prologue_succeeded(); } }; class VM_G1TryInitiateConcMark : public VM_GC_Operation { @@ -63,7 +62,7 @@ public: bool cycle_already_in_progress() const { return _cycle_already_in_progress; } bool whitebox_attached() const { return _whitebox_attached; } bool terminating() const { return _terminating; } - bool gc_succeeded() const { return _gc_succeeded; } + bool gc_succeeded() const { return _gc_succeeded && VM_GC_Operation::gc_succeeded(); } }; class VM_G1CollectForAllocation : public VM_CollectForAllocation { @@ -74,7 +73,6 @@ public: GCCause::Cause gc_cause); virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; } virtual void doit(); - bool gc_succeeded() const { return prologue_succeeded(); } }; // Concurrent G1 stop-the-world operations such as remark and cleanup. diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp index bc138ce643a..683f4e13b47 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp @@ -327,7 +327,7 @@ HeapWord* ParallelScavengeHeap::mem_allocate_work(size_t size, // Did the VM operation execute? If so, return the result directly. // This prevents us from looping until time out on requests that can // not be satisfied. - if (op.prologue_succeeded()) { + if (op.gc_succeeded()) { assert(is_in_or_null(op.result()), "result not in heap"); // Exit the loop if the gc time limit has been exceeded. diff --git a/src/hotspot/share/gc/serial/serialHeap.cpp b/src/hotspot/share/gc/serial/serialHeap.cpp index fae6acfcda9..5b2ce8d0415 100644 --- a/src/hotspot/share/gc/serial/serialHeap.cpp +++ b/src/hotspot/share/gc/serial/serialHeap.cpp @@ -339,7 +339,7 @@ HeapWord* SerialHeap::mem_allocate_work(size_t size, bool is_tlab) { VM_SerialCollectForAllocation op(size, is_tlab, gc_count_before); VMThread::execute(&op); - if (op.prologue_succeeded()) { + if (op.gc_succeeded()) { result = op.result(); assert(result == nullptr || is_in_reserved(result), diff --git a/src/hotspot/share/gc/shared/collectedHeap.cpp b/src/hotspot/share/gc/shared/collectedHeap.cpp index 6628df66cad..2d23dce9488 100644 --- a/src/hotspot/share/gc/shared/collectedHeap.cpp +++ b/src/hotspot/share/gc/shared/collectedHeap.cpp @@ -382,7 +382,7 @@ MetaWord* CollectedHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loa VMThread::execute(&op); - if (op.prologue_succeeded()) { + if (op.gc_succeeded()) { return op.result(); } loop_count++; diff --git a/src/hotspot/share/gc/shared/gcVMOperations.hpp b/src/hotspot/share/gc/shared/gcVMOperations.hpp index 5893986a70d..bc370358ff8 100644 --- a/src/hotspot/share/gc/shared/gcVMOperations.hpp +++ b/src/hotspot/share/gc/shared/gcVMOperations.hpp @@ -143,7 +143,7 @@ class VM_GC_Operation: public VM_GC_Sync_Operation { virtual void doit_epilogue(); virtual bool allow_nested_vm_operations() const { return true; } - bool prologue_succeeded() const { return _prologue_succeeded; } + virtual bool gc_succeeded() const { return _prologue_succeeded; } static void notify_gc_begin(bool full = false); static void notify_gc_end();