Remove dead code from C++ bindings, bindgen glue, ast, and orphaned scripts - #37149
Remove dead code from C++ bindings, bindgen glue, ast, and orphaned scripts#37149robobun wants to merge 2 commits into
Conversation
WalkthroughThis pull request removes obsolete scripts, Rust and C++ APIs, WebCore stubs, DOMJIT headers, crypto helpers, runtime hooks, and global-object members. It adds source-lint checks that prevent selected deleted paths and symbols from returning. ChangesRepository cleanup
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
…cripts Every deleted symbol was verified to have zero references across src/, scripts/, packages/, and freshly regenerated build/debug/codegen/ output, then validated with a full debug build and cargo check on all 10 CI target triples. C++ (src/jsc/bindings): - ncrypto.cpp/h: 33 uncalled methods from the ncrypto port (bytesToKey, FIPS toggles, secure-heap helpers, X509 time/usages getters, unused AES CTR/GCM/KW factories, BIO/Bignum constructors) plus the 5 named Digest factories (MD5/SHA1/SHA256/SHA384/SHA512) orphaned by the bytesToKey removal; only Digest::FromName has callers - DOMJIT IDL helper headers (DOMJITIDLTypeFilter.h, DOMJITIDLType.h, DOMJITIDLConvert.h, DOMJITHelpers.h/.cpp): zero instantiations of any template they define; include sites now pull FrameTracers.h directly where JITOperationPrologueCallFrameTracer is used - 13 empty stub files (MessagePortChannel*, MessagePortIdentifier.h, BroadcastChannelRegistry.h, JSDOMConvertSerializedScriptValue.h, JSDOMBuiltinConstructorBase.*) kept by an earlier cleanup only for its own verification mechanics - ZigGlobalObject.h: 20 accessors with zero callers (8 *SinkPrototype() getters, worldIsNormal, bunStdin/bunStderr/bunStdout, KeyObjectStructure, JSBufferStructure, JSCryptoKeyStructure, builtinInternalFunctions, performMicrotaskVariadicFunction, globalProxyStructure, and the definition-less clearDOMGuardedObjects declaration) - BunString isCrossThreadShareable, NodeValidator validateArrayBufferView, JSDOMConvertBase convertResult, JSDOMConvertSequences reserveEstimated, EventNames isGamepadEventType (declaration with no definition), ExceptionDetails EnumTraits, ResourceTiming overrideInitiatorType, WebSocket hasNativeCallbacks, PerformanceObserverCallback hasCallback (never-invoked virtual pair), ScriptExecutionContext isDocument/ isWorkerGlobalScope - io_darwin.cpp: io_darwin_close_machport (both cfg arms); unlike its siblings it has no Rust-side declaration and no caller anywhere Rust: - jsc/bindgen.rs: BindgenOptionalRepr trait, BindgenOptionalCustom, BindgenExternalShared and their impls; the bindgen codegen emitters never name them. Also the Optional::adopt helper this orphaned. - runtime/timer/WTFTimer.rs: WTFTimer__runIfImminent; WebKit's RunLoopBun.cpp declares and force-links only the six other hooks - ast/binding.rs: BindingInit trait and Binding::init; all construction goes through Binding::alloc or literal struct init - ast/runtime.rs: write-only ImportsIteratorEntry.value field and two commented-out leftover fields - runtime/webcore.rs: two unused flat re-exports - ini/lib.rs: commented-out Zig code from the port Scripts (invoker .github/workflows/labeled.yml.disabled was deleted in #36778, or superseded): - label-issue.ts, read-issue.ts, handle-crash-patterns.ts, is-outdated.ts, associate-issue-with-sentry.ts - nav2readme.ts (imports docs/nav, deleted in #24201; cannot run) - buildkite-slow-tests.js (superseded by ci:slowest and update-test-durations) - check-node.sh, check-node-all.sh (superseded by bun run node:test) A source-lint test pins the removed symbols so they do not drift back.
5ac671c to
69a9823
Compare
- ncrypto DataPointer: drop the secure_ field, the bool secure ctor parameters, and the unreachable OPENSSL_secure_clear_free branch in reset(); SecureAlloc was the only site that ever passed secure=true - ZigGlobalObject: drop the orphaned backing fields of the removed accessors (m_cachedGlobalProxyStructure, m_JSCryptoKey, m_performMicrotaskVariadicFunction, m_worldIsNormal), their initLater closures and ctor initializers, and jsFunctionPerformMicrotaskVariadic, whose only reference was the removed initLater. CryptoKey wrappers use the DOM structure cache, not the lazy property. - fix two doc comments that still pointed at the deleted Binding::init
4cca497 to
15fddf0
Compare
|
Addressed the review in 15fddf0: completed the DataPointer secure_ cascade in ncrypto, removed the orphaned ZigGlobalObject backing fields plus their initLater closures and jsFunctionPerformMicrotaskVariadic, and fixed the two doc comments that still referenced the deleted Binding::init. Full build, all-triple cargo check, and crypto/webcrypto smoke tests pass after the change. PR is now net -2001 lines. |
Net -2001 lines. Every deleted symbol was verified to have zero references across
src/,scripts/,packages/, and freshly regeneratedbuild/debug/codegen/output (including.lut.htables,GeneratedJS2Native,$cpp/$newCppFunctionstring lookups, andsymbols.txt/.def/.dyn), then validated with a fullbun bdbuild andcargo checkon all 10 CI target triples. No file here is touched by any open dead-code PR (checked against #37089, #37062, #37012, #36237, #36115, #35880, #35775, #35437).C++ bindings
Cipher::bytesToKey/isCtrMode, the 9 unusedAES_{128,192,256}_{CTR,GCM,KW}factories (the CBC trio is live viaCipher::FromName),setFipsEnabled/testFipsEnabled, the secure-heap helpers (SecureAlloc,GetSecureHeapUsed,TryInitSecureHeap,isSecure),X509View::enumUsages/getValidFromTime/getValidToTime,EVPKeyCtxPointer::privateCheck/publicCheck/setRsaImplicitRejection/initForDerive/initForEncrypt,BignumPointer::NewPrime/NewSub/NewLShift/encodePadded/encodePaddedInto,BIOPointer::NewFile/NewSecMem/Printf,hashDigest,X509Pointer::ErrorReason,Ec::getCurve,EVPKeyPointer::derPublicKey,CryptoErrorList::peek_back, plus the private helpers (PortableTimeGM,days_from_epoch) and the 5 namedDigestfactories (MD5()..SHA512()) those removals orphaned; onlyDigest::FromNamehas callers. Review follow-up: also dropped thesecure_field, thebool secureconstructor parameters, and the now-unreachableOPENSSL_secure_clear_freebranch inreset()thatSecureAllocwas the sole producer for.DOMJITIDLTypeFilter.h,DOMJITIDLType.h,DOMJITIDLConvert.hdefine ~50 template specializations (IDLArgumentTypeFilter,IDLResultTypeFilter,IDLJSArgumentType,DirectConverter) with zero instantiations anywhere;DOMJITHelpers.hdeclares nothing andDOMJITHelpers.cppwas already an empty stub. Former includers (JSBuffer.cpp,JSPerformance.cpp, generatedZigGeneratedClasses.cpp) now include<JavaScriptCore/FrameTracers.h>directly forJITOperationPrologueCallFrameTracer, which they previously got transitively.MessagePortChannel*.{h,cpp},MessagePortIdentifier.h,BroadcastChannelRegistry.h,JSDOMConvertSerializedScriptValue.h,JSDOMBuiltinConstructorBase.{h,cpp}. Each contains only#pragma once/#include "config.h"and a comment saying it was kept for an earlier cleanup PR's verification mechanics and can be removed later. Nothing includes them.*SinkPrototype()getters (generatedJSSink.cppcalls only the*SinkStructure()variants),bunStdin()/bunStderr()/bunStdout()(callers use them_bunStdinmembers directly),worldIsNormal()/offsetOfWorldIsNormal(), andclearDOMGuardedObjects(), a declaration with no definition anywhere. Review follow-up: the orphaned backing fields (m_cachedGlobalProxyStructure,m_JSCryptoKey,m_performMicrotaskVariadicFunction,m_worldIsNormal), theirinitLaterclosures and ctor initializers, andjsFunctionPerformMicrotaskVariadic(whose only reference was the removedinitLater) are gone too; CryptoKey wrappers use the DOM structure cache, not the lazy property.BunString::isCrossThreadShareable,NodeValidator::validateArrayBufferView,JSDOMConvertBase::convertResult, bothSequenceTraits::reserveEstimatedoverloads,EventNames::isGamepadEventType(declaration with no definition), theEnumTraits<ExceptionDetails::Type>specialization (isValidEnumhas zero hits in the tree),ResourceTiming::overrideInitiatorType,WebSocket::hasNativeCallbacks, the never-invokedhasCallbackvirtual pair onPerformanceObserverCallback,ScriptExecutionContext::isDocument/isWorkerGlobalScope, andio_darwin_close_machport(both cfg arms; unlikeio_darwin_create_machport/io_darwin_schedule_wakeupit has no Rust-side declaration and no caller).Rust
BindgenOptionalReprtrait,BindgenOptionalCustom,BindgenExternalShared, and their three impls form a closed cycle nothing outside the file references; the bindgen codegen emitters (src/codegen/bindgenv2/) never emit these names. Removing them orphanedstrong::Optional::adopt, which the workspacedead_code = denylint then flagged; removed as well.WTFTimer__runIfImminent(#[no_mangle]). Verified againstvendor/: WebKit'sRunLoopBun.cppdeclares andWebKitCompilerFlags.cmakeforce-links only the six otherWTFTimer__*hooks.BindingInittrait, its 4 impls, andBinding::init; all binding construction goes throughBinding::allocor literal struct init.ImportsIteratorEntry.valuefield (the only iterator consumer reads.key) and two commented-out Zig-era fields.DOMExceptionCode,web_worker) no consumer uses; everything spells thebun_jsc::path directly.Orphaned scripts (-927, 9 files)
Their only invoker,
.github/workflows/labeled.yml.disabled, was deleted in #36778 ("disabled Nov 2025, never ran here"):label-issue.ts,read-issue.ts,handle-crash-patterns.ts,is-outdated.ts,associate-issue-with-sentry.ts. Plusnav2readme.ts(importsdocs/nav, deleted in #24201, so it cannot even load),buildkite-slow-tests.js(superseded bybun run ci:slowestand the wiredupdate-test-durationspipeline), andcheck-node.sh/check-node-all.sh(superseded bybun run node:test).Verification
bun bdfull debug build passes;bun run rust:check-allpasses on all 10 triples (10 ok, 0 failed).test/js/node/crypto/crypto-oneshot.test.ts,crypto-sign-regression.test.ts,test/js/web/timers/performance-entries.test.ts,test/js/bun/sqlite/sqlite.test.js,test/cli/install/npmrc.test.ts(179 tests, 0 fail), plus the fulltest/internal/source-lints/suite.test/internal/source-lints/dead-symbols-cpp-scripts-bindgen.test.tspins the removed symbols and deleted files so they do not drift back, following the pattern of earlier sweeps.Verified-dead but deliberately left for follow-up
scripts/clippy-loop/(984 LOC, zero refs) andscripts/find-dead-exports.ts(superseded by hawk): recent manual tooling, may still be invoked by hand.src/sql/mysql/protocol/ColumnDefinition41.rs: 12 reference-deadColumnFlagsconsts that double as wire-protocol documentation.ci-rust-only/ci-link-onlybuild profiles and theirci.tsbranches: unreachable from CI since the rust+link lane merge, but still valid manual entry points.[review] gate passed · iteration 0 · 61 files touched
fails on main (without fix)
passes on PR (with fix)
diff hotspot
gate history · 2 passed · 0 rejected · iteration 0
evidence per changed file