Skip to content

Tier 2 optimizer's abstract interpreter #114058

Closed

Activity

  1. markshannon commented on Feb 8, 2024

    @markshannon
    Member

    We need a lattice of values that embodies type information, NULLness, Noneness, constant values, version numbers, at the least.

    The lattice should look something like this:

    graph BT;
        t("True");
        f("False");
        bl("bool");
        nnull(not NULL);
        nnone(not None);
        ot(other types);
        oc(other constants);
        b("bottom(unknown)");
        b-->NULL;
        b-->nnull;
        nnull-->nnone;
        nnull-->None;
        nnone-->ot;
        nnone-->bl;
        ot-->oc;
        oc-->top;
        None-->top;
        NULL-->top;
        bl-->t;
        bl-->f;
        t-->top;
        f-->top;
    
    Loading
  2. markshannon commented on Feb 8, 2024

    @markshannon
    Member

    There should be edges from all the nodes (except bottom) to top, but I've omitted those to avoid the diagram becoming a mess

  3. added a commit that references this issue on Feb 13, 2024
  4. added a commit that references this issue on Feb 14, 2024
  5. added 2 commits that reference this issue on Feb 14, 2024
  6. gvanrossum commented on Feb 21, 2024

    @gvanrossum
    Member

    There should be edges from all the nodes (except bottom) to top, but I've omitted those to avoid the diagram becoming a mess

    Maybe top needn't be part of the diagram at all? It ought to be unreachable (IIUC it represents an impossible condition). Might as well simplify the diagram a bit further.

  7. added 2 commits that reference this issue on Feb 23, 2024
  8. gvanrossum commented on Feb 25, 2024

    @gvanrossum
    Member

    According to Wikipedia, in type theory, Bottom (⊥) is the type that has no values, whereas Top (⊤) is the type that encompasses all values. Maybe we should switch to this terminology, and swap top and bottom in the diagram above, so that "unknown" is named "top" and there is an arrow from every other nod to "bottom"? (Possibly also just flipping the diagram upside down so that "top" is drawn at the top and "bottom" at the bottom?)

  9. gvanrossum commented on Feb 25, 2024

    @gvanrossum
    Member
    graph TB;
        t("True");
        f("False");
        bl("bool");
        nnull(not NULL);
        nnone(not None);
        ot(other types);
        oc(other constants);
        top("top (unknown)");
        bottom("bottom (contradiction)");
        top-->NULL;
        top-->nnull;
        nnull-->nnone;
        nnull-->None;
        nnone-->ot;
        nnone-->bl;
        ot-->oc;
        oc-->bottom;
        None-->bottom;
        NULL-->bottom;
        bl-->t;
        bl-->f;
        t-->bottom;
        f-->bottom;
    
    Loading
  10. gvanrossum commented on Feb 26, 2024

    @gvanrossum
    Member

    Offline we agreed that Top is the universal type and Bottom is the empty type, like in my latest diagram. I will update diagrams and text where these terms are used.

  11. gvanrossum commented on Feb 26, 2024

    @gvanrossum
    Member
  12. deleted a comment from on Feb 26, 2024
  13. added 2 commits that reference this issue on Mar 4, 2024
  14. added 2 commits that reference this issue on Apr 17, 2024
  15. added 2 commits that reference this issue on Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions