Skip to content

RONDB-880#16

Open
svenssonaxel wants to merge 4 commits into
mronstro:24.10-mainfrom
svenssonaxel:RONDB-880
Open

RONDB-880#16
svenssonaxel wants to merge 4 commits into
mronstro:24.10-mainfrom
svenssonaxel:RONDB-880

Conversation

@svenssonaxel

Copy link
Copy Markdown

No description provided.

@svenssonaxel
svenssonaxel changed the base branch from 22.10-dev to 24.10-main April 2, 2025 18:51
@mronstro
mronstro force-pushed the 24.10-main branch 9 times, most recently from 6e4c18e to 357ced2 Compare July 25, 2025 22:45
mronstro pushed a commit that referenced this pull request May 4, 2026
Adds extract_one_arm64() alongside extract_one_x86. Two-pass walk:

  Pass 1 — relocations: strip the trailing R_AARCH64_CALL26/JUMP26
    `b next` (4 bytes) for ordinary stencils; for the branch
    stencil keep both unconditional branches and classify the one
    against `next` as HK_BRANCH_FALL, the one against HOLE_BLT_TGT
    as HK_BRANCH_TAKE.

  Pass 2 — magic-byte chain scan: walk every 4-byte instruction in
    the trimmed stencil, decode movz/movk (sf=1 forms), accumulate
    per-Rd 64-bit value with per-slot byte offsets. When a register
    matches one of the magics in kHoleMagicTable, emit four Hole
    entries (one per imm16 slot, width=4, all sharing the kind from
    the table). Reset on match to avoid double-counting. movn-based
    chains are deliberately not detected — none of the random
    magics trigger movn lowering.

Also adds kArm64Terminator (ldp x20, x30, [sp], #16; ret) — paired
with the future Day 4 jit1 aarch64 preamble — and refactors
emit_header to take the predef-macro string directly instead of
constructing __%s__ from an arch tag.

Verified on macOS Apple Silicon with brew llvm@20:
  - aarch64 extraction yields 8 stencils with hole counts matching
    expectations (4 per magic chain plus branch relocs).
  - LCI_DST chain in op_load_const_int shows the expected
    interleaving (offsets 24,28,36,40 — clang slipped a non-mov
    instruction between slots 16 and 32) — extractor handled
    correctly via per-Rd accumulators.
  - op_branch_lt_int_int chains BLT_A/BLT_B interleaved slot-by-slot
    (clang scheduled both chains in lockstep) — handled correctly.
  - x86_64 regression: cross-compiled stencils.o re-extracts to the
    same bytes as the Phase 1 hand-authored stencils_x86_64.h for
    all 6 non-trivial stencils.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mronstro pushed a commit that referenced this pull request May 29, 2026
Adds extract_one_arm64() alongside extract_one_x86. Two-pass walk:

  Pass 1 — relocations: strip the trailing R_AARCH64_CALL26/JUMP26
    `b next` (4 bytes) for ordinary stencils; for the branch
    stencil keep both unconditional branches and classify the one
    against `next` as HK_BRANCH_FALL, the one against HOLE_BLT_TGT
    as HK_BRANCH_TAKE.

  Pass 2 — magic-byte chain scan: walk every 4-byte instruction in
    the trimmed stencil, decode movz/movk (sf=1 forms), accumulate
    per-Rd 64-bit value with per-slot byte offsets. When a register
    matches one of the magics in kHoleMagicTable, emit four Hole
    entries (one per imm16 slot, width=4, all sharing the kind from
    the table). Reset on match to avoid double-counting. movn-based
    chains are deliberately not detected — none of the random
    magics trigger movn lowering.

Also adds kArm64Terminator (ldp x20, x30, [sp], #16; ret) — paired
with the future Day 4 jit1 aarch64 preamble — and refactors
emit_header to take the predef-macro string directly instead of
constructing __%s__ from an arch tag.

Verified on macOS Apple Silicon with brew llvm@20:
  - aarch64 extraction yields 8 stencils with hole counts matching
    expectations (4 per magic chain plus branch relocs).
  - LCI_DST chain in op_load_const_int shows the expected
    interleaving (offsets 24,28,36,40 — clang slipped a non-mov
    instruction between slots 16 and 32) — extractor handled
    correctly via per-Rd accumulators.
  - op_branch_lt_int_int chains BLT_A/BLT_B interleaved slot-by-slot
    (clang scheduled both chains in lockstep) — handled correctly.
  - x86_64 regression: cross-compiled stencils.o re-extracts to the
    same bytes as the Phase 1 hand-authored stencils_x86_64.h for
    all 6 non-trivial stencils.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mronstro pushed a commit that referenced this pull request Jun 5, 2026
Adds extract_one_arm64() alongside extract_one_x86. Two-pass walk:

  Pass 1 — relocations: strip the trailing R_AARCH64_CALL26/JUMP26
    `b next` (4 bytes) for ordinary stencils; for the branch
    stencil keep both unconditional branches and classify the one
    against `next` as HK_BRANCH_FALL, the one against HOLE_BLT_TGT
    as HK_BRANCH_TAKE.

  Pass 2 — magic-byte chain scan: walk every 4-byte instruction in
    the trimmed stencil, decode movz/movk (sf=1 forms), accumulate
    per-Rd 64-bit value with per-slot byte offsets. When a register
    matches one of the magics in kHoleMagicTable, emit four Hole
    entries (one per imm16 slot, width=4, all sharing the kind from
    the table). Reset on match to avoid double-counting. movn-based
    chains are deliberately not detected — none of the random
    magics trigger movn lowering.

Also adds kArm64Terminator (ldp x20, x30, [sp], #16; ret) — paired
with the future Day 4 jit1 aarch64 preamble — and refactors
emit_header to take the predef-macro string directly instead of
constructing __%s__ from an arch tag.

Verified on macOS Apple Silicon with brew llvm@20:
  - aarch64 extraction yields 8 stencils with hole counts matching
    expectations (4 per magic chain plus branch relocs).
  - LCI_DST chain in op_load_const_int shows the expected
    interleaving (offsets 24,28,36,40 — clang slipped a non-mov
    instruction between slots 16 and 32) — extractor handled
    correctly via per-Rd accumulators.
  - op_branch_lt_int_int chains BLT_A/BLT_B interleaved slot-by-slot
    (clang scheduled both chains in lockstep) — handled correctly.
  - x86_64 regression: cross-compiled stencils.o re-extracts to the
    same bytes as the Phase 1 hand-authored stencils_x86_64.h for
    all 6 non-trivial stencils.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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