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

Xin Liu xliu at openjdk.java.net
Thu Jan 28 18:06:42 UTC 2021


On Mon, 25 Jan 2021 09:25:22 GMT, Nils Eliasson <neliasso at openjdk.org> wrote:

>> Add a flag _suppress_cr to outputStream. outstream objects won't emit any CR if it's set.
>> Correct TypeInstPtr::dump2 to make sure it only emits klass name once.
>> Remove the comment because Klass::oop_print_on() has emitted the address of oop.
>> 
>> Before:
>> 689  ConP  ===  0  [[ 821 ]]   Oop:java/lang/Stringjava.lang.String
>> {0x000000010159d7c8} - klass: public final synchronized 'java/lang/String'
>> - string: "a"
>> :Constant:exact *
>> 
>> After:
>> 689  ConP  ===  0  [[ 821 ]]   Oop:java.lang.String {0x000000010159d7c8} - klass: public final synchronized 'java/lang/String' - string: "a":Constant:exact *
>
> 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

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

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


More information about the hotspot-compiler-dev mailing list