RFR: 8260198: TypeInstPtr::dump2() emits multiple lines if Verbose is set [v4]
Evgeny Astigeevich
github.com+42899633+eastig at openjdk.java.net
Wed Feb 17 12:09:42 UTC 2021
On Sun, 14 Feb 2021 05:44:51 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 with a new target base due to a merge or a rebase. The pull request now contains five commits:
>
> - 8260198: TypeInstPtr::dump2() emits multiple lines if Verbose is set
>
> reimplement this feature. withdraw my intrusive change in outputStream.
> use stringStream only for the constant OopPtr. after oop->print_on(st),
> delete all appearances of '\n'
> - Merge branch 'master' into JDK-8260198
> - 8260198: TypeInstPtr::dump2() emits multiple lines if Verbose is set
>
> fix merge conflict.
> - Merge branch 'master' into JDK-8260198
> - 8260198: TypeInstPtr::dump2() emits multiple lines if Verbose is set
>
> 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 *
Changes requested by eastig at github.com (no known OpenJDK username).
src/hotspot/share/opto/type.cpp line 4049:
> 4047: ss.print(" ");
> 4048: const_oop()->print_oop(&ss);
> 4049: ss.tr_delete('\n');
`tr_delete` is expensive. Also deleting something in a stream does not fit into a concept of streams.
I see that the content of `ss` is traversed many times.
What about this code:
for (const char *str = ss.base(); *str; ) {
size_t i = 0;
while (str[i] && str[i] != '\n' ) {
++i;
}
st->print_raw(str, i);
str += i;
while (*str == '\n') {
++str;
}
}
-------------
PR: https://git.openjdk.java.net/jdk/pull/2178
More information about the hotspot-dev
mailing list