мост между C++/Rust и машинным кодомthe bridge between C++/Rust and machine code

Compiler-Aware Optimization (x86_64 и ARM64)(x86_64 & ARM64)

Практический мост между высокоуровневой семантикой C++20/Rust и машинным кодом x86_64/ARM64: обратный инжиниринг выхлопа компиляторов через Compiler Explorer (Godbolt), узкие места конвейера CPU, устранение неявных накладных расходов, автовекторизация. Каркас: 7 глав, 21 пункт, страницы ещё не написаны.A practical bridge between C++20/Rust high-level semantics and x86_64/ARM64 machine code: reverse-engineering compiler output via Compiler Explorer (Godbolt), CPU pipeline bottlenecks, eliminating implicit overhead, autovectorization. Skeleton: 7 chapters, 21 items, pages not yet written.

1. Инструментарий Godbolt и методология чтения ASM1. Godbolt tooling & ASM-reading methodology

настройка среды анализаsetting up the analysis environment

2. Базовые паттерны трансляции: от C++/Rust к ассемблеру2. Basic translation patterns: from C++/Rust to assembly

2.1 Анатомия вызовов (ABI & Calling Conventions)Anatomy of calls (ABI & calling conventions)Передача аргументов через регистры (rdi–r9 в x86_64 vs x0–x7 в ARM64), стековый фрейм, роль Link Register (x30) в ARM.Passing arguments via registers (rdi–r9 in x86_64 vs x0–x7 in ARM64), the stack frame, the role of the Link Register (x30) in ARM.interview 2.2 Избавление от ветвлений (Branch Elimination)Branch eliminationif-else и match превращаются в cmov (x86_64) и csel/csinc (ARM64) для предотвращения промахов предсказателя переходов.if-else and match turning into cmov (x86_64) and csel/csinc (ARM64) to avoid branch-predictor misses.interview 2.3 Управление проверками границBounds-checking eliminationНеявные проверки индексации в Rust/C++ (panic_bounds_check), влияние на конвейер, устранение через итераторы, assert! и get_unchecked.Implicit indexing checks in Rust/C++ (panic_bounds_check), their pipeline cost, elimination via iterators, assert!, and get_unchecked. 2.4 Алиасинг указателей и __restrictPointer aliasing & __restrictВлияние гипотезы о перекрытии памяти на лишние инструкции чтения (mov/ldr) и разблокировку агрессивных оптимизаций.How the memory-overlap assumption forces redundant load instructions (mov/ldr), and how to unlock aggressive optimizations.

3. Глубокий анализ x86_64 (CISC Optimization Patterns)3. Deep dive: x86_64 (CISC optimization patterns)

4. Глубокий анализ ARM64 / AArch64 (RISC Optimization Patterns)4. Deep dive: ARM64 / AArch64 (RISC optimization patterns)

5. Автовекторизация (SIMD) и векторные расширения5. Autovectorization (SIMD) & vector extensions

6. Практический рефакторинг: от «плохого» ASM к «идеальному» (Case Studies)6. Practical refactoring: from "bad" ASM to "ideal" (case studies)

7. Чек-лист диагностики и алгоритм анализа7. Diagnostics checklist & analysis algorithm

шпаргалка для быстрой отладки производительностиa cheat sheet for quick performance debugging

статусstatus

Это каркас: 7 глав и 21 пункт зафиксированы, страницы ещё не написаны. Метка interview отмечает пункты, которые чаще всего всплывают на технических собеседованиях (calling conventions, branch elimination, magic-number division, atomics/memory barriers, LLVM-MCA, SIMD-выхлоп). Содержимое адаптировано из kb/assembler.md — личного высокоуровневого плана, а не готового текста. В отличие от theory/, это практический раздел — не абстрактная теория, а прикладной мост между C++/Rust и конкретным машинным кодом компиляторов, поэтому он вынесен на верхний уровень отдельно от языков и от theory/. Заголовки пунктов здесь пронумерованы по главам (1.1–7.2), а не по формату X.Y.Z, так как источник организован как учебник, а не как плоский список тем.This is a skeleton: 7 chapters and 21 items are locked in, pages not yet written. The interview tag marks the items that come up most often in technical interviews (calling conventions, branch elimination, magic-number division, atomics/memory barriers, LLVM-MCA, SIMD output). Content is adapted from kb/assembler.md — a personal high-level outline, not finished prose. Unlike theory/, this is a practical section — not abstract theory, but an applied bridge between C++/Rust and the concrete machine code compilers emit, which is why it sits at the top level, separate from both the languages and theory/. Item numbering here follows chapters (1.1–7.2) rather than the X.Y.Z format, since the source is organized as a textbook rather than a flat topic list.