Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Under the Hood of Rust Language with Assembly - Rust Programming Tutorial

Chris Hay via YouTube

Overview

Dive deep into the inner workings of Rust by exploring its assembly language output in this comprehensive 28-minute tutorial. Learn how to generate assembly from Rust code, understand stack memory allocation, and decipher Rust's representation in assembly. Gain proficiency in assembly language statements, registers, stack and memory storage, and walk through Rust-generated assembly step-by-step. Convert a simple Rust program to assembly using native compilation for Apple Silicon and cross-compilation to x64, utilizing tools like Godbolt for easier comprehension. Analyze the generated assembly line-by-line, uncovering the underlying processes. Master advanced concepts such as stack frame memory allocation, variable assignment, multiplication in assembly, overflow checks, compiler optimizations, and more. By the end, you'll have a solid foundation for becoming an advanced Rust programming expert with a deep understanding of its low-level operations.

Syllabus

- introduction
- create our rust project
- target folder and rust compile
- emitting rust assembly during compile
- cross compiling rust from apple silicon arm to x64 assembly
- emitting x64 assembly
- cargo show asm
- emitting rust assembly interleaved with rust using cargo show asm
- generating x64 intel assembly using rust and godbolt
- understanding stack frame memory allocation, stack pointer, rsp and sub
- variable assignment, mov and virtual registers
- assembly multiplication using imul
- storing local variables in the stack / stack frame memory for later use
- overflow checks and panickibng
- more calculations and some compiler optmizations
- understanding stack memory and primitive sizes and fixed memory
- jmp's are goto's in disguise
- more stack memory and compiler optimizations
- printing the result
- To Be Continued

Taught by

Chris Hay

Reviews

Start your review of Under the Hood of Rust Language with Assembly - Rust Programming Tutorial

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.