RFR: 8308252: Refactor line-by-line file reading code [v3]
Ioi Lam
iklam at openjdk.org
Tue May 23 07:02:50 UTC 2023
On Tue, 23 May 2023 06:50:23 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> So now this is not just a refactoring it is a re-implementation, so now I have to try and understand the reading logic and can't just treat it as known good code. :(
>
> I can revert to the getc version and implement the fgets version in a separate RFE. I agree that keeping the logic unchanged in refactoring will make things more manageable.
>
> getc is buffered I/O, so there shouldn't be much difference in performance when compared to fgets. And the code affected by this PR doesn't care too much about I/O performance.
By the way, I think I should take out the handling of _max_buffer_length, which I actually haven't implemented. I don't know what the failure mode should be when the line width is longer than the specified max, and I don't want to write any test case when the max is set to a small number like 256.
So let's keep the existing 2x expansion and crash when OOM (which is the same as the numerous sites that use GrowableArray).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14025#discussion_r1201634709
More information about the hotspot-dev
mailing list