Unverified Commit dfc53319 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

[Turbopack] add more tracing to dirty flagging (#71482)

### What?

trace make task dirty

add tracing why tasks are marked as dirty

report reason when a page is reloaded
parent 24da437c
...@@ -484,6 +484,7 @@ export async function createHotReloaderTurbopack( ...@@ -484,6 +484,7 @@ export async function createHotReloaderTurbopack(
// reload, only this client is out of date. // reload, only this client is out of date.
const reloadAction: ReloadPageAction = { const reloadAction: ReloadPageAction = {
action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE, action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE,
data: `error in HMR event subscription for ${id}: ${e}`,
} }
sendToClient(client, reloadAction) sendToClient(client, reloadAction)
client.close() client.close()
......
...@@ -76,6 +76,7 @@ interface RemovedPageAction { ...@@ -76,6 +76,7 @@ interface RemovedPageAction {
export interface ReloadPageAction { export interface ReloadPageAction {
action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE
data: string
} }
interface ServerComponentChangesAction { interface ServerComponentChangesAction {
......
...@@ -408,7 +408,10 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface { ...@@ -408,7 +408,10 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface {
public clearHmrServerError(): void { public clearHmrServerError(): void {
if (this.hmrServerError) { if (this.hmrServerError) {
this.setHmrServerError(null) this.setHmrServerError(null)
this.send({ action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE }) this.send({
action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE,
data: 'clear hmr server error',
})
} }
} }
...@@ -1359,7 +1362,10 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface { ...@@ -1359,7 +1362,10 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface {
this.serverPrevDocumentHash = documentChunk.hash || null this.serverPrevDocumentHash = documentChunk.hash || null
// Notify reload to reload the page, as _document.js was changed (different hash) // Notify reload to reload the page, as _document.js was changed (different hash)
this.send({ action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE }) this.send({
action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE,
data: '_document has changed',
})
} }
) )
......
...@@ -479,8 +479,11 @@ export async function handleRouteType({ ...@@ -479,8 +479,11 @@ export async function handleRouteType({
pages: [page], pages: [page],
} }
}, },
() => { (e) => {
return { action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE } return {
action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE,
data: `error in ${page} data subscription: ${e}`,
}
} }
) )
hooks?.subscribeToChanges( hooks?.subscribeToChanges(
...@@ -492,8 +495,11 @@ export async function handleRouteType({ ...@@ -492,8 +495,11 @@ export async function handleRouteType({
event: HMR_ACTIONS_SENT_TO_BROWSER.CLIENT_CHANGES, event: HMR_ACTIONS_SENT_TO_BROWSER.CLIENT_CHANGES,
} }
}, },
() => { (e) => {
return { action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE } return {
action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE,
data: `error in ${page} html subscription: ${e}`,
}
} }
) )
if (entrypoints.global.document) { if (entrypoints.global.document) {
...@@ -502,10 +508,16 @@ export async function handleRouteType({ ...@@ -502,10 +508,16 @@ export async function handleRouteType({
false, false,
entrypoints.global.document, entrypoints.global.document,
() => { () => {
return { action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE } return {
action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE,
data: '_document has changed (page route)',
}
}, },
() => { (e) => {
return { action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE } return {
action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE,
data: `error in _document subscription (page route): ${e}`,
}
} }
) )
} }
...@@ -1075,6 +1087,7 @@ export async function handlePagesErrorRoute({ ...@@ -1075,6 +1087,7 @@ export async function handlePagesErrorRoute({
() => { () => {
return { return {
action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE, action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE,
data: '_app has changed (error route)',
} }
} }
) )
...@@ -1096,10 +1109,16 @@ export async function handlePagesErrorRoute({ ...@@ -1096,10 +1109,16 @@ export async function handlePagesErrorRoute({
false, false,
entrypoints.global.document, entrypoints.global.document,
() => { () => {
return { action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE } return {
action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE,
data: '_document has changed (error route)',
}
}, },
() => { (e) => {
return { action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE } return {
action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE,
data: `error in _document subscription (error route): ${e}`,
}
} }
) )
} }
...@@ -1122,8 +1141,11 @@ export async function handlePagesErrorRoute({ ...@@ -1122,8 +1141,11 @@ export async function handlePagesErrorRoute({
// https://github.com/vercel/next.js/blob/08d7a7e5189a835f5dcb82af026174e587575c0e/packages/next/src/client/page-bootstrap.ts#L69-L71 // https://github.com/vercel/next.js/blob/08d7a7e5189a835f5dcb82af026174e587575c0e/packages/next/src/client/page-bootstrap.ts#L69-L71
return { event: HMR_ACTIONS_SENT_TO_BROWSER.CLIENT_CHANGES } return { event: HMR_ACTIONS_SENT_TO_BROWSER.CLIENT_CHANGES }
}, },
() => { (e) => {
return { action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE } return {
action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE,
data: `error in _error subscription: ${e}`,
}
} }
) )
} }
......
...@@ -41,7 +41,7 @@ use crate::{ ...@@ -41,7 +41,7 @@ use crate::{
operation::{ operation::{
get_aggregation_number, is_root_node, AggregatedDataUpdate, AggregationUpdateJob, get_aggregation_number, is_root_node, AggregatedDataUpdate, AggregationUpdateJob,
AggregationUpdateQueue, CleanupOldEdgesOperation, ConnectChildOperation, AggregationUpdateQueue, CleanupOldEdgesOperation, ConnectChildOperation,
ExecuteContext, ExecuteContextImpl, Operation, OutdatedEdge, TaskGuard, ExecuteContext, ExecuteContextImpl, Operation, OutdatedEdge, TaskDirtyCause, TaskGuard,
}, },
storage::{get, get_many, get_mut, iter_many, remove, Storage}, storage::{get, get_many, get_mut, iter_many, remove, Storage},
}, },
...@@ -779,7 +779,11 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> { ...@@ -779,7 +779,11 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
task_id: TaskId, task_id: TaskId,
turbo_tasks: &dyn TurboTasksBackendApi<TurboTasksBackend<B>>, turbo_tasks: &dyn TurboTasksBackendApi<TurboTasksBackend<B>>,
) { ) {
operation::InvalidateOperation::run(smallvec![task_id], self.execute_context(turbo_tasks)); operation::InvalidateOperation::run(
smallvec![task_id],
TaskDirtyCause::Unknown,
self.execute_context(turbo_tasks),
);
} }
fn invalidate_tasks( fn invalidate_tasks(
...@@ -789,6 +793,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> { ...@@ -789,6 +793,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
) { ) {
operation::InvalidateOperation::run( operation::InvalidateOperation::run(
tasks.iter().copied().collect(), tasks.iter().copied().collect(),
TaskDirtyCause::Unknown,
self.execute_context(turbo_tasks), self.execute_context(turbo_tasks),
); );
} }
...@@ -800,6 +805,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> { ...@@ -800,6 +805,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
) { ) {
operation::InvalidateOperation::run( operation::InvalidateOperation::run(
tasks.iter().copied().collect(), tasks.iter().copied().collect(),
TaskDirtyCause::Unknown,
self.execute_context(turbo_tasks), self.execute_context(turbo_tasks),
); );
} }
...@@ -817,9 +823,11 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> { ...@@ -817,9 +823,11 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
task.invalidate_serialization(); task.invalidate_serialization();
} }
fn get_task_description(&self, task: TaskId) -> std::string::String { fn get_task_description(&self, task_id: TaskId) -> std::string::String {
let task_type = self.lookup_task_type(task).expect("Task not found"); self.lookup_task_type(task_id).map_or_else(
task_type.to_string() || format!("{task_id:?} transient"),
|task_type| task_type.to_string(),
)
} }
fn try_get_function_id(&self, task_id: TaskId) -> Option<FunctionId> { fn try_get_function_id(&self, task_id: TaskId) -> Option<FunctionId> {
...@@ -1163,7 +1171,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> { ...@@ -1163,7 +1171,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
.get(&cell.type_id) .get(&cell.type_id)
.map_or(false, |range| range.contains(&cell.index)) => .map_or(false, |range| range.contains(&cell.index)) =>
{ {
Some(OutdatedEdge::RemovedCellDependent(task)) Some(OutdatedEdge::RemovedCellDependent(task, cell.type_id))
} }
_ => None, _ => None,
}, },
...@@ -1194,7 +1202,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> { ...@@ -1194,7 +1202,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
.get(&cell.type_id) .get(&cell.type_id)
.map_or(false, |range| range.contains(&cell.index)) => .map_or(false, |range| range.contains(&cell.index)) =>
{ {
Some(OutdatedEdge::RemovedCellDependent(task)) Some(OutdatedEdge::RemovedCellDependent(task, cell.type_id))
} }
_ => None, _ => None,
}) })
......
...@@ -8,11 +8,14 @@ use indexmap::map::Entry; ...@@ -8,11 +8,14 @@ use indexmap::map::Entry;
use rustc_hash::{FxHashMap, FxHashSet}; use rustc_hash::{FxHashMap, FxHashSet};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use smallvec::SmallVec; use smallvec::SmallVec;
use turbo_tasks::{FxIndexMap, FxIndexSet, SessionId, TaskId}; use turbo_tasks::{FxIndexMap, FxIndexSet, SessionId, TaskId, TraitTypeId};
use crate::{ use crate::{
backend::{ backend::{
operation::{invalidate::make_task_dirty, ExecuteContext, Operation, TaskGuard}, operation::{
invalidate::{make_task_dirty, TaskDirtyCause},
ExecuteContext, Operation, TaskGuard,
},
storage::{get, get_many, iter_many, remove, update, update_count}, storage::{get, get_many, iter_many, remove, update, update_count},
TaskDataCategory, TaskDataCategory,
}, },
...@@ -101,8 +104,9 @@ pub enum AggregationUpdateJob { ...@@ -101,8 +104,9 @@ pub enum AggregationUpdateJob {
upper_ids: Vec<TaskId>, upper_ids: Vec<TaskId>,
update: AggregatedDataUpdate, update: AggregatedDataUpdate,
}, },
Invalidate { InvalidateDueToCollectiblesChange {
task_ids: SmallVec<[TaskId; 4]>, task_ids: SmallVec<[TaskId; 4]>,
collectible_type: TraitTypeId,
}, },
BalanceEdge { BalanceEdge {
upper_id: TaskId, upper_id: TaskId,
...@@ -284,8 +288,9 @@ impl AggregatedDataUpdate { ...@@ -284,8 +288,9 @@ impl AggregatedDataUpdate {
} }
); );
if !dependent.is_empty() { if !dependent.is_empty() {
queue.push(AggregationUpdateJob::Invalidate { queue.push(AggregationUpdateJob::InvalidateDueToCollectiblesChange {
task_ids: dependent, task_ids: dependent,
collectible_type: ty,
}) })
} }
} }
...@@ -556,9 +561,17 @@ impl AggregationUpdateQueue { ...@@ -556,9 +561,17 @@ impl AggregationUpdateQueue {
AggregationUpdateJob::AggregatedDataUpdate { upper_ids, update } => { AggregationUpdateJob::AggregatedDataUpdate { upper_ids, update } => {
self.aggregated_data_update(upper_ids, ctx, update); self.aggregated_data_update(upper_ids, ctx, update);
} }
AggregationUpdateJob::Invalidate { task_ids } => { AggregationUpdateJob::InvalidateDueToCollectiblesChange {
task_ids,
collectible_type,
} => {
for task_id in task_ids { for task_id in task_ids {
make_task_dirty(task_id, self, ctx); make_task_dirty(
task_id,
TaskDirtyCause::CollectiblesChange { collectible_type },
self,
ctx,
);
} }
} }
} }
......
use std::mem::take; use std::mem::take;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use turbo_tasks::TaskId; use turbo_tasks::{TaskId, ValueTypeId};
use crate::{ use crate::{
backend::{ backend::{
...@@ -10,7 +10,7 @@ use crate::{ ...@@ -10,7 +10,7 @@ use crate::{
get_aggregation_number, get_uppers, is_aggregating_node, AggregationUpdateJob, get_aggregation_number, get_uppers, is_aggregating_node, AggregationUpdateJob,
AggregationUpdateQueue, AggregationUpdateQueue,
}, },
invalidate::make_task_dirty, invalidate::{make_task_dirty, TaskDirtyCause},
AggregatedDataUpdate, ExecuteContext, Operation, TaskGuard, AggregatedDataUpdate, ExecuteContext, Operation, TaskGuard,
}, },
storage::{update, update_count}, storage::{update, update_count},
...@@ -41,7 +41,7 @@ pub enum OutdatedEdge { ...@@ -41,7 +41,7 @@ pub enum OutdatedEdge {
CellDependency(CellRef), CellDependency(CellRef),
OutputDependency(TaskId), OutputDependency(TaskId),
CollectiblesDependency(CollectiblesRef), CollectiblesDependency(CollectiblesRef),
RemovedCellDependent(TaskId), RemovedCellDependent(TaskId, ValueTypeId),
} }
impl CleanupOldEdgesOperation { impl CleanupOldEdgesOperation {
...@@ -177,8 +177,13 @@ impl Operation for CleanupOldEdgesOperation { ...@@ -177,8 +177,13 @@ impl Operation for CleanupOldEdgesOperation {
}); });
} }
} }
OutdatedEdge::RemovedCellDependent(task_id) => { OutdatedEdge::RemovedCellDependent(task_id, value_type) => {
make_task_dirty(task_id, queue, ctx); make_task_dirty(
task_id,
TaskDirtyCause::CellRemoved { value_type },
queue,
ctx,
);
} }
} }
} }
......
use std::fmt::Display;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use smallvec::SmallVec; use smallvec::SmallVec;
use turbo_tasks::TaskId; use turbo_tasks::{registry, TaskId, TraitTypeId, ValueTypeId};
use crate::{ use crate::{
backend::{ backend::{
...@@ -22,6 +24,7 @@ pub enum InvalidateOperation { ...@@ -22,6 +24,7 @@ pub enum InvalidateOperation {
// TODO DetermineActiveness // TODO DetermineActiveness
MakeDirty { MakeDirty {
task_ids: SmallVec<[TaskId; 4]>, task_ids: SmallVec<[TaskId; 4]>,
cause: TaskDirtyCause,
}, },
AggregationUpdate { AggregationUpdate {
queue: AggregationUpdateQueue, queue: AggregationUpdateQueue,
...@@ -31,8 +34,12 @@ pub enum InvalidateOperation { ...@@ -31,8 +34,12 @@ pub enum InvalidateOperation {
} }
impl InvalidateOperation { impl InvalidateOperation {
pub fn run(task_ids: SmallVec<[TaskId; 4]>, mut ctx: impl ExecuteContext) { pub fn run(
InvalidateOperation::MakeDirty { task_ids }.execute(&mut ctx) task_ids: SmallVec<[TaskId; 4]>,
cause: TaskDirtyCause,
mut ctx: impl ExecuteContext,
) {
InvalidateOperation::MakeDirty { task_ids, cause }.execute(&mut ctx)
} }
} }
...@@ -41,10 +48,10 @@ impl Operation for InvalidateOperation { ...@@ -41,10 +48,10 @@ impl Operation for InvalidateOperation {
loop { loop {
ctx.operation_suspend_point(&self); ctx.operation_suspend_point(&self);
match self { match self {
InvalidateOperation::MakeDirty { task_ids } => { InvalidateOperation::MakeDirty { task_ids, cause } => {
let mut queue = AggregationUpdateQueue::new(); let mut queue = AggregationUpdateQueue::new();
for task_id in task_ids { for task_id in task_ids {
make_task_dirty(task_id, &mut queue, ctx); make_task_dirty(task_id, cause, &mut queue, ctx);
} }
if queue.is_empty() { if queue.is_empty() {
self = InvalidateOperation::Done self = InvalidateOperation::Done
...@@ -66,8 +73,50 @@ impl Operation for InvalidateOperation { ...@@ -66,8 +73,50 @@ impl Operation for InvalidateOperation {
} }
} }
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
pub enum TaskDirtyCause {
InitialDirty,
CellChange { value_type: ValueTypeId },
CellRemoved { value_type: ValueTypeId },
OutputChange,
CollectiblesChange { collectible_type: TraitTypeId },
Unknown,
}
impl Display for TaskDirtyCause {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
TaskDirtyCause::InitialDirty => write!(f, "initial dirty"),
TaskDirtyCause::CellChange { value_type } => {
write!(
f,
"{} cell changed",
registry::get_value_type(*value_type).name
)
}
TaskDirtyCause::CellRemoved { value_type } => {
write!(
f,
"{} cell removed",
registry::get_value_type(*value_type).name
)
}
TaskDirtyCause::OutputChange => write!(f, "task output changed"),
TaskDirtyCause::CollectiblesChange { collectible_type } => {
write!(
f,
"{} collectible changed",
registry::get_trait(*collectible_type).name
)
}
TaskDirtyCause::Unknown => write!(f, "unknown"),
}
}
}
pub fn make_task_dirty( pub fn make_task_dirty(
task_id: TaskId, task_id: TaskId,
cause: TaskDirtyCause,
queue: &mut AggregationUpdateQueue, queue: &mut AggregationUpdateQueue,
ctx: &mut impl ExecuteContext, ctx: &mut impl ExecuteContext,
) { ) {
...@@ -77,13 +126,14 @@ pub fn make_task_dirty( ...@@ -77,13 +126,14 @@ pub fn make_task_dirty(
let mut task = ctx.task(task_id, TaskDataCategory::All); let mut task = ctx.task(task_id, TaskDataCategory::All);
make_task_dirty_internal(&mut task, task_id, true, queue, ctx); make_task_dirty_internal(&mut task, task_id, true, cause, queue, ctx);
} }
pub fn make_task_dirty_internal( pub fn make_task_dirty_internal(
task: &mut impl TaskGuard, task: &mut impl TaskGuard,
task_id: TaskId, task_id: TaskId,
make_stale: bool, make_stale: bool,
cause: TaskDirtyCause,
queue: &mut AggregationUpdateQueue, queue: &mut AggregationUpdateQueue,
ctx: &impl ExecuteContext, ctx: &impl ExecuteContext,
) { ) {
...@@ -126,6 +176,12 @@ pub fn make_task_dirty_internal( ...@@ -126,6 +176,12 @@ pub fn make_task_dirty_internal(
} }
_ => unreachable!(), _ => unreachable!(),
}; };
let _span = tracing::trace_span!(
"make task dirty",
name = ctx.get_task_description(task_id),
cause = cause.to_string()
)
.entered();
let aggregated_update = dirty_container.update_with_dirty_state(&DirtyState { let aggregated_update = dirty_container.update_with_dirty_state(&DirtyState {
clean_in_session: None, clean_in_session: None,
}); });
......
...@@ -84,6 +84,7 @@ pub trait ExecuteContext<'e>: Sized { ...@@ -84,6 +84,7 @@ pub trait ExecuteContext<'e>: Sized {
run: impl FnOnce(&mut ExecuteContextImpl<'_, '_, Self::Backend>), run: impl FnOnce(&mut ExecuteContextImpl<'_, '_, Self::Backend>),
); );
fn get_task_desc_fn(&self, task_id: TaskId) -> impl Fn() -> String + Send + Sync + 'static; fn get_task_desc_fn(&self, task_id: TaskId) -> impl Fn() -> String + Send + Sync + 'static;
fn get_task_description(&self, task_id: TaskId) -> String;
} }
pub struct ParentRef<'a> { pub struct ParentRef<'a> {
...@@ -333,6 +334,10 @@ where ...@@ -333,6 +334,10 @@ where
fn get_task_desc_fn(&self, task_id: TaskId) -> impl Fn() -> String + Send + Sync + 'static { fn get_task_desc_fn(&self, task_id: TaskId) -> impl Fn() -> String + Send + Sync + 'static {
self.backend.get_task_desc_fn(task_id) self.backend.get_task_desc_fn(task_id)
} }
fn get_task_description(&self, task_id: TaskId) -> String {
self.backend.get_task_description(task_id)
}
} }
pub trait TaskGuard: Debug { pub trait TaskGuard: Debug {
...@@ -653,6 +658,7 @@ pub use self::{ ...@@ -653,6 +658,7 @@ pub use self::{
get_aggregation_number, is_root_node, AggregatedDataUpdate, AggregationUpdateJob, get_aggregation_number, is_root_node, AggregatedDataUpdate, AggregationUpdateJob,
}, },
cleanup_old_edges::OutdatedEdge, cleanup_old_edges::OutdatedEdge,
invalidate::TaskDirtyCause,
update_cell::UpdateCellOperation, update_cell::UpdateCellOperation,
update_collectible::UpdateCollectibleOperation, update_collectible::UpdateCollectibleOperation,
}; };
...@@ -2,7 +2,7 @@ use turbo_tasks::{backend::CellContent, CellId, TaskId}; ...@@ -2,7 +2,7 @@ use turbo_tasks::{backend::CellContent, CellId, TaskId};
use crate::{ use crate::{
backend::{ backend::{
operation::{ExecuteContext, InvalidateOperation, TaskGuard}, operation::{invalidate::TaskDirtyCause, ExecuteContext, InvalidateOperation, TaskGuard},
storage::{get_many, remove}, storage::{get_many, remove},
TaskDataCategory, TaskDataCategory,
}, },
...@@ -48,6 +48,12 @@ impl UpdateCellOperation { ...@@ -48,6 +48,12 @@ impl UpdateCellOperation {
drop(task); drop(task);
drop(old_content); drop(old_content);
InvalidateOperation::run(dependent, ctx); InvalidateOperation::run(
dependent,
TaskDirtyCause::CellChange {
value_type: cell.type_id,
},
ctx,
);
} }
} }
...@@ -7,7 +7,7 @@ use turbo_tasks::{util::SharedError, RawVc, TaskId}; ...@@ -7,7 +7,7 @@ use turbo_tasks::{util::SharedError, RawVc, TaskId};
use crate::{ use crate::{
backend::{ backend::{
operation::{ operation::{
invalidate::{make_task_dirty, make_task_dirty_internal}, invalidate::{make_task_dirty, make_task_dirty_internal, TaskDirtyCause},
AggregationUpdateQueue, ExecuteContext, Operation, TaskGuard, AggregationUpdateQueue, ExecuteContext, Operation, TaskGuard,
}, },
storage::{get, get_many}, storage::{get, get_many},
...@@ -108,7 +108,14 @@ impl UpdateOutputOperation { ...@@ -108,7 +108,14 @@ impl UpdateOutputOperation {
let mut queue = AggregationUpdateQueue::new(); let mut queue = AggregationUpdateQueue::new();
make_task_dirty_internal(&mut task, task_id, false, &mut queue, &ctx); make_task_dirty_internal(
&mut task,
task_id,
false,
TaskDirtyCause::InitialDirty,
&mut queue,
&ctx,
);
drop(task); drop(task);
drop(old_content); drop(old_content);
...@@ -134,7 +141,12 @@ impl Operation for UpdateOutputOperation { ...@@ -134,7 +141,12 @@ impl Operation for UpdateOutputOperation {
ref mut queue, ref mut queue,
} => { } => {
if let Some(dependent_task_id) = dependent_tasks.pop() { if let Some(dependent_task_id) = dependent_tasks.pop() {
make_task_dirty(dependent_task_id, queue, ctx); make_task_dirty(
dependent_task_id,
TaskDirtyCause::OutputChange,
queue,
ctx,
);
} }
if dependent_tasks.is_empty() { if dependent_tasks.is_empty() {
self = UpdateOutputOperation::EnsureUnfinishedChildrenDirty { self = UpdateOutputOperation::EnsureUnfinishedChildrenDirty {
...@@ -150,7 +162,14 @@ impl Operation for UpdateOutputOperation { ...@@ -150,7 +162,14 @@ impl Operation for UpdateOutputOperation {
if let Some(child_id) = children.pop() { if let Some(child_id) = children.pop() {
let mut child_task = ctx.task(child_id, TaskDataCategory::Data); let mut child_task = ctx.task(child_id, TaskDataCategory::Data);
if !child_task.has_key(&CachedDataItemKey::Output {}) { if !child_task.has_key(&CachedDataItemKey::Output {}) {
make_task_dirty_internal(&mut child_task, child_id, false, queue, ctx); make_task_dirty_internal(
&mut child_task,
child_id,
false,
TaskDirtyCause::InitialDirty,
queue,
ctx,
);
} }
} }
if children.is_empty() { if children.is_empty() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment