RFR: 8330532: Improve line-oriented text parsing in HotSpot

Ioi Lam iklam at openjdk.org
Tue Apr 23 00:34:34 UTC 2024


On Mon, 22 Apr 2024 22:03:42 GMT, John R Rose <jrose at openjdk.org> wrote:

>> src/hotspot/share/utilities/istream.hpp line 108:
>> 
>>> 106:   void*  _must_free;    // unless null, a malloc pointer which we must free
>>> 107:   size_t _line_count;   // increasing non-resettable count of lines read
>>> 108:   char   _small_buffer[SMALL_SIZE];  // buffer for holding lines
>> 
>> maybe this should be called line_buffer instead?
>
> No, it’s the small buffer that is the initial estimate of the line buffer, which in general must grow by heap allocation.
> 
> (BTW, the presence of small_buffer is the reason your other suggestion about `set_input` is wrong; will explain there…)

I added comments:

  char   _small_buffer[SMALL_SIZE];  // stack-allocated buffer for holding lines;
                                     // will switch to C_HEAP allocation when necessary.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18833#discussion_r1575497542


More information about the hotspot-dev mailing list