← Back to Pull requests

evm: Load a whole CALLDATALOAD word directly from the input #1776

Closed
unknown closed this pull request without merging on Oct 26, 2026 14:09 UTC
View on GitHub
unknown unknown commented on Oct 24, 2026 09:05 UTC
Author

CALLDATALOAD copied every word through a zeroed 32-byte buffer, which GCC and Clang compile to a memcpy call, also when the whole word is in the input. That is nearly every CALLDATALOAD: 98.5% of them in a profile of 1000 recent mainnet blocks. Now the index is checked on its 64-bit words instead of with a 256-bit comparison, and a word that is entirely in the input is loaded in place. The index past the input and the word that the input ends inside stay inline, as the unlikely cases.

Instructions per CALLDATALOAD in the Baseline interpreter built for the default x86-64-v2, dispatch included, measured with callgrind on a loop of each case:

  • GCC 15: whole word 59 -> 29, input ending inside the word 58 -> 47, index past the input 27 -> 19, 4-byte input 62 -> 51.

  • Clang 21: whole word 60 -> 29, input ending inside the word 59 -> 48, index past the input 28 -> 22, 4-byte input 63 -> 52.
  • The Baseline loop's code is 41 bytes smaller with GCC and 16 bytes larger with Clang. The library's code is smaller with both, by 64 and 32 bytes.

    The new test loads the words at the end of the input. The input is followed by a non-zero byte, so a load that reads past its end gives a wrong result. The test also loads at the largest 64-bit index, where the index plus 32 overflows 64 bits, and at three indexes whose low word is inside the input while one of the high words is not zero.

    Diff: 173 lines (+129 / -44) across 2 files Reviewer: chfast Review duration: 3183m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.35) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.35 · 173 lines diff across 2 files
    0.35
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.309
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1776"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.3% (MEDIUM) · Higher = larger blast radius
    35.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.0% · Safe to merge
    14.0%
    Repository