Skip to content

init: the detached tld's holes_floor_kept is an atomic - #51

Merged
Jarred-Sumner merged 1 commit into
bun-dev3-v2from
claude/tld-detached-atomic-init
Sep 15, 2026
Merged

Jarred-Sumner merged 1 commit into
bun-dev3-v2from
claude/tld-detached-atomic-init

Conversation

@Jarred-Sumner

Copy link
Copy Markdown
Collaborator

mi_tld_detached's static initializer gave the new _Atomic(size_t) holes_floor_kept (#50) a plain 0. A C++ compiler that implements _Atomic(T) as std::atomic<T> rejects that (deleted copy constructor), so an embedder that compiles static.c with -x c++ (clang-cl, MSVC headers) fails at init.c:136. It is MI_ATOMIC_VAR_INIT(0) now, like the struct's other atomics.

Checked with clang++ -x c++ -fsyntax-only -I include src/static.c: one error without the change, none with it.

A C++ compiler that implements _Atomic(size_t) as std::atomic<size_t> rejects a plain 0 for it in mi_tld_detached's
initializer (the copy constructor is deleted): an embedder that compiles static.c with -x c++ stopped there.
MI_ATOMIC_VAR_INIT(0), as the other atomics of the struct have.
@Jarred-Sumner
Jarred-Sumner merged commit 2014682 into bun-dev3-v2 Sep 15, 2026
23 checks passed
Jarred-Sumner added a commit to oven-sh/bun that referenced this pull request Sep 15, 2026
…is initialised as one)

The Windows lanes compile mimalloc's static.c as C++14, where a plain 0 for an _Atomic(size_t) member of a static
initializer needs std::atomic's deleted copy constructor. The fork's head has it as MI_ATOMIC_VAR_INIT(0).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant