Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal: data-oriented storage for TLib #797

Merged
merged 3 commits into from
Jul 15, 2023

Commits on Jul 14, 2023

  1. internal: data-oriented TLib storage

    Summary
    =======
    
    Replace storing `TLib` objects as `ref`s in `TSym` with storing all
    `TLib` instances belonging to a module in a sequence that a `TSym` then
    stores an index into.
    
    This slightly reduces the size of `TSym` and, more importantly, makes
    serializing the symbols and associated `TLib` instances easier: instead
    of storing a `PackedLib` for *each* packed symbol, the packed symbols
    now only store an index into the attached-to module's packed lib list.
    
    Details
    =======
    
    For simplicity, the list with the libs for a module is stored in a
    separate `seq` in `ModuleGraph`. The list cannot be stored in
    `PContext`, as it needs to be accessible after semantic analysis, at
    which point `PContext` is already gone.
    
    Storing the `TLib` objects for a module happens when the module is
    closed. While not strictly necessary at the moment, this is a
    preparation for storing a `PSym` in `TLib.name` that is only set
    up once the module is closed.
    
    Aside from reducing the size of rodfiles, not storing a `PackedLib`
    for each `PackedSym` also fixes another inefficiency, namely that
    each deserialized got a unique, possibly duplicated, `TLib`
    instance.
    zerbina committed Jul 14, 2023
    Configuration menu
    Copy the full SHA
    faa65aa View commit details
    Browse the repository at this point in the history

Commits on Jul 15, 2023

  1. support foreign TLib references

    A symbol can now reference the `TLib` belonging to a module that is not
    the one the symbol is attached to. This works around an issue with
    aliased structural types.
    
    Also, use the ID provided by the module's ID generator instead of the
    `skModule`s position. While both represent the same thing (a
    ``FileIndex``), querying the ID generator is more consistent with how it
    works elsewhere.
    zerbina committed Jul 15, 2023
    Configuration menu
    Copy the full SHA
    6f3988a View commit details
    Browse the repository at this point in the history
  2. ic: properly handle module references

    A module ID isn't necessarily the same before and after loading/storing
    a rodfile. Loading and storing of `LibId`s now considers this.
    zerbina committed Jul 15, 2023
    Configuration menu
    Copy the full SHA
    2ce0fb9 View commit details
    Browse the repository at this point in the history