8372273: C2: Extend the refactoring for IGV printing to include rest of the node properties

Reviewed-by: chagedorn, snatarajan
This commit is contained in:
Michael Reeves 2026-03-09 09:10:19 +00:00 committed by Christian Hagedorn
parent e22c95cd96
commit 321bf3f1fa

View File

@ -40,16 +40,60 @@ class PrintProperties
{
private:
IdealGraphPrinter* _printer;
void print_alias_properties(Node* node);
void print_escape_properties(Node* node);
public:
PrintProperties(IdealGraphPrinter* printer) : _printer(printer) {}
void print_node_properties(Node* node);
void print_node_details(Node* node);
void print_lrg_properties(const LRG& lrg, const char* buffer);
void print_property(int flag, const char* name);
void print_property(int flag, const char* name, const char* val);
void print_property(int flag, const char* name, int val);
};
void PrintProperties::print_alias_properties(Node* node) {
const TypePtr* adr_type = node->adr_type();
Compile* C = _printer->C;
if (adr_type != nullptr && C->have_alias_type(adr_type)) {
Compile::AliasType* at = C->alias_type(adr_type);
if (at != nullptr) {
print_property(true, "alias_index", at->index());
// The value of at->field(), if present, is already dumped in the
// "source"/"destination" properties.
const Type* element = at->element();
if (element != nullptr) {
stringStream element_stream;
element->dump_on(&element_stream);
print_property(true, "alias_element", element_stream.freeze());
}
print_property(at->is_rewritable(), "alias_is_rewritable");
print_property(at->is_volatile(), "alias_is_volatile");
print_property(at->general_index() != at->index(), "alias_general_index", at->general_index());
}
}
}
void PrintProperties::print_escape_properties(Node* node) {
// Dump escape analysis state for relevant nodes.
if (node->is_Allocate()) {
AllocateNode* alloc = node->as_Allocate();
print_property(alloc->_is_scalar_replaceable, "is_scalar_replaceable");
print_property(alloc->_is_non_escaping, "is_non_escaping");
print_property(alloc->does_not_escape_thread(), "does_not_escape_thread");
}
if (node->is_SafePoint() && node->as_SafePoint()->has_ea_local_in_scope()) {
print_property(true, "has_ea_local_in_scope");
}
if (node->is_CallJava() && node->as_CallJava()->arg_escape()) {
print_property(true, "arg_escape");
}
if (node->is_Initialize() && node->as_Initialize()->does_not_escape()) {
print_property(true, "does_not_escape");
}
}
void PrintProperties::print_node_properties(Node* node) {
const jushort flags = node->flags();
print_property((flags & Node::Flag_is_Copy), "is_copy");
@ -75,6 +119,15 @@ void PrintProperties::print_node_properties(Node* node) {
}
}
void PrintProperties::print_node_details(Node* node) {
print_alias_properties(node);
print_escape_properties(node);
print_property(node->is_block_proj() != nullptr, "is_block_proj");
print_property(node->is_block_start(), "is_block_start");
}
void PrintProperties::print_lrg_properties(const LRG &lrg, const char *buffer) {
print_property(true, "mask", buffer);
print_property(true, "mask_size", lrg.mask_size());
@ -651,61 +704,7 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) {
assert(s2.size() < sizeof(buffer), "size in range");
print_prop("dump_spec", buffer);
const TypePtr* adr_type = node->adr_type();
if (adr_type != nullptr && C->have_alias_type(adr_type)) {
Compile::AliasType* at = C->alias_type(adr_type);
if (at != nullptr) {
print_prop("alias_index", at->index());
// The value of at->field(), if present, is already dumped in the
// "source"/"destination" properties.
const Type* element = at->element();
if (element != nullptr) {
stringStream element_stream;
element->dump_on(&element_stream);
print_prop("alias_element", element_stream.freeze());
}
if (at->is_rewritable()) {
print_prop("alias_is_rewritable", "true");
}
if (at->is_volatile()) {
print_prop("alias_is_volatile", "true");
}
if (at->general_index() != at->index()) {
print_prop("alias_general_index", at->general_index());
}
}
}
if (node->is_block_proj()) {
print_prop("is_block_proj", "true");
}
if (node->is_block_start()) {
print_prop("is_block_start", "true");
}
// Dump escape analysis state for relevant nodes.
if (node->is_Allocate()) {
AllocateNode* alloc = node->as_Allocate();
if (alloc->_is_scalar_replaceable) {
print_prop("is_scalar_replaceable", "true");
}
if (alloc->_is_non_escaping) {
print_prop("is_non_escaping", "true");
}
if (alloc->does_not_escape_thread()) {
print_prop("does_not_escape_thread", "true");
}
}
if (node->is_SafePoint() && node->as_SafePoint()->has_ea_local_in_scope()) {
print_prop("has_ea_local_in_scope", "true");
}
if (node->is_CallJava() && node->as_CallJava()->arg_escape()) {
print_prop("arg_escape", "true");
}
if (node->is_Initialize() && node->as_Initialize()->does_not_escape()) {
print_prop("does_not_escape", "true");
}
print_node.print_node_details(node);
const char *short_name = "short_name";
if (strcmp(node->Name(), "Parm") == 0 && node->as_Proj()->_con >= TypeFunc::Parms) {