RFR: 8260198: TypeInstPtr::dump2() emits multiple lines if Verbose is set

Xin Liu xliu at openjdk.java.net
Sun Feb 14 05:53:40 UTC 2021


On Thu, 28 Jan 2021 18:03:43 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> The result your are trying to achieve is good, but I'm not sure pushing supress_cr into outputstream is the right thing. I would like to just not emit the cr's instead - but do also I see that isn't simple, because adding an extra bool to print_on would cascade into the entire codebase.
>
> @neliasso  Thanks for reviewing this. 
> Exactly.  The first reason is I am not familiar with oops/ codebase.  I guess some clients expect to see multiple lines. The second reason is that there are [many places](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/oops/klass.cpp#L783). I am not sure I can clean them up completely.  
> 
> That's why I modify outputStream and give it a 'suppress_cr' mode.  May I ask hotspot-dev's advice?  /cc hotspot-dev

I reimplement this feature using streamStream.

After change, a ConP of an Constant OopPtr  becomes a one-liner. eg. 
279  ConP  ===  0  [[ 1105 ]]   Oop:java/lang/String java.lang.String {0x000000010100e3d0} - klass: public final synchronized 'java/lang/String' - string: "":Constant:exact *
please note that I keep "Oop:java/lang/String".  It's the output   klass()->print_name_on(st);
The remaining part "java.lang.String {0x000000010100e3d0} - klass: public final synchronized 'java/lang/String' - string: "":Constant:exact *" is the output of oop->print_on(st).  because it's output with `:+Verbose`, I think it's okay to have a bit verbose.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2178


More information about the hotspot-dev mailing list