diff --git a/src/bun_core/lib.rs b/src/bun_core/lib.rs index 1224fcfd0d42..cb1dad46de63 100644 --- a/src/bun_core/lib.rs +++ b/src/bun_core/lib.rs @@ -662,13 +662,6 @@ pub const unsafe fn container_of(field: *const F, offset: usize) -> *mut P unsafe { field.byte_sub(offset).cast::

().cast_mut() } } -/// `*const`-out variant of [`container_of`]. Same safety contract. -#[inline(always)] -pub const unsafe fn container_of_const(field: *const F, offset: usize) -> *const P { - // SAFETY: per fn contract. - unsafe { field.byte_sub(offset).cast::

() } -} - /// Recover a typed `&mut T` from a C-callback's opaque user-data pointer. /// /// This is the canonical spelling for the ubiquitous trampoline pattern where diff --git a/src/bun_core/string/immutable/unicode.rs b/src/bun_core/string/immutable/unicode.rs index e591bab46055..6901ec9fceb8 100644 --- a/src/bun_core/string/immutable/unicode.rs +++ b/src/bun_core/string/immutable/unicode.rs @@ -906,18 +906,6 @@ pub fn utf16_codepoint(input: &[u16]) -> UTF16Replacement { } } -/// `b"..."` for u8, `$crate::w!("...")` for u16. -/// New callers should use byte/wide literals directly. -#[macro_export] -macro_rules! literal { - (u8, $s:literal) => { - concat!($s, "\0").as_bytes() - }; - (u16, $s:literal) => { - $crate::w!($s) - }; -} - pub(super) use crate::strings_impl::push_codepoint_utf16; // `unreachable_pub`: these are re-exported externally via the parent's diff --git a/src/bun_core/string/mod.rs b/src/bun_core/string/mod.rs index e9e248ab711c..a01cfced60ee 100644 --- a/src/bun_core/string/mod.rs +++ b/src/bun_core/string/mod.rs @@ -9,10 +9,7 @@ //! Merged into `bun_core` to break the `bun_core ↔ bun_string` dep edge; //! the `bun_string` crate is now a thin re-export shim over this module. -// `#[macro_export]` macros defined in submodules (`w!`, `literal!`) land at -// the *crate* root (`bun_core::`). -// Re-export them here so `crate::string::w` / `bun_core::w` paths resolve. -pub use crate::{literal, w}; +pub use crate::w; #[path = "escapeRegExp.rs"] pub mod escape_reg_exp; diff --git a/src/http/ssl_config.rs b/src/http/ssl_config.rs index 3a6c9b56eda2..c6bea951364a 100644 --- a/src/http/ssl_config.rs +++ b/src/http/ssl_config.rs @@ -92,13 +92,6 @@ impl core::ops::Deref for SharedPtr { } } -impl From> for SharedPtr { - #[inline] - fn from(a: Arc) -> Self { - Self(a) - } -} - impl SSLConfig { pub(crate) const ZERO: SSLConfig = SSLConfig { server_name: core::ptr::null(), diff --git a/src/jsc/bindings/AsymmetricKeyValue.h b/src/jsc/bindings/AsymmetricKeyValue.h index 5869721c52d9..269a5999fa9f 100644 --- a/src/jsc/bindings/AsymmetricKeyValue.h +++ b/src/jsc/bindings/AsymmetricKeyValue.h @@ -18,7 +18,6 @@ class AsymmetricKeyValue { bool operator!() const { return !key; } ~AsymmetricKeyValue(); - AsymmetricKeyValue(EVP_PKEY* key, bool owned); AsymmetricKeyValue(CryptoKey&); }; diff --git a/src/jsc/bindings/BunHeapProfiler.cpp b/src/jsc/bindings/BunHeapProfiler.cpp index 2eadd8070e8d..c4a0647b7eba 100644 --- a/src/jsc/bindings/BunHeapProfiler.cpp +++ b/src/jsc/bindings/BunHeapProfiler.cpp @@ -1,5 +1,4 @@ #include "root.h" -#include "BunHeapProfiler.h" #include "headers-handwritten.h" #include #include @@ -111,7 +110,7 @@ static WTF::String formatBytes(size_t bytes) return sb.toString(); } -WTF::String generateHeapProfile(JSC::VM& vm) +static WTF::String generateHeapProfile(JSC::VM& vm) { vm.ensureHeapProfiler(); auto& heapProfiler = *vm.heapProfiler(); @@ -936,7 +935,7 @@ WTF::String generateHeapProfile(JSC::VM& vm) return output.toString(); } -WTF::String generateHeapSnapshotV8(JSC::VM& vm) +static WTF::String generateHeapSnapshotV8(JSC::VM& vm) { vm.ensureHeapProfiler(); auto& heapProfiler = *vm.heapProfiler(); diff --git a/src/jsc/bindings/BunHeapProfiler.h b/src/jsc/bindings/BunHeapProfiler.h deleted file mode 100644 index cb3035b53470..000000000000 --- a/src/jsc/bindings/BunHeapProfiler.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "root.h" -#include - -namespace JSC { -class VM; -} - -namespace Bun { - -// Generate a Claude-friendly text-based heap profile -// This format is designed specifically for analysis by LLMs with grep/sed/awk tools -// The output is hierarchical but with clear section markers for easy navigation -WTF::String generateHeapProfile(JSC::VM& vm); - -} // namespace Bun diff --git a/src/jsc/bindings/ErrorCode.cpp b/src/jsc/bindings/ErrorCode.cpp index b9fc1144b82d..12684ed4ecdb 100644 --- a/src/jsc/bindings/ErrorCode.cpp +++ b/src/jsc/bindings/ErrorCode.cpp @@ -1299,14 +1299,6 @@ JSC::EncodedJSValue CRYPTO_INVALID_KEYTYPE(JSC::ThrowScope& throwScope, JSC::JSG return {}; } -JSC::EncodedJSValue CRYPTO_INVALID_KEYTYPE(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject) -{ - auto message = "Invalid key type"_s; - throwScope.throwException(globalObject, createError(globalObject, ErrorCode::ERR_CRYPTO_INVALID_KEYTYPE, message)); - throwScope.release(); - return {}; -} - JSC::EncodedJSValue CRYPTO_UNKNOWN_CIPHER(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject, const WTF::StringView& cipherName) { // Node dropped the cipher name from the message (exact-match asserted by @@ -1549,14 +1541,6 @@ JSC::EncodedJSValue CRYPTO_HASH_UPDATE_FAILED(JSC::ThrowScope& throwScope, JSC:: return {}; } -JSC::EncodedJSValue CRYPTO_TIMING_SAFE_EQUAL_LENGTH(JSC::ThrowScope& scope, JSC::JSGlobalObject* globalObject) -{ - auto message = "Input buffers must have the same byte length"_s; - scope.throwException(globalObject, createError(globalObject, ErrorCode::ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH, message)); - scope.release(); - return {}; -} - JSC::EncodedJSValue CRYPTO_UNKNOWN_DH_GROUP(JSC::ThrowScope& scope, JSGlobalObject* globalObject) { auto message = "Unknown DH group"_s; @@ -1579,14 +1563,6 @@ JSC::EncodedJSValue MISSING_PASSPHRASE(JSC::ThrowScope& throwScope, JSC::JSGloba return {}; } -JSC::EncodedJSValue KEY_GENERATION_JOB_FAILED(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject) -{ - auto message = "Key generation job failed"_s; - throwScope.throwException(globalObject, createError(globalObject, ErrorCode::ERR_KEY_GENERATION_JOB_FAILED, message)); - throwScope.release(); - return {}; -} - JSC::EncodedJSValue INCOMPATIBLE_OPTION_PAIR(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject, ASCIILiteral opt1, ASCIILiteral opt2) { WTF::StringBuilder builder; @@ -1630,13 +1606,6 @@ JSC::EncodedJSValue INVALID_MIME_SYNTAX(JSC::ThrowScope& scope, JSC::JSGlobalObj return {}; } -EncodedJSValue CLOSED_MESSAGE_PORT(ThrowScope& scope, JSGlobalObject* globalObject) -{ - scope.throwException(globalObject, createError(globalObject, ErrorCode::ERR_CLOSED_MESSAGE_PORT, "Cannot send data on closed MessagePort"_s)); - scope.release(); - return {}; -} - JSC::EncodedJSValue INVALID_THIS(JSC::ThrowScope& scope, JSC::JSGlobalObject* globalObject, ASCIILiteral expectedType) { WTF::StringBuilder builder; diff --git a/src/jsc/bindings/ErrorCode.h b/src/jsc/bindings/ErrorCode.h index 61c87682caa6..850de5d68457 100644 --- a/src/jsc/bindings/ErrorCode.h +++ b/src/jsc/bindings/ErrorCode.h @@ -136,10 +136,8 @@ JSC::EncodedJSValue CRYPTO_INVALID_DIGEST(JSC::ThrowScope& throwScope, JSC::JSGl JSC::EncodedJSValue CRYPTO_HASH_FINALIZED(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject); JSC::EncodedJSValue CRYPTO_HASH_UPDATE_FAILED(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject); JSC::EncodedJSValue MISSING_PASSPHRASE(JSC::ThrowScope& throwScope, JSC::JSGlobalObject* globalObject, WTF::ASCIILiteral message); -JSC::EncodedJSValue CRYPTO_TIMING_SAFE_EQUAL_LENGTH(JSC::ThrowScope&, JSC::JSGlobalObject*); JSC::EncodedJSValue CRYPTO_UNKNOWN_DH_GROUP(JSC::ThrowScope&, JSC::JSGlobalObject*); JSC::EncodedJSValue CRYPTO_INVALID_KEYTYPE(JSC::ThrowScope&, JSC::JSGlobalObject*, WTF::ASCIILiteral message); -JSC::EncodedJSValue CRYPTO_INVALID_KEYTYPE(JSC::ThrowScope&, JSC::JSGlobalObject*); JSC::EncodedJSValue CRYPTO_UNKNOWN_CIPHER(JSC::ThrowScope&, JSC::JSGlobalObject*, const WTF::StringView& cipherName); JSC::EncodedJSValue CRYPTO_INVALID_AUTH_TAG(JSC::ThrowScope&, JSC::JSGlobalObject*, const WTF::String& message); JSC::EncodedJSValue CRYPTO_INVALID_IV(JSC::ThrowScope&, JSC::JSGlobalObject*); @@ -149,11 +147,9 @@ JSC::EncodedJSValue CRYPTO_INVALID_KEYLEN(JSC::ThrowScope&, JSC::JSGlobalObject* JSC::EncodedJSValue CRYPTO_INVALID_STATE(JSC::ThrowScope&, JSC::JSGlobalObject*, WTF::ASCIILiteral message); JSC::EncodedJSValue CRYPTO_INVALID_MESSAGELEN(JSC::ThrowScope&, JSC::JSGlobalObject*); JSC::EncodedJSValue OSSL_EVP_INVALID_DIGEST(JSC::ThrowScope&, JSC::JSGlobalObject*); -JSC::EncodedJSValue KEY_GENERATION_JOB_FAILED(JSC::ThrowScope&, JSC::JSGlobalObject*); JSC::EncodedJSValue INCOMPATIBLE_OPTION_PAIR(JSC::ThrowScope&, JSC::JSGlobalObject*, ASCIILiteral opt1, ASCIILiteral opt2); JSC::EncodedJSValue MISSING_OPTION(JSC::ThrowScope&, JSC::JSGlobalObject*, ASCIILiteral message); JSC::EncodedJSValue INVALID_MIME_SYNTAX(JSC::ThrowScope&, JSC::JSGlobalObject*, const String& part, const String& input, int position); -JSC::EncodedJSValue CLOSED_MESSAGE_PORT(JSC::ThrowScope&, JSC::JSGlobalObject*); JSC::EncodedJSValue INVALID_THIS(JSC::ThrowScope& scope, JSC::JSGlobalObject* globalObject, ASCIILiteral expectedType); JSC::EncodedJSValue DLOPEN_DISABLED(JSC::ThrowScope&, JSC::JSGlobalObject*, ASCIILiteral message); diff --git a/src/jsc/bindings/JSBufferList.cpp b/src/jsc/bindings/JSBufferList.cpp index a7a3ed9ac90b..11cc614b7eb6 100644 --- a/src/jsc/bindings/JSBufferList.cpp +++ b/src/jsc/bindings/JSBufferList.cpp @@ -462,9 +462,4 @@ void JSBufferListConstructor::initializeProperties(VM& vm, JSC::JSGlobalObject* const ClassInfo JSBufferListConstructor::s_info = { "BufferList"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSBufferListConstructor) }; -JSValue getBufferList(Zig::GlobalObject* globalObject) -{ - return static_cast(globalObject)->JSBufferList(); -} - } // namespace Zig diff --git a/src/jsc/bindings/JSBufferList.h b/src/jsc/bindings/JSBufferList.h index 635312f270e9..1c8e89ff121a 100644 --- a/src/jsc/bindings/JSBufferList.h +++ b/src/jsc/bindings/JSBufferList.h @@ -168,6 +168,4 @@ class JSBufferListConstructor final : public JSC::InternalFunction { void finishCreation(JSC::VM&, JSC::JSGlobalObject* globalObject, JSBufferListPrototype* prototype); }; -JSValue getBufferList(Zig::GlobalObject* globalObject); - } diff --git a/src/jsc/bindings/JSDOMWrapperCache.h b/src/jsc/bindings/JSDOMWrapperCache.h index 9a49a7126fc6..657938a92584 100644 --- a/src/jsc/bindings/JSDOMWrapperCache.h +++ b/src/jsc/bindings/JSDOMWrapperCache.h @@ -40,8 +40,7 @@ WEBCORE_EXPORT JSC::Structure* getCachedDOMStructure(const JSDOMGlobalObject&, c WEBCORE_EXPORT JSC::Structure* cacheDOMStructure(JSDOMGlobalObject&, JSC::Structure*, const JSC::ClassInfo*); template JSC::Structure* getDOMStructure(JSC::VM&, JSDOMGlobalObject&); -template JSC::Structure* deprecatedGetDOMStructure(JSC::JSGlobalObject*); -template JSC::JSObject* getDOMPrototype(JSC::VM&, JSC::JSGlobalObject*); +template JSC::JSObject* getDOMPrototype(JSC::VM&, JSDOMGlobalObject&); JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, JSC::ArrayBuffer*); void* wrapperKey(JSC::ArrayBuffer*); @@ -58,8 +57,6 @@ bool clearInlineCachedWrapper(DOMWrapperWorld&, void*, JSDOMObject*); bool clearInlineCachedWrapper(DOMWrapperWorld&, ScriptWrappable*, JSDOMObject* wrapper); bool clearInlineCachedWrapper(DOMWrapperWorld&, JSC::ArrayBuffer*, JSC::JSArrayBuffer* wrapper); -template JSC::JSObject* getOrCreateWrapper(DOMWrapperWorld&, DOMClass&); - template JSC::JSObject* getCachedWrapper(DOMWrapperWorld&, DOMClass&); template inline JSC::JSObject* getCachedWrapper(DOMWrapperWorld& world, Ref& object) { return getCachedWrapper(world, object.get()); } template void cacheWrapper(DOMWrapperWorld&, DOMClass*, WrapperClass*); @@ -67,7 +64,6 @@ template void uncacheWrapper(DOMWrappe template auto createWrapper(JSDOMGlobalObject*, Ref&&) -> typename std::enable_if::value, typename JSDOMWrapperConverterTraits::WrapperClass*>::type; template auto createWrapper(JSDOMGlobalObject*, Ref&&) -> typename std::enable_if::value, typename JSDOMWrapperConverterTraits::WrapperClass*>::type; -template JSC::JSValue wrap(JSC::JSGlobalObject*, DOMWrapperWorld&, DOMClass&); template JSC::JSValue wrap(JSC::JSGlobalObject*, JSDOMGlobalObject*, DOMClass&); // Inline functions and template definitions. @@ -87,12 +83,6 @@ template inline JSC::Structure* getDOMStructure(JSC::VM& return cacheDOMStructure(globalObject, WrapperClass::createStructure(vm, &globalObject, WrapperClass::createPrototype(vm, globalObject)), WrapperClass::info()); } -template inline JSC::Structure* deprecatedGetDOMStructure(JSC::JSGlobalObject* lexicalGlobalObject) -{ - // FIXME: This function is wrong. It uses the wrong global object for creating the prototype structure. - return getDOMStructure(JSC::getVM(lexicalGlobalObject), *deprecatedGlobalObjectForPrototype(lexicalGlobalObject)); -} - template inline JSC::JSObject* getDOMPrototype(JSC::VM& vm, JSDOMGlobalObject& globalObject) { return asObject(getDOMStructure(vm, globalObject)->storedPrototype()); diff --git a/src/jsc/bindings/JSMockFunction.h b/src/jsc/bindings/JSMockFunction.h index a22b8d960dc9..1200e289e2c5 100644 --- a/src/jsc/bindings/JSMockFunction.h +++ b/src/jsc/bindings/JSMockFunction.h @@ -59,7 +59,6 @@ class MockWithImplementationCleanupData : public JSC::JSInternalFieldObjectImpl< JS_EXPORT_PRIVATE static MockWithImplementationCleanupData* create(VM&, Structure*); static MockWithImplementationCleanupData* create(JSC::JSGlobalObject* globalObject, JSMockFunction* fn, JSValue impl, JSValue tail, JSValue fallback); - static MockWithImplementationCleanupData* createWithInitialValues(VM&, Structure*); static Structure* createStructure(VM&, JSGlobalObject*, JSValue); static std::array initialValues() diff --git a/src/jsc/bindings/JSNextTickQueue.h b/src/jsc/bindings/JSNextTickQueue.h index 63c75f6453fd..5237e9b3b77d 100644 --- a/src/jsc/bindings/JSNextTickQueue.h +++ b/src/jsc/bindings/JSNextTickQueue.h @@ -16,7 +16,6 @@ class JSNextTickQueue : public JSC::JSInternalFieldObjectImpl<3> { JS_EXPORT_PRIVATE static JSNextTickQueue* create(VM&, Structure*); static JSNextTickQueue* create(JSC::JSGlobalObject* globalObject); - static JSNextTickQueue* createWithInitialValues(VM&, Structure*); static Structure* createStructure(VM&, JSGlobalObject*, JSValue); static std::array initialValues() diff --git a/src/jsc/bindings/JSX509CertificateConstructor.cpp b/src/jsc/bindings/JSX509CertificateConstructor.cpp deleted file mode 100644 index 04b7fc1fb851..000000000000 --- a/src/jsc/bindings/JSX509CertificateConstructor.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "root.h" -#include "JSX509CertificateConstructor.h" -#include "JSX509Certificate.h" -#include "ZigGlobalObject.h" -#include - -namespace Bun { - -using namespace JSC; - -} // namespace Bun diff --git a/src/jsc/bindings/JSX509CertificateConstructor.h b/src/jsc/bindings/JSX509CertificateConstructor.h deleted file mode 100644 index ee740d0ee1a0..000000000000 --- a/src/jsc/bindings/JSX509CertificateConstructor.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "root.h" -#include -#include - -namespace Zig { -class GlobalObject; -} - -namespace Bun { - -using namespace JSC; - -} // namespace Bun diff --git a/src/jsc/bindings/ModuleLoader.h b/src/jsc/bindings/ModuleLoader.h index 5f8380c67242..c2a3d65ac588 100644 --- a/src/jsc/bindings/ModuleLoader.h +++ b/src/jsc/bindings/ModuleLoader.h @@ -68,7 +68,6 @@ class PendingVirtualModuleResult : public JSC::JSInternalFieldObjectImpl<3> { JS_EXPORT_PRIVATE static PendingVirtualModuleResult* create(VM&, Structure*); static PendingVirtualModuleResult* create(JSC::JSGlobalObject* globalObject, const WTF::String& specifier, const WTF::String& referrer, bool wasModuleMock); - static PendingVirtualModuleResult* createWithInitialValues(VM&, Structure*); static Structure* createStructure(VM&, JSGlobalObject*, JSValue); JSC::JSPromise* internalPromise(); diff --git a/src/ptr/lib.rs b/src/ptr/lib.rs index d67003b8700e..b428f457764c 100644 --- a/src/ptr/lib.rs +++ b/src/ptr/lib.rs @@ -59,8 +59,7 @@ pub use weak_ptr::WeakPtr; // (lowest tier, every crate can reach them); re-exported here so callers can // spell `bun_ptr::container_of` / `bun_ptr::from_field_ptr!`. pub use bun_core::{ - IntrusiveField, container_of, container_of_const, from_field_ptr, impl_field_parent, - intrusive_field, + IntrusiveField, container_of, from_field_ptr, impl_field_parent, intrusive_field, }; // C-callback `void *user_data` → `&mut T` recovery — same tiering rationale