RFR: 8260198: TypeInstPtr::dump2() emits multiple lines if Verbose is set [v6]
Xin Liu
xliu at openjdk.java.net
Tue Feb 23 19:32:42 UTC 2021
On Tue, 23 Feb 2021 15:59:03 GMT, Evgeny Astigeevich <github.com+42899633+eastig at openjdk.org> wrote:
>> 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
>>
>> fix build failures on Windows. StringUtils::tr_delete returns size_of.
>
> src/hotspot/share/opto/type.cpp line 4056:
>
>> 4054: StringUtils::tr_delete(buf, "\n");
>> 4055: st->print_raw(buf);
>> 4056: os::free(buf);
>
> There is no need to use `os::strdup` because `as_string` creates a copy.
> I've looked in stringUtils.cpp and found `replace_no_expand`. The code can be rewritten:
> char *buf = ss.as_string();
> StringUtils::replace_no_expand(buf, "\n", "");
> st->print_raw(buf);
> With this code, `tr_delete` is redundant.
oh, thanks for the head-up. I'm happy to remove os::strdup and os::free pair.
it seems that replace_no_expand is cumbersome to do what tr_delete does. let me see how it works.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2178
More information about the hotspot-compiler-dev
mailing list