next.js
f96442e6 - turbo-tasks: migrate TaskStorage call sites to TaskStorageBox

Commit
51 days ago
turbo-tasks: migrate TaskStorage call sites to TaskStorageBox Preparation for step 3 (inlining the lazy-tail byte buffer into TaskStorageBox's allocation): after step 3, stack-allocated TaskStorage values can't grow their tail because the allocation context belongs to TaskStorageBox. Migrate every TaskStorage::new() / TaskStorage::default() call site to TaskStorageBox::new() so no test or production path ends up trying to mutate a stack-allocated TaskStorage. Specific changes: * All 20+ test sites in storage_schema.rs switch to TaskStorageBox::new(). Access to inline fields goes through Deref/DerefMut. * Macro-emitted `clone_snapshot()` now returns TaskStorageBox. * Macro-emitted `restore_from` / `restore_meta_from` / `restore_data_from` take TaskStorageBox by value (formerly TaskStorage). * `restore_meta_from` / `restore_data_from` made `pub` (previously `pub(crate)`) for the tests that drive them directly. * `BackingStorage::lookup_data` / `batch_lookup_data` (and the `Either` forwarding impl) switch their TaskStorage parameter / return types to TaskStorageBox. `kv_backing_storage` and `restore_task_data` / `restore_task_data_batch` follow. * `TaskRestoreEntry::{data,meta}_restore_result` and the `apply_restore_result` parameter shape switch to TaskStorageBox. * The verify_serialization round-trip in `encode_task_data_inner` now builds via TaskStorageBox::new(). * Storage snapshot path drops the wrapper that previously did `TaskStorageBox::from_boxed(Box::new(clone_snapshot()))` — clone_snapshot returns the right type now. The macro still emits a public `TaskStorage::new()` because the body of TaskStorageBox::new() needs to construct an underlying TaskStorage; that function is left in place for now and will be redesigned in step 3 when the underlying allocation switches to one unified head+tail buffer. 50 backend tests pass; whole workspace builds.
Author
Committer
Parents
Loading