@@ -8,7 +8,6 @@ use std::{
88 Arc , Mutex , RwLock , Weak ,
99 atomic:: { AtomicBool , AtomicUsize , Ordering } ,
1010 } ,
11- thread,
1211 time:: { Duration , Instant } ,
1312} ;
1413
@@ -17,10 +16,9 @@ use auto_hash_map::AutoMap;
1716use rustc_hash:: FxHasher ;
1817use serde:: { Deserialize , Serialize } ;
1918use smallvec:: SmallVec ;
20- use tokio:: { runtime :: Handle , select, sync:: mpsc:: Receiver , task_local} ;
19+ use tokio:: { select, sync:: mpsc:: Receiver , task_local} ;
2120use tokio_util:: task:: TaskTracker ;
22- use tracing:: { Instrument , Level , Span , info_span, instrument, trace_span} ;
23- use turbo_tasks_malloc:: TurboMalloc ;
21+ use tracing:: { Instrument , Level , instrument, trace_span} ;
2422
2523use crate :: {
2624 Completion , InvalidationReason , InvalidationReasonSet , OutputContent , ReadCellOptions ,
@@ -30,7 +28,7 @@ use crate::{
3028 Backend , CachedTaskType , CellContent , TaskCollectiblesMap , TaskExecutionSpec ,
3129 TransientTaskType , TurboTasksExecutionError , TypedCellContent ,
3230 } ,
33- capture_future:: { self , CaptureFuture } ,
31+ capture_future:: CaptureFuture ,
3432 event:: { Event , EventListener } ,
3533 id:: { BackendJobId , ExecutionId , LocalTaskId , TRANSIENT_TASK_BIT , TraitTypeId } ,
3634 id_factory:: IdFactoryWithReuse ,
@@ -718,7 +716,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
718716 } ;
719717
720718 async {
721- let ( result, duration, memory_usage ) = CaptureFuture :: new ( future) . await ;
719+ let ( result, duration, alloc_info ) = CaptureFuture :: new ( future) . await ;
722720
723721 // wait for all spawned local tasks using `local` to finish
724722 let ltt = CURRENT_TASK_STATE
@@ -742,7 +740,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
742740 let schedule_again = this. backend . task_execution_completed (
743741 task_id,
744742 duration,
745- memory_usage,
743+ alloc_info . memory_usage ( ) ,
746744 & cell_counters,
747745 stateful,
748746 has_invalidator,
@@ -1794,35 +1792,6 @@ pub fn emit<T: VcValueTrait + ?Sized>(collectible: ResolvedVc<T>) {
17941792 } )
17951793}
17961794
1797- pub async fn spawn_blocking < T : Send + ' static > ( func : impl FnOnce ( ) -> T + Send + ' static ) -> T {
1798- let turbo_tasks = turbo_tasks ( ) ;
1799- let span = Span :: current ( ) ;
1800- let ( result, duration, alloc_info) = tokio:: task:: spawn_blocking ( || {
1801- let _guard = span. entered ( ) ;
1802- let start = Instant :: now ( ) ;
1803- let start_allocations = TurboMalloc :: allocation_counters ( ) ;
1804- let r = turbo_tasks_scope ( turbo_tasks, func) ;
1805- ( r, start. elapsed ( ) , start_allocations. until_now ( ) )
1806- } )
1807- . await
1808- . unwrap ( ) ;
1809- capture_future:: add_duration ( duration) ;
1810- capture_future:: add_allocation_info ( alloc_info) ;
1811- result
1812- }
1813-
1814- pub fn spawn_thread ( func : impl FnOnce ( ) + Send + ' static ) {
1815- let handle = Handle :: current ( ) ;
1816- let span = info_span ! ( "thread" ) . or_current ( ) ;
1817- thread:: spawn ( move || {
1818- let span = span. entered ( ) ;
1819- let guard = handle. enter ( ) ;
1820- func ( ) ;
1821- drop ( guard) ;
1822- drop ( span) ;
1823- } ) ;
1824- }
1825-
18261795pub ( crate ) async fn read_task_output (
18271796 this : & dyn TurboTasksApi ,
18281797 id : TaskId ,
0 commit comments