-
Notifications
You must be signed in to change notification settings - Fork 27.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(turbo-tasks): Make State require OperationValue #73876
Conversation
Stats from current PRDefault BuildGeneral
Client Bundles (main, webpack)
Legacy Client Bundles (polyfills)
Client Pages
Client Build Manifests
Rendered Page Sizes
Edge SSR bundle Size
Middleware size
Next Runtimes
build cache
Diff detailsDiff for main-HASH.jsDiff too large to display |
4643014
to
5e78f92
Compare
a0a77bc
to
7db7c5c
Compare
2f5497e
to
069afc7
Compare
7db7c5c
to
d2b9792
Compare
069afc7
to
2170acd
Compare
d2b9792
to
3cf6efa
Compare
Tests Passed |
455bc9a
to
2b20793
Compare
3cf6efa
to
932adf3
Compare
…ed in `State<T>` types into OperationValues and/or NonLocalValues (#74008) This is a refactor ahead of #73876 This adds the `OperationValue` trait (and in a few cases, `NonLocalValue`) to a large number of types where it can be trivially done. These types are needed in #73876 because they're used somewhere inside of a `State<...>` type (most likely transitively).
6984ce9
to
efe589d
Compare
932adf3
to
7b4adf4
Compare
7b4adf4
to
631ff59
Compare
Deserialize, | ||
Debug, | ||
NonLocalValue, | ||
)] | ||
struct MapEntry { | ||
// must not be resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// must not be resolved |
The comment is no longer needed as OperationVc
tells the same on type level
@@ -191,6 +191,7 @@ pub enum Update { | |||
#[derive(PartialEq, Eq, Debug, Clone, TraceRawVcs, ValueDebugFormat, NonLocalValue)] | |||
pub struct TotalUpdate { | |||
/// The version this update will bring the object to. | |||
// TODO: This trace_ignore is *very* wrong, and could cause problems if/when we add a GC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very unsound, but currently correct. All values that implement the Version
trait, must not contain Vcs
(they must be flat. This is a requirement of the Version
trait, which represents a frozen version. It can't contain Vcs as they might change over-time, which is not what Version
represents.
We should probably at least document that on the Version
trait. Cool would be some kind of FrozenValue
trait, but it was not worth it for the few cases where we use that (Version,
PlainIssue,
PlainDiagnostic`).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually not correct because EcmascriptDevChunkListVersion
contains a ResolvedVc
, but I suppose the blame for that is on EcmascriptDevChunkListVersion
, not on this code.
I'll make some updates to the comments and document this on Version
though!
Enforcing this statically would be rather painful, as it would require adding yet another marker trait for values with no vc (resolved, operation, or otherwise).
efe589d
to
60e589c
Compare
631ff59
to
e6b66e1
Compare
60e589c
to
d240d45
Compare
e6b66e1
to
c6fe120
Compare
c6fe120
to
7aa49a6
Compare
Merge activity
|
I started writing this PR by requiring
OperationValue
inState
:And then went through changing every compilation error that occurred as a result.
Hacks
There are some hacks in a number of places here where we incorrectly convert
ResolvedVc
toOperationValue
.Unfortunately these have to exist because it's impractical to convert everything to
OperationValue
.OperationValues
are harder to construct as they must be created directly from the return value of an unresolved function call.Why does
State<T>
needT: OperationValue
?OperationVc
types require that.connect()
is called before their value can be read.As an internally-mutable type,
State
allowsVc
s to be passed in ways that we cannot track..connect()
re-connects theVc
to the dependency graph so that strong resolution is possible.Without this, you might end up with stale results when reading a
Vc
inside ofState
, which can be very hard to debug.Fundamentally, I think
State
is unsound, but this is a band-aid on it until we can migrate to a better solution (likely effect-styleCollectibles
forVersionedContentMap
).Closes PACK-3675