Skip to content

Commit

Permalink
[Turbopack] Transient Tasks (#68436)
Browse files Browse the repository at this point in the history
### 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>
  • Loading branch information
sokra and bgw authored Aug 14, 2024
1 parent ada7d2f commit d50e041
Show file tree
Hide file tree
Showing 13 changed files with 508 additions and 301 deletions.
6 changes: 6 additions & 0 deletions turbopack/crates/turbo-tasks-macros/src/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,14 @@ impl TurboFn {
parse_quote! {
{
#assertions
let turbo_tasks_transient = #( turbo_tasks::TaskInput::is_transient(&#inputs) ||)* false;
<#output as turbo_tasks::task::TaskOutput>::try_from_raw_vc(
turbo_tasks::trait_call(
*#trait_type_id_ident,
std::borrow::Cow::Borrowed(stringify!(#ident)),
#converted_this,
Box::new((#(#inputs,)*)) as Box<dyn turbo_tasks::MagicAny>,
turbo_tasks_transient,
)
)
}
Expand All @@ -381,11 +383,13 @@ impl TurboFn {
parse_quote! {
{
#assertions
let turbo_tasks_transient = #( turbo_tasks::TaskInput::is_transient(&#inputs) ||)* false;
<#output as turbo_tasks::task::TaskOutput>::try_from_raw_vc(
turbo_tasks::dynamic_this_call(
*#native_function_id_ident,
#converted_this,
Box::new((#(#inputs,)*)) as Box<dyn turbo_tasks::MagicAny>,
turbo_tasks_transient
)
)
}
Expand All @@ -394,10 +398,12 @@ impl TurboFn {
parse_quote! {
{
#assertions
let turbo_tasks_transient = #( turbo_tasks::TaskInput::is_transient(&#inputs) ||)* false;
<#output as turbo_tasks::task::TaskOutput>::try_from_raw_vc(
turbo_tasks::dynamic_call(
*#native_function_id_ident,
Box::new((#(#inputs,)*)) as Box<dyn turbo_tasks::MagicAny>,
turbo_tasks_transient,
)
)
}
Expand Down
Loading

0 comments on commit d50e041

Please sign in to comment.