RFR: 8251464: make Node::dump(int depth) support indent

Liu, Xin xxinliu at amazon.com
Sat Sep 26 07:08:25 UTC 2020


hi, Andrew, 

I remake this patch and publish it on github. 
https://github.com/openjdk/jdk/pull/371

Indeed, the previous output was a little messy. The problem was that I calculated _indent wrong in breadth-first traversal.
Fixed in this revision. now it's strictly BFS order. 
https://bugs.openjdk.java.net/secure/attachment/90395/root.log   

This feature is intended to dump a small portion of ideal graph in the debugger. In that scenario, I think indentation does help my eyes.

Thank you to share your experiences. yes, I tried it(sort -n file) and this tip is incredibly effective!
The ordered nodes can help people to catch what they are looking for quickly.
  
I don't want to break anybody's established workflow, so I reset the flag PrintIdealIndentThreshold to 0.
It means node.dump won't use any indentation until we set it. 
https://openjdk.github.io/cr/?repo=jdk&pr=371&range=00#udiff-0

You guys must have some fancy gdb scripts, emacs lisp plugin or handy shell scripts etc.  
The only downside is they are personal arsenal and it may be not easy to maintain them sometime. 
On the other side of spectrum, starters like me need to bootstrap in long way.  Sometimes, we need to reinvent the wheel. 
eg. I spent a lot of time to develop a function to query a node by idx. I finished it but eventually came across this handy function in node.cpp.  that's what I did!

// Call this from debugger with root node as default:
Node* find_node(const int idx) {
  return Compile::current()->root()->find(idx);
}

That's why I'd like to put some debug functionalities to c2 codebase.  I think we can collect those handy functions in an individual file.  
What do you think? I have another 2 candidates I plan to work on. 
1. dump all node and sorted them by indices 
2. dump a path from node a to node b.  We can have a depth-first search along du or ud chains. 

thanks,
--lx





________________________________________
From: Andrew Dinn <adinn at redhat.com>
Sent: Friday, September 4, 2020 2:27 AM
To: Tobias Hartmann; Liu, Xin; 'hotspot-compiler-dev at openjdk.java.net'
Subject: RE: [EXTERNAL] RFR: 8251464: make Node::dump(int depth) support indent

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.



Hi Tobias/Xin

On 04/09/2020 10:09, Tobias Hartmann wrote:
> thanks for making these changes. That looks good to me.
> But lets wait for some more opinions from other reviewers.
I'll start by noting that this is not a review, merely user feedback.

I use node dumps a lot when debugging C2 and, looking at the supplied
example, I don't find the indentation helpful -- in fact, I actually
find it slightly disrupts my reading the graph.

Also, most of the time I feed graph dumps through a sort process so that
nodes end up listed in id order, making it easier to track chains of
links in both directions. That re-ordering makes the indentation much
less useful.

Of course, this is only a report of my way of working. I'm not against
the patch per se, so long as it is easy to disable indentation (or have
emacs remove it).

regards,


Andrew Dinn
-----------
Red Hat Distinguished Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill



More information about the hotspot-compiler-dev mailing list