Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0004f1b
threading: `Semaphore` and `Channel` keep their state in a `Guarded`
claude Oct 29, 2026
4f928f3
threading: `Task::from_node` is a cast, and `Batch::pop` reads its ow…
claude Oct 29, 2026
daed865
threading: `IntrusiveWorkTask` and `OwnedTask` are safe traits
claude Oct 29, 2026
650cee1
alloc: `secure_zero` takes `&mut [u8]`
claude Oct 29, 2026
9500c26
collections: drop `VecExt::from_bump_slice` and `VecExt::writable_slice`
claude Oct 29, 2026
3aad198
sema: the stand-ins that ignore their arguments are safe `extern "C" …
claude Oct 29, 2026
0f38b7e
alloc, opaque: remove dead code that carried `unsafe`
claude Oct 29, 2026
dbddc13
alloc: `WTFStringImplStruct::m_ref_count` is an `AtomicU32`
claude Oct 29, 2026
ebf7030
alloc: `Mutex::lock` returns a guard that borrows the mutex
claude Oct 29, 2026
eaccd7a
alloc: use the reference `MaybeUninit::write` returns, and index a ch…
claude Oct 29, 2026
61b1ec6
alloc: `Zone::init` takes `&'static CStr`
claude Oct 29, 2026
d0d863b
threading: a worker's `Thread` is only ever borrowed shared
claude Oct 29, 2026
039a118
threading: `Bun__lock` takes `&ReleaseImpl`
claude Oct 29, 2026
4180b96
ptr: `DebugData::deinit` takes `&self`
claude Oct 29, 2026
fcab46d
sql: `PostgresSQLConnection::drop` zeroes `options_buf` with `secure_…
claude Oct 29, 2026
12efe51
bundler: `zig__ModuleInfoDeserialized__deinit` takes the `Box` that i…
claude Oct 29, 2026
63f26c1
transpiler: `print_with_source_map` takes `Option<&mut ModuleInfo>`
claude Oct 29, 2026
b580702
bundler: five `unsafe` blocks that plain borrows replace
claude Oct 29, 2026
ae5fd67
bundler: `BundleThread::enqueue` takes `&self`; `generation` is a loc…
claude Oct 29, 2026
8fe8818
bundler: `enqueue_entry_points_dev_server` borrows the transpiler whe…
claude Oct 29, 2026
b1147c9
bundler: `process_html_import_files` borrows four fields of the parse…
claude Oct 29, 2026
e85108d
transpiler: `Linker` takes what it reads as parameters instead of poi…
claude Oct 29, 2026
11e2338
transpiler: `Transpiler::init` builds its value with a struct literal
claude Oct 29, 2026
1e028bb
bundler: three worker contexts that only read the linker hold `&Linke…
claude Oct 29, 2026
a3dff79
bundler: `LinkerContext::load` and `link` take the fields they use, n…
claude Oct 29, 2026
052ab80
bundler: the back-pointers of the tasks name the bundle's lifetime
claude Oct 29, 2026
5c2f91b
threading: `ThreadPool::each_ptr` hands each task a `&mut V`
claude Oct 29, 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
7 changes: 0 additions & 7 deletions mordant-baseline.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@
"bool_cluster:src/lint/estree/schema.rs" = 1
"bool_cluster:src/lint/linter/config/flat.rs" = 1

[bun_opaque]
"unused_pub:src/opaque/lib.rs" = 2

[bun_parsers]
"generic_body_not_generic:src/parsers/xml.rs" = 1
"parallel_vecs:src/parsers/xml.rs" = 1
Expand Down Expand Up @@ -237,10 +234,6 @@
[bun_text_diff]
"generic_body_not_generic:src/text_diff/lib.rs" = 3

[bun_threading]
"unsafe_send_covers_more_than_pointers:src/threading/Semaphore.rs" = 1
"unsafe_send_covers_more_than_pointers:src/threading/channel.rs" = 1

[bun_uws_sys]
"unused_pub:src/uws_sys/Loop.rs" = 2

Expand Down
2 changes: 1 addition & 1 deletion src/brotli/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use c::BrotliDecoder;

#[allow(non_snake_case)]
pub mod BrotliAllocator {
bun_alloc::c_thunks_for_zone!("brotli");
bun_alloc::c_thunks_for_zone!(c"brotli");
pub use malloc_size as alloc;
}

Expand Down
90 changes: 0 additions & 90 deletions src/bun_alloc/MaxHeapAllocator.rs

This file was deleted.

5 changes: 1 addition & 4 deletions src/bun_alloc/ast_alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,7 @@ impl AstAlloc {
v
}

/// Move `items` element-wise into a fresh AST-heap allocation. Replaces
/// both `VecExt::from_owned_slice` (`Box<[T]>` → `Vec`) and
/// `VecExt::from_bump_slice` (leaked `&mut [T]` → `Vec`): in either case
/// the source storage is on the wrong heap, so a copy is unavoidable.
/// Moves the items of `iter` into a fresh AST-heap allocation.
#[inline]
pub fn vec_from_iter<T, I: IntoIterator<Item = T>>(iter: I) -> AstVec<T> {
let iter = iter.into_iter();
Expand Down
21 changes: 7 additions & 14 deletions src/bun_alloc/heap_breakdown.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::ffi::{CStr, c_void};
#[cfg(target_os = "macos")]
use core::ffi::c_uint;
use core::ffi::{c_char, c_void};
use core::ffi::{c_char, c_uint};

#[cfg(target_os = "macos")]
#[allow(non_camel_case_types)]
Expand All @@ -25,29 +25,22 @@ bun_opaque::opaque_ffi! {
// SAFETY: `malloc_zone_t` is internally synchronized by libmalloc; sharing
// `&Zone` across threads is the documented usage.
unsafe impl Sync for Zone {}
// SAFETY: `Zone` is an opaque libmalloc handle with no thread-affine state; the
// zone API is callable from any thread, so transferring the handle is sound.
unsafe impl Send for Zone {}

impl Zone {
/// # Safety
/// `name` must point to a NUL-terminated C string that remains valid for
/// the entire process lifetime — `malloc_set_zone_name` stores the pointer
/// (does not copy).
/// `'static`: `malloc_set_zone_name` may keep the pointer instead of copying.
#[cfg(target_os = "macos")]
pub unsafe fn init(name: *const c_char) -> &'static Zone {
pub fn init(name: &'static CStr) -> &'static Zone {
// SAFETY: malloc_create_zone is safe to call with (0, 0); returns a
// process-lifetime zone pointer. Caller guarantees `name` outlives the
// process-lifetime zone pointer. `name` is NUL-terminated and outlives the
// process.
unsafe {
let zone = malloc_create_zone(0, 0);
malloc_set_zone_name(zone, name);
malloc_set_zone_name(zone, name.as_ptr());
Comment thread
dylan-conway marked this conversation as resolved.
Resolved
&*zone
}
}
#[cfg(not(target_os = "macos"))]
#[allow(clippy::missing_safety_doc)]
pub unsafe fn init(_name: *const c_char) -> &'static Zone {
pub fn init(_name: &'static CStr) -> &'static Zone {
unreachable!("heap_breakdown is macOS-only; guard call sites on ENABLED")
}

Expand Down
Loading
Loading