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

Introduce std.mem.readPackedInt and improve bitcasting of packed memory layouts #13221

Merged
merged 5 commits into from
Oct 29, 2022

Commits on Oct 28, 2022

  1. std.mem: Add readPackedInt, writePackedInt, etc.

    These utility functions allow reading from (stage2) packed memory at
    runtime-known offsets.
    topolarity committed Oct 28, 2022
    Configuration menu
    Copy the full SHA
    c639c22 View commit details
    Browse the repository at this point in the history
  2. stage2: Use mem.readPackedInt etc. for packed bitcasts

    Packed memory has a well-defined layout that doesn't require
    conversion from an integer to read from. Let's use it :-)
    
    This change means that for bitcasting to/from a packed value that
    is N layers deep, we no longer have to create N temporary big-ints
    and perform N copies.
    
    Other miscellaneous improvements:
      - Adds support for casting to packed enums and vectors
      - Fixes bitcasting to/from vectors outside of a packed struct
      - Adds a fast path for bitcasting <= u/i64
      - Fixes bug when bitcasting f80 which would clear following fields
    
    This also changes the bitcast memory layout of exotic integers on
    big-endian systems to match what's empirically observed on our targets.
    Technically, this layout is not guaranteed by LLVM so we should probably
    ban bitcasts that reveal these padding bits, but for now this is an
    improvement.
    topolarity committed Oct 28, 2022
    Configuration menu
    Copy the full SHA
    3295fee View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9d0a4b6 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    03ed0a5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    40b7792 View commit details
    Browse the repository at this point in the history