RFR: 8303942: os::write should write completely [v5]

Markus Grönlund mgronlun at openjdk.org
Mon May 8 12:12:28 UTC 2023


On Mon, 8 May 2023 11:11:26 GMT, Afshin Zafari <duke at openjdk.org> wrote:

>> `os::write` is implemented using loops until the whole bytes are written. All uses of `os::write` in a loop are changed to single call. 
>> Platform dependent versions of the `os::write` are also renamed and moved to private sections accordingly.
>> Wrong uses/interpretations of return values from `os::write` in JFR code are corrected.
>> 
>> ###Test
>> local: hotspot tier1
>> mach5: tiers 1-5
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8303942: os::write should write completely

src/hotspot/share/jfr/writers/jfrStreamWriterHost.inline.hpp line 77:

> 75: inline void StreamWriterHost<Adapter, AP>::write_bytes(const u1* buf, intptr_t len) {
> 76:   assert(len >= 0, "invariant");
> 77:   const unsigned int nBytes = len > INT_MAX ? INT_MAX : (unsigned int)len;

Does this not mean data loss, if you are removing the while loop? Only one write attempt is made, INT_MAX which is 2147483647. But the len parameter is intptr_t?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13750#discussion_r1187365738


More information about the hotspot-dev mailing list