Commit 7267199a authored by Tobias Koppers's avatar Tobias Koppers Committed by Tobias Koppers

Inherit priority from invalidating task

parent 25a08e43
...@@ -13,7 +13,7 @@ bench = false ...@@ -13,7 +13,7 @@ bench = false
workspace = true workspace = true
[features] [features]
default = [] default = ["trace_task_dirty"]
print_cache_item_size = [] print_cache_item_size = []
no_fast_stale = [] no_fast_stale = []
verify_serialization = [] verify_serialization = []
......
...@@ -25,8 +25,8 @@ use tokio::time::{Duration, Instant}; ...@@ -25,8 +25,8 @@ use tokio::time::{Duration, Instant};
use tracing::{Span, trace_span}; use tracing::{Span, trace_span};
use turbo_tasks::{ use turbo_tasks::{
CellId, FxDashMap, KeyValuePair, RawVc, ReadCellOptions, ReadCellTracking, ReadConsistency, CellId, FxDashMap, KeyValuePair, RawVc, ReadCellOptions, ReadCellTracking, ReadConsistency,
ReadOutputOptions, ReadTracking, TRANSIENT_TASK_BIT, TaskExecutionReason, TaskId, TraitTypeId, ReadOutputOptions, ReadTracking, TRANSIENT_TASK_BIT, TaskExecutionReason, TaskId, TaskPriority,
TurboTasksBackendApi, ValueTypeId, TraitTypeId, TurboTasksBackendApi, ValueTypeId,
backend::{ backend::{
Backend, CachedTaskType, CellContent, TaskExecutionSpec, TransientTaskRoot, Backend, CachedTaskType, CellContent, TaskExecutionSpec, TransientTaskRoot,
TransientTaskType, TurboTasksExecutionError, TypedCellContent, VerificationMode, TransientTaskType, TurboTasksExecutionError, TypedCellContent, VerificationMode,
...@@ -1682,6 +1682,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> { ...@@ -1682,6 +1682,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
fn try_start_task_execution( fn try_start_task_execution(
&self, &self,
task_id: TaskId, task_id: TaskId,
priority: TaskPriority,
turbo_tasks: &dyn TurboTasksBackendApi<TurboTasksBackend<B>>, turbo_tasks: &dyn TurboTasksBackendApi<TurboTasksBackend<B>>,
) -> Option<TaskExecutionSpec<'_>> { ) -> Option<TaskExecutionSpec<'_>> {
enum TaskType { enum TaskType {
...@@ -1803,7 +1804,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> { ...@@ -1803,7 +1804,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
arg, arg,
} = &*task_type; } = &*task_type;
( (
native_fn.span(task_id.persistence(), execution_reason), native_fn.span(task_id.persistence(), execution_reason, priority),
native_fn.execute(*this, &**arg), native_fn.execute(*this, &**arg),
) )
} }
...@@ -3333,9 +3334,11 @@ impl<B: BackingStorage> Backend for TurboTasksBackend<B> { ...@@ -3333,9 +3334,11 @@ impl<B: BackingStorage> Backend for TurboTasksBackend<B> {
fn try_start_task_execution( fn try_start_task_execution(
&self, &self,
task_id: TaskId, task_id: TaskId,
priority: TaskPriority,
turbo_tasks: &dyn TurboTasksBackendApi<Self>, turbo_tasks: &dyn TurboTasksBackendApi<Self>,
) -> Option<TaskExecutionSpec<'_>> { ) -> Option<TaskExecutionSpec<'_>> {
self.0.try_start_task_execution(task_id, turbo_tasks) self.0
.try_start_task_execution(task_id, priority, turbo_tasks)
} }
fn task_execution_completed( fn task_execution_completed(
......
...@@ -566,9 +566,9 @@ where ...@@ -566,9 +566,9 @@ where
fn schedule_task(&self, task: Self::TaskGuardImpl) { fn schedule_task(&self, task: Self::TaskGuardImpl) {
let priority = if get!(task, Output).is_some() { let priority = if get!(task, Output).is_some() {
TaskPriority::new(get!(task, LeafDistance).copied().unwrap_or_default().min) TaskPriority::invalidation(get!(task, LeafDistance).copied().unwrap_or_default().min)
} else { } else {
TaskPriority::root() TaskPriority::initial()
}; };
self.turbo_tasks.schedule(task.id(), priority); self.turbo_tasks.schedule(task.id(), priority);
} }
......
...@@ -73,15 +73,14 @@ async fn spawns_detached( ...@@ -73,15 +73,14 @@ async fn spawns_detached(
notify: TransientInstance<NotifyTaskInput>, notify: TransientInstance<NotifyTaskInput>,
sender: TransientInstance<WatchSenderTaskInput<Option<Vc<u32>>>>, sender: TransientInstance<WatchSenderTaskInput<Option<Vc<u32>>>>,
) -> Vc<()> { ) -> Vc<()> {
tokio::spawn(turbo_tasks().detached_for_testing(Box::pin(async move { turbo_tasks().spawn_detached_for_testing(Box::pin(async move {
println!("spawns_detached: waiting for notify"); println!("spawns_detached: waiting for notify");
notify.0.notified().await; notify.0.notified().await;
println!("spawns_detached: notified, sending value"); println!("spawns_detached: notified, sending value");
// creating cells after the normal lifetime of the task should be okay, as the parent task // creating cells after the normal lifetime of the task should be okay, as the parent task
// is waiting on us before exiting! // is waiting on us before exiting!
sender.0.send(Some(Vc::cell(42))).unwrap(); sender.0.send(Some(Vc::cell(42))).unwrap();
Ok(()) }));
})));
Vc::cell(()) Vc::cell(())
} }
...@@ -145,10 +144,10 @@ async fn spawns_detached_changing( ...@@ -145,10 +144,10 @@ async fn spawns_detached_changing(
changing_input_outer: Vc<ChangingInput>, changing_input_outer: Vc<ChangingInput>,
) -> Vc<u32> { ) -> Vc<u32> {
let tt = turbo_tasks(); let tt = turbo_tasks();
tokio::spawn(tt.clone().detached_for_testing(Box::pin(async move { tt.clone().spawn_detached_for_testing(Box::pin(async move {
sleep(Duration::from_millis(100)).await; sleep(Duration::from_millis(100)).await;
// nested detached_for_testing calls should work // nested spawn_detached_for_testing calls should work
tokio::spawn(tt.clone().detached_for_testing(Box::pin(async move { tt.clone().spawn_detached_for_testing(Box::pin(async move {
sleep(Duration::from_millis(100)).await; sleep(Duration::from_millis(100)).await;
// creating cells after the normal lifetime of the task should be okay, as the parent // creating cells after the normal lifetime of the task should be okay, as the parent
// task is waiting on us before exiting! // task is waiting on us before exiting!
...@@ -158,10 +157,8 @@ async fn spawns_detached_changing( ...@@ -158,10 +157,8 @@ async fn spawns_detached_changing(
*read_changing_input(changing_input_detached).await.unwrap(), *read_changing_input(changing_input_detached).await.unwrap(),
))) )))
.unwrap(); .unwrap();
Ok(()) }));
}))); }));
Ok(())
})));
Vc::cell(*read_changing_input(changing_input_outer).await.unwrap()) Vc::cell(*read_changing_input(changing_input_outer).await.unwrap())
} }
......
...@@ -292,10 +292,10 @@ impl TurboTasksApi for VcStorage { ...@@ -292,10 +292,10 @@ impl TurboTasksApi for VcStorage {
// no-op // no-op
} }
fn detached_for_testing( fn spawn_detached_for_testing(
&self, &self,
_f: std::pin::Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>, _f: std::pin::Pin<Box<dyn Future<Output = ()> + Send + 'static>>,
) -> std::pin::Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>> { ) {
unimplemented!() unimplemented!()
} }
......
...@@ -26,8 +26,8 @@ use turbo_rcstr::RcStr; ...@@ -26,8 +26,8 @@ use turbo_rcstr::RcStr;
use crate::{ use crate::{
RawVc, ReadCellOptions, ReadOutputOptions, ReadRef, SharedReference, TaskId, TaskIdSet, RawVc, ReadCellOptions, ReadOutputOptions, ReadRef, SharedReference, TaskId, TaskIdSet,
TraitRef, TraitTypeId, TurboTasksPanic, ValueTypeId, VcRead, VcValueTrait, VcValueType, TaskPriority, TraitRef, TraitTypeId, TurboTasksPanic, ValueTypeId, VcRead, VcValueTrait,
event::EventListener, macro_helpers::NativeFunction, magic_any::MagicAny, VcValueType, event::EventListener, macro_helpers::NativeFunction, magic_any::MagicAny,
manager::TurboTasksBackendApi, raw_vc::CellId, registry, manager::TurboTasksBackendApi, raw_vc::CellId, registry,
task::shared_reference::TypedSharedReference, task_statistics::TaskStatisticsApi, task::shared_reference::TypedSharedReference, task_statistics::TaskStatisticsApi,
triomphe_utils::unchecked_sidecast_triomphe_arc, triomphe_utils::unchecked_sidecast_triomphe_arc,
...@@ -418,6 +418,7 @@ pub trait Backend: Sync + Send { ...@@ -418,6 +418,7 @@ pub trait Backend: Sync + Send {
fn try_start_task_execution<'a>( fn try_start_task_execution<'a>(
&'a self, &'a self,
task: TaskId, task: TaskId,
priority: TaskPriority,
turbo_tasks: &dyn TurboTasksBackendApi<Self>, turbo_tasks: &dyn TurboTasksBackendApi<Self>,
) -> Option<TaskExecutionSpec<'a>>; ) -> Option<TaskExecutionSpec<'a>>;
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ use tracing::Span; ...@@ -8,7 +8,7 @@ use tracing::Span;
use turbo_bincode::{AnyDecodeFn, AnyEncodeFn}; use turbo_bincode::{AnyDecodeFn, AnyEncodeFn};
use crate::{ use crate::{
RawVc, TaskExecutionReason, TaskInput, TaskPersistence, RawVc, TaskExecutionReason, TaskInput, TaskPersistence, TaskPriority,
magic_any::{MagicAny, any_as_encode}, magic_any::{MagicAny, any_as_encode},
task::{ task::{
IntoTaskFn, TaskFn, IntoTaskFn, TaskFn,
...@@ -238,7 +238,12 @@ impl NativeFunction { ...@@ -238,7 +238,12 @@ impl NativeFunction {
} }
} }
pub fn span(&'static self, persistence: TaskPersistence, reason: TaskExecutionReason) -> Span { pub fn span(
&'static self,
persistence: TaskPersistence,
reason: TaskExecutionReason,
priority: TaskPriority,
) -> Span {
let flags = match persistence { let flags = match persistence {
TaskPersistence::Persistent => "", TaskPersistence::Persistent => "",
TaskPersistence::Transient => "transient", TaskPersistence::Transient => "transient",
...@@ -246,13 +251,14 @@ impl NativeFunction { ...@@ -246,13 +251,14 @@ impl NativeFunction {
tracing::trace_span!( tracing::trace_span!(
"turbo_tasks::function", "turbo_tasks::function",
name = self.name, name = self.name,
priority = %priority,
flags = flags, flags = flags,
reason = reason.as_str() reason = reason.as_str()
) )
} }
pub fn resolve_span(&'static self) -> Span { pub fn resolve_span(&'static self, priority: TaskPriority) -> Span {
tracing::trace_span!("turbo_tasks::resolve_call", name = self.name) tracing::trace_span!("turbo_tasks::resolve_call", name = self.name, priority = %priority)
} }
} }
impl PartialEq for NativeFunction { impl PartialEq for NativeFunction {
......
...@@ -13,28 +13,30 @@ use std::{ ...@@ -13,28 +13,30 @@ use std::{
use parking_lot::Mutex; use parking_lot::Mutex;
use pin_project_lite::pin_project; use pin_project_lite::pin_project;
use tokio::sync::oneshot::{Receiver, Sender};
pub trait Executor<C, T>: Send + Sync { pub trait Executor<C, T, P>: Send + Sync {
type Future: Future<Output = ()> + Send; type Future: Future<Output = ()> + Send;
fn execute(&self, execute_context: &Arc<C>, task: T) -> Self::Future; fn execute(&self, execute_context: &Arc<C>, task: T, priority: P) -> Self::Future;
} }
impl<C, T, F, Fut> Executor<C, T> for F impl<C, T, P, F, Fut> Executor<C, T, P> for F
where where
F: Fn(&Arc<C>, T) -> Fut + Send + Sync, F: Fn(&Arc<C>, T, P) -> Fut + Send + Sync,
Fut: Future<Output = ()> + Send, Fut: Future<Output = ()> + Send,
{ {
type Future = Fut; type Future = Fut;
fn execute(&self, execute_context: &Arc<C>, task: T) -> Self::Future { fn execute(&self, execute_context: &Arc<C>, task: T, priority: P) -> Self::Future {
(self)(execute_context, task) (self)(execute_context, task, priority)
} }
} }
struct HeapItem<P, T> { struct HeapItem<P, T> {
priority: P, priority: P,
task: T, task: T,
tx: Option<Sender<()>>,
} }
impl<P: Eq, T> PartialEq for HeapItem<P, T> { impl<P: Eq, T> PartialEq for HeapItem<P, T> {
...@@ -61,7 +63,7 @@ pub struct PriorityRunner< ...@@ -61,7 +63,7 @@ pub struct PriorityRunner<
C: Send + Sync + 'static, C: Send + Sync + 'static,
T: Send + 'static, T: Send + 'static,
P: Ord + Send + 'static, P: Ord + Send + 'static,
E: Executor<C, T> + 'static, E: Executor<C, T, P> + 'static,
> { > {
executor: E, executor: E,
target_workers: usize, target_workers: usize,
...@@ -78,7 +80,7 @@ impl< ...@@ -78,7 +80,7 @@ impl<
C: Send + Sync + 'static, C: Send + Sync + 'static,
T: Send + 'static, T: Send + 'static,
P: Debug + Ord + Send + 'static, P: Debug + Ord + Send + 'static,
E: Executor<C, T> + 'static, E: Executor<C, T, P> + 'static,
> PriorityRunner<C, T, P, E> > PriorityRunner<C, T, P, E>
{ {
pub fn new(executor: E) -> Self { pub fn new(executor: E) -> Self {
...@@ -94,12 +96,33 @@ impl< ...@@ -94,12 +96,33 @@ impl<
} }
pub fn schedule(self: &Arc<Self>, execute_context: &Arc<C>, task: T, priority: P) { pub fn schedule(self: &Arc<Self>, execute_context: &Arc<C>, task: T, priority: P) {
self.schedule_internal(execute_context, task, priority, None);
}
pub fn schedule_with_join_handle(
self: &Arc<Self>,
execute_context: &Arc<C>,
task: T,
priority: P,
) -> JoinHandle {
let (tx, rx) = tokio::sync::oneshot::channel();
self.schedule_internal(execute_context, task, priority, Some(tx));
JoinHandle { receiver: rx }
}
fn schedule_internal(
self: &Arc<Self>,
execute_context: &Arc<C>,
task: T,
priority: P,
tx: Option<Sender<()>>,
) {
let mut inner = self.inner.lock(); let mut inner = self.inner.lock();
if !inner.queue.is_empty() { if !inner.queue.is_empty() {
// If there is already work in the queue, we don't have any // If there is already work in the queue, we don't have any
// free capacity so we can just push the task to the queue. // free capacity so we can just push the task to the queue.
// It will be picked up by existing workers. // It will be picked up by existing workers.
inner.queue.push(HeapItem { priority, task }); inner.queue.push(HeapItem { priority, task, tx });
return; return;
} }
// The queue is empty, so we might have free capacity to spawn a new worker. // The queue is empty, so we might have free capacity to spawn a new worker.
...@@ -108,11 +131,11 @@ impl< ...@@ -108,11 +131,11 @@ impl<
// We have free capacity, spawn a new worker to execute this task immediately. // We have free capacity, spawn a new worker to execute this task immediately.
drop(inner); drop(inner);
let future = self.executor.execute(execute_context, task); let future = self.executor.execute(execute_context, task, priority);
WorkerFuture::spawn(future, execute_context.clone(), self.clone(), true); WorkerFuture::spawn(future, tx, execute_context.clone(), self.clone(), true);
} else { } else {
// No free capacity, push the task to the queue. // No free capacity, push the task to the queue.
inner.queue.push(HeapItem { priority, task }); inner.queue.push(HeapItem { priority, task, tx });
drop(inner); drop(inner);
// Active polls might be reduced in the meantime and we might have free capacity now, // Active polls might be reduced in the meantime and we might have free capacity now,
...@@ -127,10 +150,18 @@ impl< ...@@ -127,10 +150,18 @@ impl<
} }
} }
fn pop_future_from_worker(&self, execute_context: &Arc<C>) -> Option<E::Future> { fn pop_future_from_worker(
&self,
execute_context: &Arc<C>,
) -> Option<(E::Future, Option<Sender<()>>)> {
let mut inner = self.inner.lock(); let mut inner = self.inner.lock();
if let Some(heap_item) = inner.queue.pop() { if let Some(heap_item) = inner.queue.pop() {
Some(self.executor.execute(execute_context, heap_item.task)) let tx = heap_item.tx;
Some((
self.executor
.execute(execute_context, heap_item.task, heap_item.priority),
tx,
))
} else { } else {
None None
} }
...@@ -143,13 +174,16 @@ impl< ...@@ -143,13 +174,16 @@ impl<
) -> bool { ) -> bool {
let mut inner = self.inner.lock(); let mut inner = self.inner.lock();
if let Some(heap_item) = inner.queue.pop() { if let Some(heap_item) = inner.queue.pop() {
let new_future = self.executor.execute(execute_context, heap_item.task); let tx = heap_item.tx;
let new_future =
self.executor
.execute(execute_context, heap_item.task, heap_item.priority);
drop(inner); drop(inner);
if !has_active_poll { if !has_active_poll {
self.active_polls.fetch_add(1, Ordering::Relaxed); self.active_polls.fetch_add(1, Ordering::Relaxed);
} }
WorkerFuture::spawn(new_future, execute_context.clone(), self.clone(), true); WorkerFuture::spawn(new_future, tx, execute_context.clone(), self.clone(), true);
true true
} else { } else {
false false
...@@ -169,12 +203,13 @@ pin_project! { ...@@ -169,12 +203,13 @@ pin_project! {
P: Ord, P: Ord,
P: Send, P: Send,
P: 'static, P: 'static,
E: Executor<C, T>, E: Executor<C, T, P>,
E: 'static, E: 'static,
{ {
#[pin] #[pin]
future: E::Future, future: E::Future,
tx: Option<Sender<()>>,
execute_context: Arc<C>, execute_context: Arc<C>,
runner: Arc<PriorityRunner<C, T, P, E>>, runner: Arc<PriorityRunner<C, T, P, E>>,
has_active_poll: bool, has_active_poll: bool,
...@@ -185,17 +220,19 @@ impl< ...@@ -185,17 +220,19 @@ impl<
C: Send + Sync + 'static, C: Send + Sync + 'static,
T: Send + 'static, T: Send + 'static,
P: Debug + Ord + Send + 'static, P: Debug + Ord + Send + 'static,
E: Executor<C, T> + 'static, E: Executor<C, T, P> + 'static,
> WorkerFuture<C, T, P, E> > WorkerFuture<C, T, P, E>
{ {
fn spawn( fn spawn(
future: E::Future, future: E::Future,
tx: Option<Sender<()>>,
execute_context: Arc<C>, execute_context: Arc<C>,
runner: Arc<PriorityRunner<C, T, P, E>>, runner: Arc<PriorityRunner<C, T, P, E>>,
has_active_poll: bool, has_active_poll: bool,
) { ) {
tokio::task::spawn(Self { tokio::task::spawn(Self {
future, future,
tx,
execute_context, execute_context,
runner, runner,
has_active_poll, has_active_poll,
...@@ -207,7 +244,7 @@ impl< ...@@ -207,7 +244,7 @@ impl<
C: Send + Sync + 'static, C: Send + Sync + 'static,
T: Send + 'static, T: Send + 'static,
P: Debug + Ord + Send + 'static, P: Debug + Ord + Send + 'static,
E: Executor<C, T> + 'static, E: Executor<C, T, P> + 'static,
> Future for WorkerFuture<C, T, P, E> > Future for WorkerFuture<C, T, P, E>
{ {
type Output = (); type Output = ();
...@@ -221,9 +258,14 @@ impl< ...@@ -221,9 +258,14 @@ impl<
loop { loop {
match this.future.as_mut().poll(cx) { match this.future.as_mut().poll(cx) {
Poll::Ready(()) => { Poll::Ready(()) => {
// Notify that the task is done
if let Some(tx) = this.tx.take() {
let _ = tx.send(());
}
// This future is done, we need to check the queue for more tasks, // This future is done, we need to check the queue for more tasks,
// so we can continue working on a new future in this worker. // so we can continue working on a new future in this worker.
if let Some(new_future) = if let Some((new_future, new_tx)) =
this.runner.pop_future_from_worker(&this.execute_context) this.runner.pop_future_from_worker(&this.execute_context)
{ {
// We are replacing the future with a new one, but the current future is // We are replacing the future with a new one, but the current future is
...@@ -237,6 +279,7 @@ impl< ...@@ -237,6 +279,7 @@ impl<
drop_in_place(future_slot); drop_in_place(future_slot);
future_slot.write(new_future); future_slot.write(new_future);
} }
*this.tx = new_tx;
continue; continue;
} else { } else {
// No more tasks to execute // No more tasks to execute
...@@ -276,6 +319,25 @@ impl< ...@@ -276,6 +319,25 @@ impl<
} }
} }
pub struct JoinHandle {
receiver: Receiver<()>,
}
impl Future for JoinHandle {
type Output = ();
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let this = self.get_mut();
match Pin::new(&mut this.receiver).poll(cx) {
Poll::Ready(result) => {
let _ = result;
Poll::Ready(())
}
Poll::Pending => Poll::Pending,
}
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::{sync::Arc, thread::sleep, time::Duration}; use std::{sync::Arc, thread::sleep, time::Duration};
...@@ -286,10 +348,15 @@ mod tests { ...@@ -286,10 +348,15 @@ mod tests {
async fn test_cpu_bound_tasks() { async fn test_cpu_bound_tasks() {
struct ExecutorImpl; struct ExecutorImpl;
impl Executor<Mutex<Vec<u32>>, u32> for ExecutorImpl { impl Executor<Mutex<Vec<u32>>, u32, u32> for ExecutorImpl {
type Future = Pin<Box<dyn Future<Output = ()> + Send>>; type Future = Pin<Box<dyn Future<Output = ()> + Send>>;
fn execute(&self, execute_context: &Arc<Mutex<Vec<u32>>>, task: u32) -> Self::Future { fn execute(
&self,
execute_context: &Arc<Mutex<Vec<u32>>>,
task: u32,
_priority: u32,
) -> Self::Future {
let execute_context = execute_context.clone(); let execute_context = execute_context.clone();
Box::pin(async move { Box::pin(async move {
println!("Executing task {}...", task); println!("Executing task {}...", task);
...@@ -334,10 +401,15 @@ mod tests { ...@@ -334,10 +401,15 @@ mod tests {
async fn test_waiting_tasks() { async fn test_waiting_tasks() {
struct ExecutorImpl; struct ExecutorImpl;
impl Executor<Mutex<Vec<u32>>, u32> for ExecutorImpl { impl Executor<Mutex<Vec<u32>>, u32, u32> for ExecutorImpl {
type Future = Pin<Box<dyn Future<Output = ()> + Send>>; type Future = Pin<Box<dyn Future<Output = ()> + Send>>;
fn execute(&self, execute_context: &Arc<Mutex<Vec<u32>>>, task: u32) -> Self::Future { fn execute(
&self,
execute_context: &Arc<Mutex<Vec<u32>>>,
task: u32,
_priority: u32,
) -> Self::Future {
let execute_context = execute_context.clone(); let execute_context = execute_context.clone();
Box::pin(async move { Box::pin(async move {
println!("Executing task {}...", task); println!("Executing task {}...", task);
......
...@@ -9,9 +9,9 @@ use tracing::Span; ...@@ -9,9 +9,9 @@ use tracing::Span;
use turbo_bincode::{AnyDecodeFn, AnyEncodeFn}; use turbo_bincode::{AnyDecodeFn, AnyEncodeFn};
use crate::{ use crate::{
RawVc, SharedReference, VcValueType, id::TraitTypeId, macro_helpers::NativeFunction, RawVc, SharedReference, TaskPriority, VcValueType, id::TraitTypeId,
magic_any::any_as_encode, registry, task::shared_reference::TypedSharedReference, macro_helpers::NativeFunction, magic_any::any_as_encode, registry,
vc::VcCellMode, task::shared_reference::TypedSharedReference, vc::VcCellMode,
}; };
type RawCellFactoryFn = fn(TypedSharedReference) -> RawVc; type RawCellFactoryFn = fn(TypedSharedReference) -> RawVc;
...@@ -231,10 +231,11 @@ impl Debug for TraitMethod { ...@@ -231,10 +231,11 @@ impl Debug for TraitMethod {
} }
} }
impl TraitMethod { impl TraitMethod {
pub(crate) fn resolve_span(&self) -> Span { pub(crate) fn resolve_span(&self, priority: TaskPriority) -> Span {
tracing::trace_span!( tracing::trace_span!(
"turbo_tasks::resolve_trait_call", "turbo_tasks::resolve_trait_call",
name = format_args!("{}::{}", &self.trait_name, &self.method_name), name = format_args!("{}::{}", &self.trait_name, &self.method_name),
priority = %priority,
) )
} }
} }
......
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