8357307: VM GC operations should have a public gc_succeeded()

Reviewed-by: ayang, iwalulya
This commit is contained in:
Thomas Schatzl 2025-05-28 15:49:34 +00:00
parent 4ced4e73fc
commit 2e6838a20d
5 changed files with 5 additions and 7 deletions

View File

@ -41,7 +41,6 @@ public:
VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true) { } VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true) { }
VMOp_Type type() const override { return VMOp_G1CollectFull; } VMOp_Type type() const override { return VMOp_G1CollectFull; }
void doit() override; void doit() override;
bool gc_succeeded() const { return prologue_succeeded(); }
}; };
class VM_G1TryInitiateConcMark : public VM_GC_Operation { class VM_G1TryInitiateConcMark : public VM_GC_Operation {
@ -63,7 +62,7 @@ public:
bool cycle_already_in_progress() const { return _cycle_already_in_progress; } bool cycle_already_in_progress() const { return _cycle_already_in_progress; }
bool whitebox_attached() const { return _whitebox_attached; } bool whitebox_attached() const { return _whitebox_attached; }
bool terminating() const { return _terminating; } 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 { class VM_G1CollectForAllocation : public VM_CollectForAllocation {
@ -74,7 +73,6 @@ public:
GCCause::Cause gc_cause); GCCause::Cause gc_cause);
virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; } virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; }
virtual void doit(); virtual void doit();
bool gc_succeeded() const { return prologue_succeeded(); }
}; };
// Concurrent G1 stop-the-world operations such as remark and cleanup. // Concurrent G1 stop-the-world operations such as remark and cleanup.

View File

@ -327,7 +327,7 @@ HeapWord* ParallelScavengeHeap::mem_allocate_work(size_t size,
// Did the VM operation execute? If so, return the result directly. // Did the VM operation execute? If so, return the result directly.
// This prevents us from looping until time out on requests that can // This prevents us from looping until time out on requests that can
// not be satisfied. // not be satisfied.
if (op.prologue_succeeded()) { if (op.gc_succeeded()) {
assert(is_in_or_null(op.result()), "result not in heap"); assert(is_in_or_null(op.result()), "result not in heap");
// Exit the loop if the gc time limit has been exceeded. // Exit the loop if the gc time limit has been exceeded.

View File

@ -339,7 +339,7 @@ HeapWord* SerialHeap::mem_allocate_work(size_t size, bool is_tlab) {
VM_SerialCollectForAllocation op(size, is_tlab, gc_count_before); VM_SerialCollectForAllocation op(size, is_tlab, gc_count_before);
VMThread::execute(&op); VMThread::execute(&op);
if (op.prologue_succeeded()) { if (op.gc_succeeded()) {
result = op.result(); result = op.result();
assert(result == nullptr || is_in_reserved(result), assert(result == nullptr || is_in_reserved(result),

View File

@ -382,7 +382,7 @@ MetaWord* CollectedHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loa
VMThread::execute(&op); VMThread::execute(&op);
if (op.prologue_succeeded()) { if (op.gc_succeeded()) {
return op.result(); return op.result();
} }
loop_count++; loop_count++;

View File

@ -143,7 +143,7 @@ class VM_GC_Operation: public VM_GC_Sync_Operation {
virtual void doit_epilogue(); virtual void doit_epilogue();
virtual bool allow_nested_vm_operations() const { return true; } 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_begin(bool full = false);
static void notify_gc_end(); static void notify_gc_end();