scaffold: thread Lib_index, has_virtual_impl, pps_runtime_libs through cctx#14514
Open
robinbb wants to merge 1 commit into
Open
scaffold: thread Lib_index, has_virtual_impl, pps_runtime_libs through cctx#14514robinbb wants to merge 1 commit into
robinbb wants to merge 1 commit into
Conversation
This was referenced May 13, 2026
a3ab9c8 to
55c7882
Compare
c804917 to
d37e419
Compare
There was a problem hiding this comment.
Pull request overview
This PR scaffolds dependency-filtering data through Compilation_context.t for later layers of the inter-library per-module dependency work.
Changes:
- Adds
lib_index,has_virtual_impl, andpps_runtime_libsto compilation contexts. - Builds a
Lib_file_deps.Lib_indexfrom direct/hidden library dependencies. - Exposes small helper APIs on
ModulesandDep_graph.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/dune_rules/modules.mli |
Exposes Modules.as_singleton. |
src/dune_rules/modules.ml |
Implements singleton detection for module sets. |
src/dune_rules/lib_rules.ml |
Passes PPX runtime libraries into library compilation contexts. |
src/dune_rules/exe_rules.ml |
Passes PPX runtime libraries into executable compilation contexts. |
src/dune_rules/dep_graph.mli |
Exposes dependency graph directory and membership helpers. |
src/dune_rules/dep_graph.ml |
Implements dependency graph directory and membership helpers. |
src/dune_rules/compilation_context.mli |
Adds accessors for lib index, virtual implementation status, and PPX runtime libraries. |
src/dune_rules/compilation_context.ml |
Stores new context fields and constructs the library dependency index. |
7459ded to
22fcd5f
Compare
Alizter
added a commit
that referenced
this pull request
May 14, 2026
#14513) Layer 1 of 9 stacked PRs reconstructing #14492 in reviewable layers. Adds the dataflow infrastructure subsequent layers consume — `Lib_file_deps.Lib_index`, `deps_of_entries`, `deps_of_entry_modules`, `Ocamldep.read_immediate_deps_words` (top-level cache keyed on (source path, ml_kind)), and `Ocamldep.read_immediate_deps_raw_of`. No consumer yet. Stack: this PR → main. Next: #14514. Part of #14492. Related to #4572.
0dfddde to
2d4b53c
Compare
…h cctx Pure-additive scaffolding for #4572's per-module inter-library filter. Fields are populated but no consumer reads them yet; the per-module filter (which is the only caller) lands in a follow-up. [Compilation_context]: - [build_lib_index]: builds a [Lib_file_deps.Lib_index.t] from the cctx's direct + hidden libs. Each entry carries [Some Module.t] for unwrapped locals (tight-eligible) and [None] otherwise (wrapped locals / externals). Local libs whose source is preprocessed by a non-staged ppx are indexed on the post-pp module so the cross-lib walker reads ocamldep on the same source the dep lib's compile pipeline produces. - Three new fields on [t]: [lib_index] (Memo.Lazy.t computing the index), [has_virtual_impl] (Memo.Lazy.t flag — true iff any dep lib implements a virtual lib), and [pps_runtime_libs] (closure of ppx_runtime_libraries introduced by [pps] in this stanza, threaded through [create]). - Accessors for each. [for_module_generated_at_link_time] populates [lib_index] with a [Code_error.raise] sentinel — the per-module filter's [can_filter] guard prevents reaching it from synthesised link-time cctxs. [Lib_rules] / [Exe_rules]: compute [pps_runtime_libs] from the stanza's [compile_info] and thread it through [Compilation_context.create]. [Dep_graph]: expose [dir] and [mem]; the cross-lib walker's [can_filter] guard uses these to detect synthesised dummy graphs. [Modules]: add [as_singleton] returning [Some m] iff the module set is a single user-written module. Used by [build_lib_index] to detect the single-module-no-deps short-circuit case. Signed-off-by: Robin Bate Boerop <me@robinbb.com>
2d4b53c to
87a2380
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Layer 2 of 9 of #14492.
Threads
lib_index,has_virtual_impl, andpps_runtime_libsthroughCompilation_context.t. Addsbuild_lib_index(constructs theLib_indexfrom the cctx's libs, indexing on post-pp modules for non-staged-ppx local libs). Wirespps_runtime_libsatLib_rules/Exe_rulescall sites. ExposesDep_graph.dir/memfor layer 4'scan_filterguard. AddsModules.as_singleton.Fields are populated but never read; consumers arrive in layer 4.
Stack: rebases on
main(L1 merged in #14513). Next: #14515.Part of #14492. Related to #4572.