Skip to content

bugc: point at packed words' parts as their own regions - #398

Merged
gnidan merged 1 commit into
mainfrom
bugc-split-word-regions
Oct 15, 2026
Merged

gnidan merged 1 commit into
mainfrom
bugc-split-word-regions

Conversation

@gnidan

@gnidan gnidan commented Oct 15, 2026

Copy link
Copy Markdown
Member

A local of bytes or a string in calldata is held as one word: the offset of the bytes in its high 16 bytes and their length in its low 16 bytes. Its pointer used to name that whole word and have the calldata region compute its offset and length as ~quotient and ~remainder of the word by 2^128.

Now each half of the word is a region of its own, x-offset (bytes 0–15 of the word) and x-length (bytes 16–31), in memory or on the stack, and x-data reads them directly:

{
  "group": [
    { "name": "text-offset", "location": "stack", "slot": 2, "offset": 0, "length": 16 },
    { "name": "text-length", "location": "stack", "slot": 2, "offset": 16, "length": 16 },
    {
      "name": "text-data",
      "location": "calldata",
      "offset": { "~read": "text-offset" },
      "length": { "~read": "text-length" }
    }
  ]
}

The whole-word region x is gone, since nothing reads it any more. Code generation is unchanged, and the pointers read the same bytes as before at every level. The case study and the soundness harness are updated to match.

A local of bytes or a string in calldata is one word: the offset in
its high 16 bytes, the length in its low 16. Name each half as its own
region (x-offset, x-length) and have the calldata region read them,
instead of reading the whole word and taking ~quotient and ~remainder
by 2^128.
@gnidan
gnidan force-pushed the bugc-split-word-regions branch from ac9bcf8 to 2824f27 Compare October 15, 2026 18:28
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-15 18:44 UTC

@gnidan
gnidan merged commit 9c8d7cc into main Oct 15, 2026
8 checks passed
@gnidan
gnidan deleted the bugc-split-word-regions branch October 15, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant