Skip to content

Clarify cross-crate dependency story #32015

Closed

Description

@nikomatsakis

We're currently doing some wrong-ish things with respect to dep-graph tracking across crate boundaries. I think what I want to do is this:

  • Create a DepNode::MetaData(DefId) variant that plays a role like Hir
    • it basically represents the metadata for some item
  • Whenever we load from metadata for item X, we'll generate a read on MetaData(X)
  • In the metadata, we'll include a hash for each item, either:
    • hashing the saved contents of the item
    • or hashing all the base input nodes that are deps of the things serialized into
    • basically some hash we can use to tell if the metadata for an item changed in some way
  • When we save the dep-graph, we'll save the hash out of the crate metadata
  • When we load, we'll reload the hash out of the current crate metadata and compare

For inlined items, I hope we will transition to MIR and not need to inline sooner or later, but in the meantime, I think we can basically translate reads to Hir(X) where X is an inlined def-id to MetaData(Y) where Y is the original def-id -- we may also just be able to ignore accesses to inlined def-ids, since we'll presumably add an appropriate edge from some other source.

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    A-incr-compArea: Incremental compilation
    on Mar 2, 2016
  2. self-assigned this
    on Mar 2, 2016
  3. added a commit that references this issue on Apr 7, 2016
  4. michaelwoerister commented on Jul 19, 2016

    @michaelwoerister
    Member

    I think this is implemented (mostly via #32016) except for correctly handling access to inlined HIR.
    As far as I can see, there is no special handling of inlined HIR anywhere, which means that the following will happen:

    1. When an item gets inlined during trans, we will add a new HIR-depnode for the inline-copy of the item.
    2. This inline-copy has a local DefId, thus its hash will be stored with any other HIR dep-nodes in the dep-graph.
    3. When loading the dep-graph during the next round, the corresponding AST/HIR is not present, as it has not been inlined yet.
    4. As a consequence of (3), everything dependent on the inlined item will be invalidated.
  5. nikomatsakis commented on Jul 23, 2016

    @nikomatsakis
    ContributorAuthor

    @michaelwoerister

    I think this is implemented (mostly via #32016) except for correctly handling access to inlined HIR.

    I agree -- however, it seems like inlined HIR is going away. That is, once we transition to MIR trans, this point will no longer be an issue, right?

  6. added this to the milestone on Jul 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-incr-compArea: Incremental compilationT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions