8309210: Extend VM Operations hs_err logging

Reviewed-by: dholmes, stuefe, eosterlund, sjohanss
This commit is contained in:
Stefan Karlsson 2023-06-02 12:06:31 +00:00
parent 7dbdad50a6
commit e8268d9163
4 changed files with 49 additions and 7 deletions

@ -398,14 +398,20 @@ const char* ZGeneration::phase_to_string() const {
class VM_ZOperation : public VM_Operation {
private:
const uint _gc_id;
bool _success;
const uint _gc_id;
const GCCause::Cause _gc_cause;
bool _success;
public:
VM_ZOperation()
VM_ZOperation(GCCause::Cause gc_cause)
: _gc_id(GCId::current()),
_gc_cause(gc_cause),
_success(false) {}
virtual const char* cause() const {
return GCCause::to_string(_gc_cause);
}
virtual bool block_jni_critical() const {
// Blocking JNI critical regions is needed in operations where we change
// the bad mask or move objects. Changing the bad mask will invalidate all
@ -558,6 +564,9 @@ void ZGenerationYoung::collect(ZYoungType type, ConcurrentGCTimer* timer) {
class VM_ZMarkStartYoungAndOld : public VM_ZOperation {
public:
VM_ZMarkStartYoungAndOld()
: VM_ZOperation(ZDriver::major()->gc_cause()) {}
virtual VMOp_Type type() const {
return VMOp_ZMarkStartYoungAndOld;
}
@ -578,7 +587,22 @@ public:
}
};
class VM_ZMarkStartYoung : public VM_ZOperation {
class VM_ZYoungOperation : public VM_ZOperation {
private:
static ZDriver* driver() {
if (ZGeneration::young()->type() == ZYoungType::minor) {
return ZDriver::minor();
} else {
return ZDriver::major();
}
}
public:
VM_ZYoungOperation()
: VM_ZOperation(driver()->gc_cause()) {}
};
class VM_ZMarkStartYoung : public VM_ZYoungOperation {
public:
virtual VMOp_Type type() const {
return VMOp_ZMarkStartYoung;
@ -626,7 +650,7 @@ void ZGenerationYoung::concurrent_mark() {
mark_follow();
}
class VM_ZMarkEndYoung : public VM_ZOperation {
class VM_ZMarkEndYoung : public VM_ZYoungOperation {
public:
virtual VMOp_Type type() const {
return VMOp_ZMarkEndYoung;
@ -785,7 +809,8 @@ void ZGenerationYoung::concurrent_select_relocation_set() {
select_relocation_set(_id, promote_all);
}
class VM_ZRelocateStartYoung : public VM_ZOperation {
class VM_ZRelocateStartYoung : public VM_ZYoungOperation {
public:
virtual VMOp_Type type() const {
return VMOp_ZRelocateStartYoung;
@ -1047,6 +1072,9 @@ void ZGenerationOld::concurrent_mark() {
class VM_ZMarkEndOld : public VM_ZOperation {
public:
VM_ZMarkEndOld()
: VM_ZOperation(ZDriver::major()->gc_cause()) {}
virtual VMOp_Type type() const {
return VMOp_ZMarkEndOld;
}
@ -1125,6 +1153,9 @@ void ZGenerationOld::concurrent_select_relocation_set() {
class VM_ZRelocateStartOld : public VM_ZOperation {
public:
VM_ZRelocateStartOld()
: VM_ZOperation(ZDriver::major()->gc_cause()) {}
virtual VMOp_Type type() const {
return VMOp_ZRelocateStartOld;
}

@ -238,6 +238,8 @@ class VM_HandshakeAllThreads: public VM_Operation {
public:
VM_HandshakeAllThreads(HandshakeOperation* op) : _op(op) {}
const char* cause() const { return _op->name(); }
bool evaluate_at_safepoint() const { return false; }
void doit() {

@ -174,6 +174,8 @@ class VM_Operation : public StackObj {
assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type");
return _names[type];
}
// Extra information about what triggered this operation.
virtual const char* cause() const { return nullptr; }
#ifndef PRODUCT
void print_on(outputStream* st) const { print_on_error(st); }
#endif

@ -407,7 +407,14 @@ void VMThread::inner_execute(VM_Operation* op) {
_cur_vm_operation = op;
HandleMark hm(VMThread::vm_thread());
EventMarkVMOperation em("Executing %sVM operation: %s", prev_vm_operation != nullptr ? "nested " : "", op->name());
const char* const cause = op->cause();
EventMarkVMOperation em("Executing %sVM operation: %s%s%s%s",
prev_vm_operation != nullptr ? "nested " : "",
op->name(),
cause != nullptr ? " (" : "",
cause != nullptr ? cause : "",
cause != nullptr ? ")" : "");
log_debug(vmthread)("Evaluating %s %s VM operation: %s",
prev_vm_operation != nullptr ? "nested" : "",