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

Andrew Dinn adinn at redhat.com
Mon Sep 28 09:07:49 UTC 2020


Hi Xin Liu,

On 26/09/2020 08:08, Liu, Xin wrote:
> 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.

Yes, I think it is most useful when dumping subgraphs at depths between
2 and, say, 5.

> 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.

Good. I'm glad sharing my working practice was useful to at least one
person :-)

> 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

That's very considerate of you. Thank you.

> 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,

I'm afraid I don't have a lot more to share. Mostly, I don't write
scripts. I usually just write the dump output to a file and then
process it with bash, sed and awk code written on the command line. I
have written extensive elisp search and formatting functions in the past
but not for parsing ideal graphs.

> 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); }

Well, now you have taught me something I didn't know in return. Thanks
for sharing ;-)

> 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.

Option 1 is easily achieved by writing the graph dump to file and
passing through sort -n so it's not a great step forward.

Option 2 sounds like it would be more useful. Initially I was wondering
what you would do when there are multiple paths. then I thought perhaps
the command ought to list all paths in some well-defined order? That
would make the case where the nodes are not connected uniform with the
cases where there is one or more path i.e. print 0 paths, 1 path, 2
paths etc

regards,


Andrew Dinn
-----------



More information about the hotspot-compiler-dev mailing list