mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
Add the core execution types needed for the async refactor (#4390)
* Add the core execution types, the borrowed context, and the seeded u64 fx hasher * Fix frame table key aliasing and arena handle offset truncation * Drop arena entries in reverse allocation order and require Send + Sync payloads * Draw arena generations from a global counter so foreign handles never upgrade * Forward serialize through node wrappers and free abandoned frame table reservations * Make arena generation exhaustion fallible with an unsafe counter rewind * Guard the shared generation counter in tests and reject oversized batch ranges * Park the arena during drop glue, guard filled batches, and normalize deserialized sources * Make the sources fields private and normalize them on every mutation * Remove the unused CtxSnapshot scope reconstruction
This commit is contained in:
@@ -309,6 +309,7 @@ macro_rules! tagged_value {
|
||||
pub fn from_type(input: &Type) -> Option<Self> {
|
||||
match input {
|
||||
Type::Generic(_) => None,
|
||||
Type::Ref(_) => None,
|
||||
Type::Concrete(concrete_type) => {
|
||||
let name = concrete_type.name.as_ref();
|
||||
// TODO: Add default implementations for types such as TaggedValue::Subpaths, and use the defaults here and in document_node_types
|
||||
@@ -569,6 +570,7 @@ impl TaggedValue {
|
||||
|
||||
match ty {
|
||||
Type::Generic(_) => None,
|
||||
Type::Ref(_) => None,
|
||||
Type::Concrete(concrete_type) => {
|
||||
let ty = concrete_type.id?;
|
||||
use std::any::TypeId;
|
||||
|
||||
@@ -370,13 +370,16 @@ impl ProtoNetwork {
|
||||
let mut combined_deps = ContextFeatures::default();
|
||||
let node_index = id.0 as usize;
|
||||
|
||||
let context_features = self.nodes[node_index].1.context_features;
|
||||
let (extract, inject) = {
|
||||
let dependencies = &self.nodes[node_index].1.context_features;
|
||||
(dependencies.extract, dependencies.inject)
|
||||
};
|
||||
|
||||
let mut inputs = match &self.nodes[node_index].1.construction_args {
|
||||
// We pretend like we have already placed context modification nodes after ourselves because value nodes don't need to be cached
|
||||
ConstructionArgs::Value(_) => return (context_features.extract, Some(id)),
|
||||
ConstructionArgs::Value(_) => return (extract, Some(id)),
|
||||
ConstructionArgs::Nodes(items) => items.clone(),
|
||||
ConstructionArgs::Inline(_) => return (context_features.extract, Some(id)),
|
||||
ConstructionArgs::Inline(_) => return (extract, Some(id)),
|
||||
};
|
||||
|
||||
// Compute the dependencies for each branch and combine all of them
|
||||
@@ -389,9 +392,9 @@ impl ProtoNetwork {
|
||||
let mut new_deps = combined_deps;
|
||||
|
||||
// Remove requirements which this node provides
|
||||
new_deps &= !context_features.inject;
|
||||
new_deps &= !inject;
|
||||
// Add requirements we have
|
||||
new_deps |= context_features.extract;
|
||||
new_deps |= extract;
|
||||
|
||||
// If we either introduce new dependencies, we can cache all children which don't yet need that dependency
|
||||
let we_introduce_new_deps = !combined_deps.contains(new_deps);
|
||||
@@ -407,7 +410,7 @@ impl ProtoNetwork {
|
||||
self.nodes[node_index].1.construction_args = ConstructionArgs::Nodes(inputs);
|
||||
|
||||
// Which dependencies do we supply (and don't need ourselves)?
|
||||
let net_injections = context_features.inject.difference(context_features.extract);
|
||||
let net_injections = inject.difference(extract);
|
||||
|
||||
// Which dependencies still need to be met after this node?
|
||||
let remaining_deps_from_children = combined_deps.difference(net_injections);
|
||||
|
||||
Reference in New Issue
Block a user