RFR: 8293251: Use stringStream::base() instead of as_string() when applicable [v4]

Johan Sjölén duke at openjdk.org
Wed Sep 14 12:01:44 UTC 2022


On Mon, 12 Sep 2022 10:05:52 GMT, Johan Sjölén <duke at openjdk.org> wrote:

>> Hi!
>> 
>> Please review this PR swapping out stringStream::as_string() with ::base() when applicable. With this change we avoid allocating a resource managed string copy. I also attempt to document the base function, as it is not safe to use any result returned from it if you subsequently call the stringStream's methods.
>> 
>> When I've left ResourceMarks in place I've also commented which calls requires them.
>> 
>> This passes tier1, tier2 tests.
>
> Johan Sjölén has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove invariant tracking
>   
>   Too much depends on this invariant not being met.

Having a 2nd go at invariant tracking by introducing a new function `internal_string`.

I imagine that a future RFE would rename `base` to `raw_string` and that `as_string` is split into `heap_string` and `resource_string`. This would make the interface clearer, imho.

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

PR: https://git.openjdk.org/jdk/pull/10142


More information about the shenandoah-dev mailing list