mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
* `IncrementalGraph(.client).File` packs its fields in a specific way to save space, but it makes the struct hard to use and error-prone (e.g., untagged unions with tags stored in a separate `flags` struct). This PR changes `File` to have a human-readable layout, but adds methods to convert it to and from `File.Packed`, a packed version with the same space efficiency as before. * Reduce the need to pass the dev allocator to functions (e.g., `deinit`) by storing it as a struct field via the new `DevAllocator` type. This type has no overhead in release builds, or when `AllocationScope` is disabled. * Use owned pointers in `PackedMap`. * Use `bun.ptr.Shared` for `PackedMap` instead of the old `bun.ptr.RefPtr`. * Add `bun.ptr.ScopedOwned`, which is like `bun.ptr.Owned`, but can store an `AllocationScope`. No overhead in release builds or when `AllocationScope` is disabled. * Reduce redundant allocators in `BundleV2`. * Add owned pointer conversions to `MutableString`. * Make `AllocationScope` behave like a pointer, so it can be moved without invalidating allocations. This eliminates the need for self-references. * Change memory cost algorithm so it doesn't rely on “dedupe bits”. These bits used to take advantage of padding but there is now no padding in `PackedMap`. * Replace `VoidFieldTypes` with `useAllFields`; this eliminates the need for `voidFieldTypesDiscardHelper`. (For internal tracking: fixes STAB-1035, STAB-1036, STAB-1037, STAB-1038, STAB-1039, STAB-1040, STAB-1041, STAB-1042, STAB-1043, STAB-1044, STAB-1045) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com>