Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
720b4b3
PipeReader: keep the outer read loop's scratch claim when a nested re…
robobun Aug 15, 2026
b34f8d0
PipeReader: make the per-loop read scratch a claim on its owner
Jarred-Sumner Aug 15, 2026
281ac60
PipeReadScratch: thin Option<Box<[_; N]>> instead of a boxed slice
Jarred-Sumner Aug 15, 2026
944b574
PipeReadScratch: guard holds raw pointers, zeroed buffer
Jarred-Sumner Aug 15, 2026
3433c6a
readFile: cap the pre-stat read at max_size
Jarred-Sumner Aug 15, 2026
a8fb11f
PipeReadScratch: interior-mutable state so a refused nested claim nev…
Jarred-Sumner Aug 15, 2026
76845dd
PipeReadScratch: guard is a shared borrow of the owner
Jarred-Sumner Aug 15, 2026
48c2d44
html-rewriter test: pace the locked-reader test by its reads, not set…
Jarred-Sumner Aug 15, 2026
8587b96
VirtualMachine: project the pipe-read scratch through a raw RareData …
Jarred-Sumner Aug 15, 2026
3ba5cdd
PipeReader: one read loop that tells consumers who owns each chunk
Jarred-Sumner Aug 15, 2026
465f179
PipeReader: keep the uv buffer range check type-checked in release
Jarred-Sumner Aug 15, 2026
e424871
PipeReader: close before delivering the final chunk so a nested pull …
Jarred-Sumner Aug 15, 2026
ed8135e
shell-pipe-read-fault: the read loop now delivers the bytes read befo…
Jarred-Sumner Aug 15, 2026
46a521f
PipeReader: read_into reports Progress on a hung-up pipe until the 0-…
Jarred-Sumner Aug 15, 2026
da7fe6d
restore bun.lock
Jarred-Sumner Aug 15, 2026
a3a8bae
[autofix.ci] apply automated fixes
autofix-ci[bot] Aug 15, 2026
626627b
Hold, don't adopt, a bufferless typed array pinned for a threadpool o…
Jarred-Sumner Aug 15, 2026
f7b9e5b
native ReadableStream pull: size the slab to what the source delivers
Jarred-Sumner Aug 15, 2026
9bc9e86
pin: report what was pinned instead of tracking held views in a table
Jarred-Sumner Aug 15, 2026
ec3c707
[autofix.ci] apply automated fixes
autofix-ci[bot] Aug 15, 2026
4d732b6
tests: pin contract is per storage kind now; pull chunks are right-si…
Jarred-Sumner Aug 15, 2026
a095452
FileReader (Windows): stop the completion-driven reader at the highwa…
Jarred-Sumner Aug 15, 2026
6d64efb
html-rewriter test: allow the one in-flight completion on Windows in …
Jarred-Sumner Aug 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions src/event_loop/MiniEventLoop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ unsafe extern "Rust" {
}
// ────────────────────────────────────────────────────────────────────────────

const PIPE_READ_BUFFER_SIZE: usize = 256 * 1024;
pub type PipeReadBuffer = [u8; PIPE_READ_BUFFER_SIZE];

/// Intrusive MPSC queue over `AnyTaskWithExtraContext` linked via its `.next` field.
type ConcurrentTaskQueue = UnboundedQueue<AnyTaskWithExtraContext>;

Expand Down Expand Up @@ -82,7 +79,7 @@ pub struct MiniEventLoop {
// Opaque ctx assigned externally; only read/cleared here.
pub(crate) after_event_loop_callback_ctx: Option<NonNull<c_void>>,
pub(crate) after_event_loop_callback: Option<unsafe extern "C" fn(*mut c_void)>,
pub pipe_read_buffer: Option<Box<PipeReadBuffer>>,
pub pipe_read_scratch: Box<bun_io::PipeReadScratch>,
}

thread_local! {
Expand Down Expand Up @@ -215,14 +212,6 @@ impl MiniEventLoop {
self.env
}

pub fn pipe_read_buffer(&mut self) -> &mut [u8] {
// `boxed_zeroed` avoids the 256 KiB stack temporary `Box::new([0u8; N])`
// would create in debug builds.
&mut self
.pipe_read_buffer
.get_or_insert_with(bun_core::boxed_zeroed::<PipeReadBuffer>)[..]
}

pub fn on_after_event_loop(&mut self) {
if let Some(cb) = self.after_event_loop_callback {
let ctx = self.after_event_loop_callback_ctx;
Expand Down Expand Up @@ -277,7 +266,7 @@ impl MiniEventLoop {
top_level_dir: Box::default(),
after_event_loop_callback_ctx: None,
after_event_loop_callback: None,
pipe_read_buffer: None,
pipe_read_scratch: Box::new(bun_io::PipeReadScratch::new()),
}
}

Expand Down Expand Up @@ -438,7 +427,7 @@ bun_io::link_impl_EventLoopCtx! {
(*this).after_event_loop_callback = cb;
(*this).after_event_loop_callback_ctx = ctx;
},
pipe_read_buffer() => core::ptr::from_mut::<[u8]>((*this).pipe_read_buffer()),
pipe_read_scratch() => &raw const *(*this).pipe_read_scratch,
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/event_loop/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ pub use ConcurrentTask::{Task, TaskTag, Taskable, task_tag};
// the type/module namespace collision on the PascalCase form.
pub use DeferredTaskQueue as deferred_task_queue;

pub use MiniEventLoop::PipeReadBuffer;
pub use any_event_loop::{
AnyEventLoop, EventLoopHandle, EventLoopTask, JsPoster, JsPosterVTable, Posted,
};
pub use bun_io::PipeReadScratch;

// JS-event-loop arm of `AnyEventLoop` / `EventLoopHandle`. `bun_event_loop` is
// a lower tier than `bun_jsc`, so it cannot name `jsc::EventLoop` /
Expand All @@ -50,7 +50,6 @@ bun_dispatch::link_interface! {
fn file_polls() -> *mut bun_io::file_poll::Store;
fn put_file_poll(poll: *mut bun_io::FilePoll, was_ever_registered: bool);
fn uws_loop() -> *mut bun_uws::Loop;
fn pipe_read_buffer() -> *mut [u8];
fn tick();
fn auto_tick();
fn auto_tick_active();
Expand Down
2 changes: 1 addition & 1 deletion src/install/PackageManager/security_scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ impl<'a> Drop for SecurityScanSubprocess<'a> {
bun_io::impl_buffered_reader_parent! {
SecurityScan for SecurityScanSubprocess<'a>;
has_on_read_chunk = true;
on_read_chunk = |this, chunk, has_more| (*this).on_read_chunk(chunk, has_more);
on_read_chunk = |this, chunk, has_more| (*this).on_read_chunk(&chunk, has_more);
on_reader_done = |this| (*this).on_reader_done();
on_reader_error = |this, err| (*this).on_reader_error(err);
loop_ = |this| (*this).loop_();
Expand Down
Loading
Loading