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

Tobias Hartmann thartmann at openjdk.java.net
Wed Feb 24 06:56:41 UTC 2021


On Tue, 23 Feb 2021 23:12:56 GMT, Xin Liu <xliu 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 *
>
> Xin Liu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8260198: TypeInstPtr::dump2() emits multiple lines if Verbose is set
>   
>   use the existing api StringUtils::replace_no_expand to archive the same replace.
>   don't need to invoke os::strdup because stringStream::as_string() has duplicated
>   the internal buffer.

Changes requested by thartmann (Reviewer).

src/hotspot/share/opto/type.cpp line 4052:

> 4050: 
> 4051:       {
> 4052:         ResourceMark rm;

Shouldn't the `ResourceMark` go to before `stringStream ss` which is a `ResourceObj` as well? Also, please add a small comment explaining that this code suppresses the new line emitted by `print_oop`.

src/hotspot/share/opto/type.cpp line 4040:

> 4038: // Dump oop Type
> 4039: #ifndef PRODUCT
> 4040: void TypeInstPtr::dump2( Dict &d, uint depth, outputStream* st ) const {

While you are at it, please also remove the excess whitespace after `(` and before `)`.

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

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


More information about the hotspot-compiler-dev mailing list