Skip to content

Remove dead code from libtcc1.c, four C++ preprocessor conditions, JSPropertyIterator, and hawk.toml - #44126

Open
robobun wants to merge 2 commits into
mainfrom
robobun/f3e42052/dead-code-sweep
Open

robobun wants to merge 2 commits into
mainfrom
robobun/f3e42052/dead-code-sweep

Conversation

@robobun

@robobun robobun commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Behaviour change: none

Problem

  • 8 files hold code that no Bun build can reach: preprocessor branches behind constant conditions, one unused trait impl, and hawk.toml entries for removed enum variants.
  • No tool reports them. C and C++ have no lint for a branch that build flags make constant. rustc exempts trait impls from dead_code.

Fix

  • src/runtime/ffi/libtcc1.c: remove the #ifndef __x86_64__ block (380 lines) and the #else arm of an #if 1.
  • C++: remove the #else branches of USE(BUN_MIMALLOC) and ENABLE(REMOTE_INSPECTOR), the PLATFORM(WIN) branches of JSURLPattern.cpp, and the LAZY_LOAD_SQLITE fallbacks.
  • Rust and data: remove impl IntoIterObject for NonNull<JSObject> and 7 hawk.toml overrides for variants that build: link the Rust crates' rlibs directly; no libbun_runtime.a #43650 removed.
  • Verified: bun bd, cargo check in 19 configurations, cargo clippy, and the suites in Notes. Self-reviewed: 9 concerns raised, 9 addressed.

Background

  • TinyCC is the C compiler behind bun:ffi. Bun embeds libtcc1.c, and TinyCC compiles it on x86_64 only, where it defines __x86_64__. The embedded file shrinks from 14,454 to 6,869 bytes.
  • scripts/build/flags.ts defines USE_BUN_MIMALLOC=1 and LAZY_LOAD_SQLITE for every C++ file. WebKit's JSCOnly port sets every PLATFORM(X) to 0.
  • Considered: delete all 347 Rust items that the Linux link drops. cargo check needs 337 of them on other targets, in tests, or in generated code.

Downsides

  • None found. Checked each removed name with git grep -w over sources, tests and generated code. Trial merges with the 80 open pull requests that can touch the same files add no conflict.
Notes

Rebase on 2026-10-18

The branch is rebased onto main at 5667cd6. One file had a conflict, BunJSCModule.h: #44171 added a check at the start of functionStartRemoteDebugger. The check stays and runs first. Each removal was checked again on the new main: the evidence table below, bun bd, the 19 configurations, cargo clippy, the six test files, and the trial merges.

The sections from "Taken out" to the end describe main at 36cd151 (2026-09-26), the commit of the scan. For the items under "Taken out", the state of each named pull request and the presence of each item on main were checked again on 2026-10-18. The scan was not run again.

Evidence per removal

Item Evidence
libtcc1.c lines 109-488, #ifndef __x86_64__ The file has one user: include_bytes!("libtcc1.c") in src/runtime/ffi/ffi_body.rs, inside #[cfg(target_arch = "x86_64")]. TinyCC defines __x86_64__ for that target (vendor/tinycc/x86_64-gen.c:121). Nothing calls undefine_symbol. The block ends in #error unsupported CPU type for every CPU except i386. No name that the block defines has a use after it.
libtcc1.c #if 1 / #else The #else arm of a literal #if 1.
MimallocWTFMalloc.h, 7 #else / #elif arms scripts/build/flags.ts has USE_BUN_MIMALLOC=1 with no when. In compile_commands.json 705 of Bun's 706 own files carry the define. The other one is sqlite3.c, which does not include the header. The include of wtf/PlatformOS.h goes too: its only user was the !OS(WINDOWS) arm.
JSSQLStatement.h, NodeSqlite.cpp: #ifndef LAZY_LOAD_SQLITE flags.ts defines LAZY_LOAD_SQLITE=0 when staticSqlite and =1 when not. LAZY_LOAD_SQLITE_DEFAULT_SETTING has 4 hits, all in the removed lines.
JSURLPattern.cpp: #if PLATFORM(WIN) flags.ts defines BUILDING_JSCONLY__ for every file. wtf/PlatformLegacy.h gives no PLATFORM() macro to that port. The enclosing ENABLE(BINDING_INTEGRITY) is off on Windows. #40525 and #42431 remove the same pattern from 13 sibling files.
BunJSCModule.h: ENABLE(REMOTE_INSPECTOR) BunDebugger.cpp has no preprocessor guard and derives from JSC::JSGlobalObjectDebuggable, which exists only with the flag on. So a build with the flag off does not compile. The #else branch and the two guards go.
impl IntoIterObject for NonNull<JSObject> The linker has no symbol for into_iter_object of this impl. Without it cargo check passes in all 19 configurations. The impls for *mut JSObject, &JSObject and &mut JSObject stay.
hawk.toml, 7 overrides ErrorKind in serialized_failure.rs has only the five BundlerLog* variants. #43650 removed the others. SSRKind no longer exists: #45461 removed the bake_response module.

The 19 configurations of cargo check

All 12 targets of scripts/build/rust.ts, the host with --all-targets, Linux, Windows and macOS with --cfg=bun_asan --cfg=bun_debug --cfg=socket_fault_injection, the same three in the release profile with --cfg=bun_codegen_embed, and bun_shim_impl with --features shim_standalone. Each one reports the same single warning as main. The three release configurations read the generated code of a release configure (build/release/codegen). The debug one holds bindings for bindgen_test, a module that exists only with debug_assertions (since #45104).

Tests run with the debug build, all pass

test/js/bun/ffi/cc.test.ts, test/js/bun/ffi/ffi.test.js, test/js/bun/sqlite/sqlite.test.js, test/js/node/sqlite/node-sqlite.test.ts, test/js/web/urlpattern/urlpattern.test.ts, test/js/bun/jsc/bun-jsc.test.ts. Run with --timeout 180000.

Taken out because an open pull request uses, removes, or is next to the item

Each of these has no user on main. A trial merge (git merge-tree) with the named pull request showed a new conflict, or its diff names the item.

Kept by an earlier decision

Related lines that stay

  • NEEDS_COMPILER_RT_FUNCTIONS (ffi_body.rs:2475): libtcc1.c does not read it, but C code that a user passes to cc() can.
  • USE(BUN_MIMALLOC) in bun_icu_malloc.cpp:6 and the define in flags.ts.
  • Two #if ENABLE(REMOTE_INSPECTOR) guards in ZigGlobalObject.cpp. They have no #else.

What was scanned

  • Rust, link level: the debug binary was linked a second time with --gc-sections. The linker drops 9,226 Rust function sections on Linux. 178 belong to hand-written functions that are not generic. With the generic and #[inline] functions that have no symbol at all, and 180 trait impls with no live method, this gives 347 candidates. Each was deleted on trial and put back when cargo check failed in one of the 19 configurations. 337 came back: most have a caller on Windows or macOS, some in release builds, tests, or generated code.
  • Rust, visibility: 1,839 pub items that no other crate names were changed to pub(crate) in a scratch tree, so that rustc's dead_code lint covers them. It reports 61 items. Each is a field or variant, is removed by an open pull request, or has a user on Windows or in tests.
  • C and C++ preprocessor: 7,082 branches in 1,351 files were evaluated for 12 targets and the build variants. 106 are dead in every build. Open pull requests remove 61 of them.
  • C and C++ without a linker symbol (inline functions, templates, fields, enumerators, macros, forward declarations) in src/jsc/bindings, packages/bun-uws and packages/bun-usockets: 20 small candidates in total. Open pull requests remove 153 items that the same scan finds.
  • Feature flags: the 14 literal flags of src/bun_core/feature_flags.rs all have readers. No cfg(feature) and no custom cfg is without a setter.
  • Cargo: no orphan crate, no orphan .rs file, no unused [workspace.dependencies] entry.
  • Commented-out code and #if 0: no #if 0 outside the SQLite amalgamation. Open pull requests remove every block of 6 lines or more.
  • Tables: all 346 rows of ErrorCode.ts, 178 names of BunBuiltinNames.h and 81 exports of internal-for-testing.ts were checked. 10 small candidates.

Probably dead, left alone on purpose

  • Survivors of the Rust trial: flush on ArrayBufferSink, FetchRequestBodySink, HTTPServerWritable and NetworkSink (the sink generator uses the name flush), host_fn_this_value and host_fn_setter (generate-classes.ts emits calls to them for class shapes that do not exist today).
  • HELP_CATCH_MEMORY_ISSUES: every reader guards a call of check_for_memory_corruption, which has an empty body. The doc comment calls it a placeholder until Graph.heap is a MimallocArena again.
  • Constants that follow from cfg!(target_family = "wasm") (IS_WASM, IS_BROWSER, IS_NATIVE, USE_SIMDUTF) and the branches behind them, about 127 lines. No wasm target exists. The removal is a refactor of about 30 call sites.
  • 13 literal true flags in feature_flags.rs and ENABLE in crash_handler. They are developer switches.
  • About 20 const generic parameters that get one value only (for example SILENT in get_latest_version, IS_SYNC in SpawnArgs::default, KIND_SET and DIR_FWD of the bit set iterators).
  • The resource timing classes (PerformanceResourceTiming, ResourceTiming, NetworkLoadMetrics, ServerTiming): no instance can exist, but the globals are public. This needs a decision.
  • SequenceTraits for std::array and two GenericSequenceConverter::convert overloads in JSDOMConvertSequences.h: never instantiated. They are surface of the bindings generator library.
  • 6 positional entries of the BuiltinName / BuiltinNamesMap mirror enums and macro(redirect): no user. Both enums must change in one step.
  • ERR_CRYPTO_INCOMPATIBLE_KEY, ERR_TLS_PROTOCOL_VERSION_CONFLICT, ERR_REDIS_INVALID_DATABASE and 5 message rows of $ERR_* intrinsics that no JS calls.
  • 188 prototypes in headers.h and 11 more headers for functions that only Rust calls.
  • Bun__signpost_emit with generated_perf_trace_events.h (macOS): no caller. A Rust comment describes it as not wired yet.
  • us_loop_integrate (empty function, Windows only), us_nq_settings_set_scid_len, us_nq_settings_set_delay_onclose, Http3ResponseData::onTimeout.
  • The _WIN32 and __PASE__ branches of src/jsc/bindings/libuv/uv.h. The directory is a copy of the libuv headers.
  • src/js_parser/benches/string_map_vs_hashmap.rs (800 lines) and [profile.release-profiling]: nothing runs them. They read as tools for a person.
  • #![feature(arbitrary_self_types_pointers)] in bun_alloc, adt_const_params in bun_core, generic_const_exprs in bun_shell_parser: no code seems to need them.
  • 11 hawk.toml overrides for NapiStatus variants: the enum is pub(crate) now.

no test proof · iteration 0 · the description declares no behaviour change, so there is no failing test to prove; the existing suite in CI is the check

@robobun

robobun commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator Author
Updated 3:05 AM PT - Oct 18th, 2026

❌ @robobun, your commit b9126de has 1 failures in Build #128182 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 44126

That installs a local version of the PR into your bun-44126 executable, so you can run:

bun-44126 --bun

@robobun

robobun commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Status: ready for review. Rebased onto main on 2026-10-18.

  • Scope: 518 lines removed in 8 files (src/runtime/ffi/libtcc1.c, MimallocWTFMalloc.h, JSSQLStatement.h, NodeSqlite.cpp, JSURLPattern.cpp, BunJSCModule.h, src/jsc/JSPropertyIterator.rs, hawk.toml). No behavior change.
  • Rebase: the branch is on main at 5667cd6. One file had a conflict, BunJSCModule.h. Add --disallow-code-generation-from-strings, with a strict level for every way a string becomes code #44171 added a check at the start of functionStartRemoteDebugger. The check stays and runs first.
  • How the dead code was found: a second link of the debug binary with --gc-sections, an evaluation of every preprocessor branch for the 12 targets, and git grep -w for each name over src, packages, scripts, test and build/debug/codegen.
  • Verification, done again after the rebase: each removal is still dead on the new main (the evidence table in the PR body). bun bd, cargo check in 19 configurations (12 targets, test targets, debug and release cfgs, the Windows shim), cargo clippy --workspace, and 6 test files with the debug build (1410 tests pass).
  • Tests: none added. The change only deletes code that no build compiles or calls, so no test can fail before it and pass after it.
  • Overlap: trial merges (git merge-tree) with the 80 open pull requests that can touch the same files add no conflict.
  • 12 items were taken out of the change because an open pull request uses, removes, or is next to them. The PR body names each one with the pull request.

Review of 2026-10-18:

  • Done in b9126de: MimallocWTFMalloc.h no longer includes wtf/PlatformOS.h. The only user of that include was the !OS(WINDOWS) arm that this PR removes. The OS() macros stay reachable through wtf/Assertions.h, which includes wtf/Platform.h.

One stale hawk.toml override stays on purpose: bake::dev_server::serialized_failure::ErrorKind::JsError (lines 455-461). Its variant is gone like the other six. The entry sits directly below a hunk of #40690, so a removal here adds a conflict to that pull request. No open pull request removes the entry. If a maintainer prefers it gone now, I add it to this PR.

The first review reports no actionable comments. Two lines of its walkthrough read as a behavior change. They are not:

  • JSURLPattern.cpp: the walkthrough says that Windows now uses the symbol _ZTVN7WebCore10URLPatternE. Windows compiles none of this block, before and after the change: ENABLE(BINDING_INTEGRITY) is off there (wtf/PlatformEnable.h has #if !defined(ENABLE_BINDING_INTEGRITY) && !OS(WINDOWS)). On the other platforms PLATFORM(WIN) is 0, so the compiler already took the branch that stays.
  • JSSQLStatement.h and NodeSqlite.cpp: the walkthrough describes a build that gives no value for LAZY_LOAD_SQLITE. Bun has no such build. scripts/build/flags.ts passes LAZY_LOAD_SQLITE=0 or LAZY_LOAD_SQLITE=1 to every C++ file of Bun.

To check: rg -n LAZY_LOAD_SQLITE scripts/build/flags.ts, and rg -n BINDING_INTEGRITY in wtf/PlatformEnable.h of the WebKit headers.

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: oven-sh/bun/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Essentials

Run ID: 7477abcd-fb6b-46d6-97e6-cfe488fa0e7c

📥 Commits

Reviewing files that changed from the base of the PR and between a4f1429 and 3ccf88e.

📒 Files selected for processing (8)
  • hawk.toml
  • src/jsc/JSPropertyIterator.rs
  • src/jsc/bindings/MimallocWTFMalloc.h
  • src/jsc/bindings/sqlite/JSSQLStatement.h
  • src/jsc/bindings/sqlite/NodeSqlite.cpp
  • src/jsc/bindings/webcore/JSURLPattern.cpp
  • src/jsc/modules/BunJSCModule.h
  • src/runtime/ffi/libtcc1.c
💤 Files with no reviewable changes (8)
  • src/jsc/JSPropertyIterator.rs
  • src/runtime/ffi/libtcc1.c
  • src/jsc/bindings/MimallocWTFMalloc.h
  • hawk.toml
  • src/jsc/bindings/webcore/JSURLPattern.cpp
  • src/jsc/bindings/sqlite/NodeSqlite.cpp
  • src/jsc/bindings/sqlite/JSSQLStatement.h
  • src/jsc/modules/BunJSCModule.h

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Walkthrough

This change removes conditional defaults, platform-specific implementations, and public-symbol expectations across several JavaScriptCore, SQLite, WebCore, and FFI components. It also makes MimallocMalloc use mimalloc for all listed allocation operations.

Changes

Public-symbol expectations

Layer / File(s) Summary
ErrorKind expectations
hawk.toml
Removes dead_public expectations for six ErrorKind variants. The JsError expectation remains.
SSRKind expectation
hawk.toml
Removes the dead_public expectation for SSRKind::Regular.

Iterator conversion

Layer / File(s) Summary
NonNull conversion
src/jsc/JSPropertyIterator.rs
Removes the IntoIterObject implementation for NonNull<JSObject>. Callers can still use raw mutable pointers and shared or mutable references.

Mimalloc allocation

Layer / File(s) Summary
Allocator operations
src/jsc/bindings/MimallocWTFMalloc.h
MimallocMalloc uses mimalloc for maximum alignment, allocation, zeroed allocation, aligned allocation, reallocation, and freeing.

SQLite loading macro

Layer / File(s) Summary
SQLite macro and header selection
src/jsc/bindings/sqlite/JSSQLStatement.h, src/jsc/bindings/sqlite/NodeSqlite.cpp
Removes the local LAZY_LOAD_SQLITE defaults. Without an externally supplied value, JSSQLStatement.h selects sqlite3_local.h; the NodeSqlite.cpp preprocessor condition evaluates an undefined macro as false.

URLPattern vtable verification

Layer / File(s) Summary
Vtable symbol selection
src/jsc/bindings/webcore/JSURLPattern.cpp
Removes the Windows-specific MSVC vtable symbol selection and warning pragma. Windows uses the _ZTVN7WebCore10URLPatternE symbol, and the pointer equality assertion remains.

Remote inspector startup

Layer / File(s) Summary
Unconditional server startup
src/jsc/modules/BunJSCModule.h
Includes RemoteInspectorServer.h unconditionally and removes the ENABLE(REMOTE_INSPECTOR) guard and disabled-build error path from functionStartRemoteDebugger.

libtcc1 implementations

Layer / File(s) Summary
Union layout and helper definitions
src/runtime/ffi/libtcc1.c
Retains the lower/upper union layout and removes integer division, modulo, shift helpers, and i386 FPU control variables from the file.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 3ccf8

No confirmed behavior or build regression remains from this change; it is ready for normal merge checks.

Pre-merge checks: Passed 4
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly identifies the primary dead-code removals across libtcc1.c, C++ preprocessor conditions, JSPropertyIterator, and hawk.toml. It is specific and related to the changeset.
Description check Passed The description explains the problem, fix, scope, rationale, risks, and verification steps. It does not use the exact template headings, but it provides the required information in equivalent sections…
Full details: Description check

Explanation

The description explains the problem, fix, scope, rationale, risks, and verification steps. It does not use the exact template headings, but it provides the required information in equivalent sections.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — pure dead-code removal, each deleted branch is unreachable under the flags the build script always passes.

What was reviewed:

  • Preprocessor arms: USE_BUN_MIMALLOC=1 has no when in scripts/build/flags.ts, LAZY_LOAD_SQLITE is always passed as 0 or 1 (no -Wundef in the flag table), and BunDebugger.cpp already hard-requires JSGlobalObjectDebuggable, so the ENABLE(REMOTE_INSPECTOR) fallback could never compile in.
  • libtcc1.c: the only consumer is include_bytes! under cfg(target_arch = "x86_64") in src/runtime/ffi/ffi_body.rs; no remaining reference to any removed symbol (__udivmoddi4, __ashldi3, __tcc_fpu_control, ...) anywhere in src/.
  • Rust/config: no NonNull<JSObject> is passed to JSPropertyIterator::init at any of the ~30 call sites; the seven hawk.toml variants no longer exist in ErrorKind/SSRKind.
  • JSURLPattern.cpp: the Itanium branch was already what a BUILDING_JSCONLY__ build selects, so Windows behaviour is unchanged; the 13 sibling bindings still carrying the PLATFORM(WIN) arm are called out in the description as handled elsewhere.
Extended reasoning...

The change deletes 519 lines across one embedded C file, five C++ files, one Rust file and hawk.toml, adding nothing. It touches no security-sensitive surface: the allocator header keeps calling the same mi_* functions it did at base (USE_BUN_MIMALLOC=1 is unconditional, including ASAN builds), and the sqlite/inspector/URLPattern edits only drop preprocessor arms. Every removed C/C++ arm is gated by a macro the build script fixes or that the rest of the tree already assumes, so any mistake would surface as a compile error in CI rather than a runtime change; the one runtime-embedded file (libtcc1.c) is only compiled on x86_64 where TinyCC predefines x86_64. No CODEOWNERS entry covers the changed paths and the timeline shows no outstanding objections, which decided approve over defer.

@robobun

robobun commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator Author

@robobun wake up!!

@Jarred-Sumner

Copy link
Copy Markdown
Collaborator

@robobun wake up!!

@robobun

robobun commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator Author

I am here. The PR is ready and waits for one approval.

  • CI: commit 3ccf88e passed in Buildkite build #121241. The GitHub lint jobs pass. claude-find-issues is red because its own tool stopped before it ran.
  • Merge state: no conflict. The branch is 0 commits behind main (a4f1429).
  • Reviews: no maintainer review yet. The merge is blocked on the required approval only.
  • Scope did not change: 8 files, 519 lines removed, no behavior change.

I did not push anything, because nothing needs a fix.

If you want something else from this PR, tell me which one:

  1. Leave it as it is and merge after review.
  2. Add the items that I held back. Each one waits for another open pull request (the list is in the Notes of the PR body), so I recommend to keep them out.
  3. Close it.

dylan-conway pushed a commit that referenced this pull request Oct 17, 2026
…ed (#45641)

Behaviour change: none

### Problem
- `test/bake/dev/react-response.test.ts` has a test that renders `typeof
Response.render` in a server component and expects `undefined`.
- #45461 deleted `bun:app` and its `Response` class. It also deleted the
parser rewrite that put that class in place of the global `Response`.
The assertion can fail only if that feature comes back.
- `REVIEW.md` line 56 says: "Do not add tests to check dead code stays
dead."

### Fix
- Remove the test (18 lines). No other file changes.
- Correct because no live code loses its test.
`test/bake/dev/request-cookies.test.ts` renders a React page with
`streaming = false` and `mode = "ssr"`.
- Verified: `bun bd test test/bake/dev/react-response.test.ts` on main
at f0c6cbc. 2 pass, 0 fail.

### Background
- `bun:app` was a built-in module. It exported a `Response` subclass for
Bake pages, with `Response.render()` and JSX bodies. The parser replaced
the global `Response` in each server-side module with that class.
- The test came with commit b958f25 of #45461, when `bun:app` still
existed. It proved that the parser no longer made the swap. Commit
e03e21f of the same PR deleted `bun:app`, and the test lost its
purpose.
- A [review
comment](#45461 (comment))
reported the test seven minutes after #45461 merged.
- Considered a replacement test for a page that returns a plain
`Response`, as the review comment proposed. Such a page answers 500
today, because React gets the `Response` as a child. That is an error,
not a behavior to keep.

<details><summary>Notes</summary>

- Probe for the last Background bullet, on a debug build of main at
f0c6cbc: a page that returns `new Response("plain text", { status:
201 })` answers 500. The error is "Only plain objects, and a few
built-ins, can be passed to Client Components from Server Components."
- After this change, `git grep -n "Response\.render\|bun:app"` finds
nothing in the tree.
- The same review reported the `hawk.toml` override for
`webcore::bake_response::SSRKind::Regular`. It is not in this PR. The
override was stale before #45461 (#43650 removed the variant), and
#44126 removes it.

</details>

<!-- robobun:evidence:begin -->

---

**[auto-merge]** gate passed · iteration 0 · 1 files touched

<details><summary>passes on PR (with fix)</summary>

```console
Test-only change.

Debug/ASAN (expected pass):
$ bun bd test 'test/bake/dev/react-response.test.ts'
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test test/bake/dev/react-response.test.ts
bun test v1.4.4 (367d939)

test/bake/dev/react-response.test.ts:
Dev server testing directory: /tmp/bun-dev-test-yqPS5A
bun add v1.4.4 (367d939)
Saved lockfile

installed react@0.0.0-experimental-603e6108-20241029
installed react-dom@0.0.0-experimental-603e6108-20241029
installed react-server-dom-bun@0.0.0-experimental-603e6108-20241029
installed react-refresh@0.0.0-experimental-603e6108-20241029

6 packages installed [167.00ms]
bun install v1.4.4 (367d939)

Checked 6 installs across 7 packages (no changes) [196.00ms]
�[0;30mdev|�[0m Started development server: http://localhost:33163
�[0;30mdev|�[0m �[32mBundled page in 1019ms�[0m�[2m:�[0m pages/index.tsx �[2m+ 2 more�[0m
�[0;30mdev|�[0m �[0m�[1m1 |�[0m �[0m�[35mexport�[0m �[0m�[35mconst�[0m streaming = �[0m�[33mfalse�[0m�[0m�[2m;�[0m
�[0;30mdev|�[0m �[0m�[1m2 |�[0m �[0m�[35mexport�[0m �[0m�[35mconst�[0m mode = �[0m�[32m"ssr"�[0m�[0m�[2m;�[0m
�[0;30mdev|�[0m �[0m�[1m3 |�[0m 
�[0;30mdev|�[0m �[0m�[1m4 |�[0m �[0m�[35mexport�[0m �[0m�[35mdefault�[0m �[0m�[35masync�[0m �[0m�[35mfunction�[0m IndexPage() {
�[0;30mdev|�[0m     �[39m�[1m^�[0m
�[0;30mdev|�[0m �[0m�[39merror�[0m�[2m:�[0m �[1mLMAO�[0m
�[0;30mdev|�[0m �[0m      �[2mat �[0mIndexPage�[2m (�[0m�[0m�[36m�[2m/tmp/bun-dev-test-yqPS5A/react-response1/�[0m�[36mpages/index.tsx�[0m�[2m:�[0m�[33m4�[0m�[2m:�[33m1�[0m�[2m)�[0m
�[0;30mdev|�[0m �[0m      �[2mat �[0mreact-stack-bottom-frame�[2m (�[0m�[0m�[36m�[2m/tmp/bun-dev-test-yqPS5A/react-response1/�[0m�[36mnode_modules/react-server-dom-bun/cjs/react-server-dom-webpack-server.node.unbundled.development.js�[0m�[2m:�[0m�[33m3971�[0m�[2m:�[33m15�[0m�[2m)�[0m
�[0;30mdev|�[0m �[0m      �[2mat �[0m�[0m�[36munknown�[0m�[2m:�[0m�[33m1�[0m�[2m:�[33m1�[0m
�[0;30mdev|�[0m �[0m      �[2mat �[0mrun�[2m (�[0m�[0m�[36mnode:async_hooks�[0m�[2m:�[0m�[33m226�[0m�[2m:�[33m29�[0m�[2m)�[0m
�[0;30mdev|�[0m �[0m  
... (truncated)
Exit: 0
```

</details>

<details><summary>diff hotspot</summary>

```
test/bake/dev/react-response.test.ts | 18 ------------------
 1 file changed, 18 deletions(-)
```

</details>

**gate history** · 1 passed · 0 rejected · iteration 0

<details><summary>evidence per changed file</summary>

```
file                                  reads  edits  tests
test/bake/dev/react-response.test.ts      1      1      9
```

</details>

<!-- robobun:evidence:end -->
@robobun
robobun force-pushed the robobun/f3e42052/dead-code-sweep branch from 3ccf88e to 090d01c Compare October 18, 2026 06:54

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Beyond the inline nit, I also checked that none of the symbols deleted from libtcc1.c (__udivmoddi4, __divdi3, __ashrdi3, etc.) are referenced anywhere else under src/, that the removed hawk.toml overrides point at variants that no longer exist (ErrorKind now has only the five BundlerLog* variants and the bake_response/SSRKind module is gone entirely), and that LAZY_LOAD_SQLITE is emitted as either =0 or =1 by scripts/build/flags.ts with no -Wundef, so dropping the in-header defaults cannot change which branch #if LAZY_LOAD_SQLITE takes.

Extended reasoning...

Pure deletion PR (517 lines removed, nothing added) across libtcc1.c, four C++ preprocessor sites, one Rust trait impl, and stale hawk.toml overrides; no security-sensitive surface. The one inline finding is a leftover include; the remaining risk is build-only (cfg-gated Rust and preprocessor-gated C++ cannot be type-checked here), which the author reports covering with 19 cargo check configurations.

Additional findings (outside the current diff — GitHub can't attach inline comments there):

  • 🟡 src/jsc/bindings/MimallocWTFMalloc.h — nit: maintainers keep an include that this PR made dead. #include <wtf/PlatformOS.h> at src/jsc/bindings/MimallocWTFMalloc.h:7 existed only for the !OS(WINDOWS) branch of tryAlignedMalloc, which the diff removes; nothing else in the header uses an OS() macro. Fix: drop the include in the same PR that removed its last consumer (the header still gets ASSERT/CRASH from wtf/Assertions.h and ALWAYS_INLINE from wtf/Compiler.h).

    Why this was flagged

    The base branch's tryAlignedMalloc had an #elif !OS(WINDOWS) arm that needed the OS() macro from wtf/PlatformOS.h. The diff deletes that arm (src/jsc/bindings/MimallocWTFMalloc.h:66-72 now calls mi_malloc_aligned unconditionally), leaving no use of OS() anywhere in the header, but keeps the include at line 7. No runtime consequence; it is a leftover of the removed branch, contrary to the repository rule to delete dead code in the PR that makes it dead. No safeguard applies; it is a cleanliness nit.

    Verification: nit. Triggering condition: unconditional — the include is simply left without a consumer once this diff lands. The only OS() use in base src/jsc/bindings/MimallocWTFMalloc.h was line 85 #elif !OS(WINDOWS) inside tryAlignedMalloc; the diff removes that arm. After the change the header contains no OS( or USE( token at all, yet line 7 #include <wtf/PlatformOS.h> remains.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the current push (through b9126de) and found no bugs; since this is a 518-line deletion spanning the FFI runtime library, the WTF allocator shim, sqlite, URLPattern and the inspector entry point, a human look is still worthwhile before merging.

What was reviewed:

  • Confirmed each removed preprocessor branch is constant-false in every build: USE_BUN_MIMALLOC=1 and LAZY_LOAD_SQLITE=0|1 are in scripts/build/flags.ts defines, which scripts/build/bun.ts (line 241) passes to every C/C++ TU including the PCH; ENABLE_REMOTE_INSPECTOR: "ON" in scripts/build/deps/webkit.ts and BunDebugger.cpp already requires it unconditionally.
  • libtcc1.c: the only consumer is include_bytes! under #[cfg(target_arch = "x86_64")] in src/runtime/ffi/ffi_body.rs, and the deleted block #errors on anything but i386; nothing it defined is referenced by the kept functions or elsewhere in the repo.
  • Rust/data: no NonNull<JSObject> appears anywhere in the tree, and the removed hawk.toml overrides name ErrorKind variants that no longer exist and a bake_response module that no longer exists at all.
  • Noted that 13 sibling JS*.cpp files still carry the same PLATFORM(WIN) vtable branch; the description assigns those to other open PRs, which a human may want to confirm.
Extended reasoning...

The change is deletion-only across 8 files: constant-false preprocessor arms in MimallocWTFMalloc.h, JSSQLStatement.h/NodeSqlite.cpp, JSURLPattern.cpp and BunJSCModule.h, the non-x86_64 half of the embedded TinyCC runtime libtcc1.c, an unused trait impl in JSPropertyIterator.rs, and stale hawk.toml lint overrides. It touches no security-sensitive surface; the inspector function's reachable code path is unchanged and the allocator shim resolves to the same mi_* calls as before. I verified the build-flag and usage claims from scripts/build and the source tree rather than from the PR text, and found them accurate. Deferring rather than approving because the PR is bot-authored, large, touches the bun:ffi runtime library that user C code links against, and a maintainer comment from 2026-09-28 whose content I cannot see precedes the latest rewrite, so I cannot establish that no human concern is outstanding.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants