Skip to content

Commit d50e041

Browse files
sokrabgw
andauthored
[Turbopack] Transient Tasks (#68436)
### What? use different task ids for persistent and transient tasks Store transient tasks separately Rename PersistentTaskType -> CachedTaskType Track which tasks are transient and which are persistent. ### Why? We need to track that for persistent caching. We use a different task id space for transient tasks so they don't use up persistent ids and to easily identify transient tasks. ### How? --------- Co-authored-by: Benjamin Woodruff <benjamin.woodruff@vercel.com>
1 parent ada7d2f commit d50e041

File tree

13 files changed

+508
-301
lines changed

13 files changed

+508
-301
lines changed

turbopack/crates/turbo-tasks-macros/src/func.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,14 @@ impl TurboFn {
352352
parse_quote! {
353353
{
354354
#assertions
355+
let turbo_tasks_transient = #( turbo_tasks::TaskInput::is_transient(&#inputs) ||)* false;
355356
<#output as turbo_tasks::task::TaskOutput>::try_from_raw_vc(
356357
turbo_tasks::trait_call(
357358
*#trait_type_id_ident,
358359
std::borrow::Cow::Borrowed(stringify!(#ident)),
359360
#converted_this,
360361
Box::new((#(#inputs,)*)) as Box<dyn turbo_tasks::MagicAny>,
362+
turbo_tasks_transient,
361363
)
362364
)
363365
}
@@ -381,11 +383,13 @@ impl TurboFn {
381383
parse_quote! {
382384
{
383385
#assertions
386+
let turbo_tasks_transient = #( turbo_tasks::TaskInput::is_transient(&#inputs) ||)* false;
384387
<#output as turbo_tasks::task::TaskOutput>::try_from_raw_vc(
385388
turbo_tasks::dynamic_this_call(
386389
*#native_function_id_ident,
387390
#converted_this,
388391
Box::new((#(#inputs,)*)) as Box<dyn turbo_tasks::MagicAny>,
392+
turbo_tasks_transient
389393
)
390394
)
391395
}
@@ -394,10 +398,12 @@ impl TurboFn {
394398
parse_quote! {
395399
{
396400
#assertions
401+
let turbo_tasks_transient = #( turbo_tasks::TaskInput::is_transient(&#inputs) ||)* false;
397402
<#output as turbo_tasks::task::TaskOutput>::try_from_raw_vc(
398403
turbo_tasks::dynamic_call(
399404
*#native_function_id_ident,
400405
Box::new((#(#inputs,)*)) as Box<dyn turbo_tasks::MagicAny>,
406+
turbo_tasks_transient,
401407
)
402408
)
403409
}

0 commit comments

Comments
 (0)