Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/pup/core/instruction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ auto fold_instruction(Instruction const& atoms, Site const& site) -> StringId
return buf.intern(global_pool());
}

} // namespace pup
}
17 changes: 2 additions & 15 deletions include/pup/graph/dag.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,10 @@ struct CommandNode {

SortedIdVec exported_vars = {}; ///< Env vars to export to command (interned StringIds)

// For generated rules (auto-generated from pattern matching)
std::optional<GeneratedOutput> generated_output = {}; ///< Output specification
OutputAction output_action = {}; ///< What to do with output
NodeId parent_command = INVALID_NODE_ID; ///< Parent command for InjectImplicitDeps

// Condition guards - command executes only if ALL guards are satisfied
// For nested conditionals, this accumulates all enclosing conditions
Vec<Guard> guards = {};
};

Expand Down Expand Up @@ -118,12 +115,8 @@ struct Graph {
NodeIdArenaIndex edges_to_index;
NodeIdArenaIndex edges_from_index;

// Node lookup indices
Vec<SortedPairVec> dir_children; ///< Per-directory name→NodeId index (indexed by parent dir)

// Structured path algebra
// mutable: memoized interning cache, written on the (const) read path.
// Single-threaded access only — not safe to share across threads.
mutable PathPool paths; ///< Interning trie of (parent PathId, basename StringId) entries
SortedPairVec path_to_node; ///< Resolve: PathId → NodeId (reverse of FileNode::path_id)

Expand Down Expand Up @@ -343,7 +336,7 @@ inline constexpr auto parsed_consumers = static_cast<LinkTypeMask>(consumers & ~
/// The half only the index carries: a discovered dependency is never parsed from a Tupfile,
/// so its consumer has no graph edge to cascade over and must be routed on every change.
inline constexpr auto discovered_consumers = link_type_bit(LinkType::Implicit);
} // namespace edge_mask
}

/// Visit neighbor ids by direction and type mask without materializing a Vec.
/// The allocation-free form for hot traversals (topo sort, reachability).
Expand Down Expand Up @@ -491,16 +484,10 @@ auto set_build_root_name(Graph& graph, std::string_view name) -> void;
[[nodiscard]]
auto get_build_root_name(Graph const& graph) -> std::string_view;

// =============================================================================
// BuildGraph - thin data carrier (replaces BuildGraph over time)
// =============================================================================

/// Simple aggregate holding the graph and its path cache.
/// Replaces BuildGraph as a thin data carrier with no methods.
struct BuildGraph {
Graph graph;
// mutable: memoization written by get_full_path on the (const) read path.
// Single-threaded access only — not safe to share across threads.
mutable PathCache path_cache;
};

Expand Down Expand Up @@ -544,4 +531,4 @@ auto collect_upstream_files(
/// Set build root name and clear path cache
auto set_build_root_name(BuildGraph& state, std::string_view name) -> void;

} // namespace pup::graph
}
4 changes: 1 addition & 3 deletions include/pup/index/entry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,10 @@ class Index final {
Vec<CommandEntry> commands_ = {};
Vec<EdgeEntry> edges_ = {};

// Edge indices (indices into edges_ vector)
Arena32 edge_arena_;
NodeIdArenaIndex edges_from_index_;
NodeIdArenaIndex edges_to_index_;

// Index save time (nanoseconds since epoch) for racy-clean detection
std::int64_t save_time_ns_ = 0;

[[nodiscard]]
Expand Down Expand Up @@ -263,4 +261,4 @@ auto files_by_path(Index const& index) -> FilesByPath;
[[nodiscard]]
auto get_command_string(Index const& index, CommandEntry const& cmd) -> StringId;

} // namespace pup::index
}
7 changes: 1 addition & 6 deletions include/pup/index/format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,6 @@ static_assert(
"a flag's value is on-disk format, not implementation: changing one needs an INDEX_VERSION bump"
);

// Widening this record adds a category of recorded state, and a category is only useful once all
// three of its legs exist: written here, compared where staleness is decided, and routed so the
// commands that depend on it are scheduled. A category with a missing leg is a silent wrong build,
// which is the shape #189 catalogues — so the size is fixed deliberately, to stop a new field
// reaching the index before someone has answered for all three.
static_assert(
sizeof(RawCommandEntry) == 88,
"RawCommandEntry changed size: bump INDEX_VERSION, and wire the new state's three legs "
Expand Down Expand Up @@ -358,4 +353,4 @@ inline auto set_node_flags(RawFileEntry& entry, NodeFlags flags) -> void
entry.flags_high = static_cast<std::uint8_t>(value >> 8);
}

} // namespace pup::index
}
6 changes: 3 additions & 3 deletions include/pup/parser/eval.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ constexpr auto TUP_VARIANTDIR = "TUP_VARIANTDIR";
constexpr auto TUP_VARIANT_OUTPUTDIR = "TUP_VARIANT_OUTPUTDIR";
constexpr auto TUP_SRCDIR = "TUP_SRCDIR";
constexpr auto TUP_OUTDIR = "TUP_OUTDIR";
constexpr auto CONFIG_ = "CONFIG_"; // Prefix for @() variables
} // namespace builtin_vars
constexpr auto CONFIG_ = "CONFIG_";
}

} // namespace pup::parser
}
Loading
Loading