RFR: 8260198: TypeInstPtr::dump2() emits multiple lines if Verbose is set [v8]
    Xin Liu 
    xliu at openjdk.java.net
       
    Thu Feb 25 08:43:41 UTC 2021
    
    
  
On Wed, 24 Feb 2021 11:10:46 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
>>   
>>   add comments and hoist ResourceMark
>
> test/hotspot/gtest/utilities/test_ostream.cpp line 66:
> 
>> 64: 
>> 65: static size_t count_char(const stringStream* ss, char ch) {
>> 66:   return count_char(ss->as_string(), ss->size(), ch);
> 
> Am I correct `std:count` is not allowed?
> No need to use `as_string`: `return count_char(ss->base(), ss->size(), ch);`
> Or as `stringStream` is always zero-terminated: `return count_char(ss->base(), ch);`
I don't think STL is allowed. 
Make sense. ss->as_string() is not necessary. 
I don't like the idea we assume ss is always zero-terminated like C-string. There is a member variable _written in class stringStream.  Technically speaking, the implementation can avoid from writing '\0' in the end.  that's why I would like to use len argument.  For me, `count_char(ss->base(), ss->size(), ch)` is more reliable because it depends on interfaces instead of implementation.  an interface is supposed to be more stable than implementation.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2178
    
    
More information about the hotspot-compiler-dev
mailing list