Skip to content

RFC: major rewrite for world age and possibly inference? #676

@timholy

Description

@timholy

Recent and pending PRs fix nearly all the test failures in JuliaInterpreter; the few that are left seem a consequence of the binding partitioning/world age on globals. I also took a peek at LoweredCodeUtils, the next stop on the march towards Revise, and from what I can tell, the bleeding-edge JuliaInterpreter fixes everything except about 7 test failures, all of which appear to be about world age. Thus I think this is the main issue left to address.

There seem to be two potential paths:

  1. Extend support for world ages in the current framework. There is a start on that, but we'd have to ensure that all accesses to globals use invoke_in_world. We'd also likely want new options, e.g., @interpret world=:latest foo(args...). With this we cannot resolve globals during the "frame compilation" phase, we have to leave them as GlobalRefs.
  2. Do 1, plus provide an invalidation framework. I suspect that the only possible approach here is to incorporate type-inferred code, and keep a reference to the corresponding CodeInstance; then, when you descend into a frame, you first check world ages to see whether it's been invalidated in the meantime. This would, I think, allow us to resolve globals during compilation, and obviously optimize our method dispatches as well.

In the short term, I strongly favor 1. 2 might be better done as part of a larger restructuring around, say, JuliaLowering. I'd be curious whether others have different thoughts about the right approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions