Repository navigation
Conversation
Delete two functions under src/jsc/bindings whose last callers are gone: - Zig::toStringCopy(EncodedSlice, StringPointer) in helpers.h. #45461 removed its two callers in WebCore__FetchHeaders__createValueNotJS. - MimallocMalloc::alignedMalloc in MimallocWTFMalloc.h. #45104 removed its caller in Bindgen/ExternVectorTraits.h. The diff has deletions only: 2 files, 35 lines.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe change removes ChangesAligned allocation helper
Encoded slice conversion helper
Suggested reviewers: Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
|
Updated 11:53 AM PT - Oct 17th, 2026
✅ @robobun, your commit 9946129e08b5e245105f2b60bc83d9e8a192aafa passed in 🧪 To try this PR locally: bunx bun-pr 45548That installs a local version of the PR into your bun-45548 --bun |
|
Status: ready for review. How the two functions were shown to be dead:
|
There was a problem hiding this comment.
LGTM, straightforward dead-code removal.
What was reviewed:
MimallocMalloc::alignedMalloc: repo-wide grep finds no references;git show af5743d7confirms its only caller inBindgen/ExternVectorTraits.hwas dropped by #45104, and the surviving traits code nowstatic_assertsalignof(ExternElement) <= maxAlignrather than allocating over-aligned buffers.tryAlignedMalloc(still used bybun_icu_decompress.cpp) is untouched.- Two-argument
toStringCopy(EncodedSlice, StringPointer): a multiline grep across C++, codegen and Rust sources finds no call with a second argument; all 22 call sites use the one-argument overload that remains.StringPointeris still used elsewhere (bindings.cpp), so nothing is left orphaned. - Both symbols were header-inline statics with no
#if-gated references, so no platform-specific compile or link dependency is affected.
Extended reasoning...
The change deletes 35 lines from two headers in src/jsc/bindings: a crash-on-null aligned-malloc wrapper on the MimallocMalloc allocator policy, and a sub-slice overload of Zig::toStringCopy. It touches no security-sensitive surface and no tests, which is appropriate for a pure deletion. The deciding facts were that git history confirms the sole prior caller of alignedMalloc was removed in #45104, and repo-wide (including multiline) greps find no remaining caller of either removed function in C++, codegen, or Rust sources. The vendored WTF headers are not in this checkout, but the alignment members are Bun-local additions outside WTF's FastMalloc policy contract and the retained traits code no longer relies on them. CODEOWNERS does not cover the changed paths and there are no outstanding reviewer objections.
|
Two more deletions from a sweep of the same base (5866b5f) are in no open dead-code pull request, this one included. The patch is below, in case a maintainer wants them here and not in a pull request of their own.
Verified on 5866b5f with only these two hunks: The same sweep found three more things without a user on main. They stay, for the reasons that this PR already gives for the converters:
Patch (3 files, +4/-15)diff --git a/src/jsc/bindings/webcrypto/CryptoAlgorithmAES_CBC.h b/src/jsc/bindings/webcrypto/CryptoAlgorithmAES_CBC.h
index c4a5ad044a..c80d18cc01 100644
--- a/src/jsc/bindings/webcrypto/CryptoAlgorithmAES_CBC.h
+++ b/src/jsc/bindings/webcrypto/CryptoAlgorithmAES_CBC.h
@@ -36,18 +36,13 @@ class CryptoKeyAES;
class CryptoAlgorithmAES_CBC final : public CryptoAlgorithm {
public:
- enum class Padding : uint8_t {
- Yes,
- No
- };
-
static constexpr ASCIILiteral s_name = "AES-CBC"_s;
static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::AES_CBC;
static Ref<CryptoAlgorithm> create();
// Operations can be performed directly.
- WEBCORE_EXPORT static ExceptionOr<Vector<uint8_t>> platformEncrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&, Padding padding = Padding::Yes);
- WEBCORE_EXPORT static ExceptionOr<Vector<uint8_t>> platformDecrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&, Padding padding = Padding::Yes);
+ WEBCORE_EXPORT static ExceptionOr<Vector<uint8_t>> platformEncrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
+ WEBCORE_EXPORT static ExceptionOr<Vector<uint8_t>> platformDecrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
private:
CryptoAlgorithmAES_CBC() = default;
diff --git a/src/jsc/bindings/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp b/src/jsc/bindings/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp
index 793b97da88..3f88ec1a37 100644
--- a/src/jsc/bindings/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp
+++ b/src/jsc/bindings/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp
@@ -117,7 +117,7 @@ static std::optional<Vector<uint8_t>> cryptDecrypt(const Vector<uint8_t>& key, c
return plainText;
}
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformEncrypt(const CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText, Padding)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformEncrypt(const CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
{
auto output = cryptEncrypt(key.key(), parameters.ivVector(), Vector<uint8_t>(plainText));
if (!output)
@@ -125,7 +125,7 @@ ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformEncrypt(const Crypt
return WTF::move(*output);
}
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformDecrypt(const CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText, Padding)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformDecrypt(const CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
{
auto output = cryptDecrypt(key.key(), parameters.ivVector(), cipherText);
if (!output)
diff --git a/src/spawn/error.rs b/src/spawn/error.rs
index 233800d59f..7751d62b42 100644
--- a/src/spawn/error.rs
+++ b/src/spawn/error.rs
@@ -35,10 +35,4 @@ impl bun_core::output::ErrName for Error {
}
}
-impl From<bun_sys::Error> for Error {
- fn from(e: bun_sys::Error) -> Self {
- Self::Sys(e.into())
- }
-}
-
pub type Result<T, E = Error> = core::result::Result<T, E>; |
Problem
src/jsc/bindingshave no caller since this week.Zig::toStringCopy(EncodedSlice, StringPointer)(helpers.h:151): bake: drop React-specific behavior from core ("use server", --server-components, bun:app) #45461 deletedWebCore__FetchHeaders__createValueNotJS, which held its two calls.MimallocMalloc::alignedMalloc(MimallocWTFMalloc.h:71): One bindgen: replace bindgen v1 and v2, add classes, generate the Rust side #45104 deleted its one call, inBindgen/ExternVectorTraits.h.Fix
-O0build emits a symbol for every function it uses. Neither function has a symbol in any object of the debug build of main. The compiler does not report them: the build passes-Wno-unused-function.--gc-sectionslink keeps the same 1,415,903 symbols before and after, and drops the same functions.bun bd, and four test files on the debug build (293 pass, 0 fail, listed in Notes).Background
EncodedSliceis the pointer, length and encoding that Rust hands to C++, andStringPointeris a range inside it. The deleted overload copied that range into aWTF::String. The one-argument overload stays.MimallocMallocis the allocator type that Bun gives toWTF::Vector.tryAlignedMallocstays:bun_icu_decompress.cppcalls it.Downsides
git grepover the sources and the generated code. Also checked: the added lines of all 5599 open pull requests.Behaviour change: none
Notes
Method
build.ninjaagain with-Wl,--gc-sections -Wl,--print-gc-sections. The kept symbols plus the dropped.textsections are every function that any object defines.Zig::toStringCopy: the only symbol isZig::toStringCopy(EncodedSlice).MimallocMalloc: the only members with a symbol aremalloc,tryMalloc,free,nextCapacityandtryAlignedMalloc.git grep -wfinds no other mention ofalignedMalloc. It finds 24 calls oftoStringCopy, all with one argument.srcandpackages. The other 9 name neither function.Tests
--timeout 90000:test/js/web/fetch/headers.test.ts,test/js/web/fetch/fetch_headers.test.js,test/internal/bindgen.test.ts,test/js/web/web-globals.test.js. 293 pass, 0 fail.git grepfinds no use of either function,bun bdbuilds, and the same four files pass (314 pass, 0 fail).Self-review
Found without a user on main, but not deleted: an open pull request uses or rewrites it
A first version of this diff deleted 699 lines of WebIDL converter code. The scan of open pull requests showed that most of it has a user in flight, so those deletions are not here.
bun:dom) rewritesIDLTypes.hand everyJSDOMConvert*.h, and usestoJS<IDLLong>,toJS<IDLAtomStringAdaptor<IDLDOMString>>,toJS<IDLUnrestrictedDouble>,IDLByte,IDLShort,IDLLongLong,ExceptionOr<T&>,convertNewlyCreated,expectedEnumerationValuesand wrapper traits withneedsState = true.ExceptionThroweroverload of theIDLSequenceconverter.ExceptionOr<URLSearchParams&>.WebCore::IDLUnrestrictedDouble.throwArgumentMustBeEnumErrorhas no user on main or in an open pull request. bun:dom and the Vitest work in one tree (not for merging) #45415 inserts code on the line before it, so the deletion would conflict with that branch. It is left for later.Scanned and clean, or already claimed
.rsfile against the build's dep-info, Cargo features, and the functions that the--gc-sectionslink drops. Each candidate is a proc-macro entry point, has a user on another target, is in an open pull request, or is in themordantbaseline.tsc --noUnusedLocalsoversrc/js,src/codegen,src/runtime/bake,scriptsand six packages reports only unused parameters. No internal module has an export that nothing reads.clang -Wunused-function -Wunused-template -Wunused-macrosover 591 of 602 translation units (11 do not compile alone). Each finding has a user on another platform or is in an open pull request.Follow-up candidates, not in this diff
PerformanceResourceTiming::createandPerformanceServerTiming::createhave no caller, so no instance of either class can exist. About 800 lines inPerformanceResourceTiming.*,ResourceTiming.*,ServerTiming.*,ResourceLoadTiming.handNetworkLoadMetrics.honly serve those instances. The two constructors are globals, so this needs a decision, not a deletion."use server"module a parse error. Threetodo_panic!branches after the parser cannot be reached now (bundle_v2.rs3905 and 7863,p.rs8528).builtin:fields. No.classes.tsfile has one sinceGlobmoved toGlob.bind.ts.final: falseonResponseinresponse.classes.tswas forJSBakeResponse, which bake: drop React-specific behavior from core ("use server", --server-components, bun:app) #45461 deleted.SSL_set0_verify_cert_storeinsrc/boringssl_sys/boringssl.rslost its Rust caller in tls: consolidate the open TLS fixes (both engines, node:tls, node:https, WebSocket, SQL) #44618.abortedgetter of the internalNodeHTTPResponseclass lost its last reader in node:http: the server follows Node (request body, framing, response finish, lifecycle) #43557.