Skip to content

[pull] master from ruby:master - #1423

Merged
pull[bot] merged 5 commits into
turkdevops:masterfrom
ruby:master
Sep 18, 2026
Merged

pull[bot] merged 5 commits into
turkdevops:masterfrom
ruby:master

Conversation

@pull

@pull pull Bot commented Sep 18, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

When a stream is in sync mode (`sync == true`), writes go straight to the
operating system and Ruby's write buffer is not authoritative. Any bytes
left in the write buffer are therefore the result of writes made while
sync was disabled.

Previously `#close` always flushed the write buffer, replaying those
bytes. After an interrupted write - for example a buffered write
cancelled by a fiber scheduler - the number of bytes actually written is
indeterminate, so replaying the buffer on close can duplicate or corrupt
data on a stream.

Gate the finalize flush on sync mode, so that:

    io.sync = true
    io.close # discards the pending write buffer instead of replaying it

provides a supported way to abandon buffered output. Call `flush` before
enabling sync if the buffered data should still be sent.

Sync-mode streams (including transcoding streams, which write converted
bytes directly) do not rely on the finalize flush, so normal sync usage
is unaffected.

Assisted-By: devx/2c064143-8655-4631-a7cd-6395bb241bdc
GCC was emitting a warning, because it couldn't understand that
`search->needles_count` was assumed not to be 0:

```
string.c:9673:36: warning: ‘matches’ may be used uninitialized [-Wmaybe-uninitialized]
 9673 |                 const int bitmap = _mm_movemask_epi8(matches[0]);
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
string.c: In function ‘tr_trans_pairs’:
string.c:9664:25: note: ‘matches’ declared here
 9664 |                 __m128i matches[TR_TRANS_PAIRS_SIMD_MAX_NEEDLES];
      |
```

Instead of adding some useless initialization (41c9fdd)
we can try copying the loop upper bound into a `const` so that the compiler
can understand it's never 0;
Making `RBIMPL_ASSERT_OR_ASSUME(needles_count > 0);` redundant.
Ruby and CPU heap doesn't make any sense when using the NoGC plan.

ruby/mmtk@85f97bb0d9
@pull pull Bot locked and limited conversation to collaborators Sep 18, 2026
@pull pull Bot added the ⤵️ pull label Sep 18, 2026
@pull
pull Bot merged commit 85611dc into turkdevops:master Sep 18, 2026
1 of 3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants