Get under the hood of Rust Language with Assembly!! Rust Programming Tutorial

Chris Hay
Chris Hay
33.3 هزار بار بازدید - 2 سال پیش - If you want to truly
If you want to truly understand how Rust works and what happens under the hood, it's worth learning the assembly that rust generates during the compile.  By understanding Rust Assembly you can truly understand Rust Programming and become a master of the Rust Language (RustLang).

By the end of this video, you'll understand how to generate assembly from rust, how stack memory allocation works in rust programming and how rustlang is represented in assembly.  You'll even be comfortable with assembly language statements, registers, stack and memory storage, and be able to walkthrough rust generated assembly yourself.

In this video we take a simple rust program and we convert it to assembly on your machine using native compilation (apple silicon) and cross compiling to x64 and emitting intel assembly.  In addition we use a simple online tool called godbot which makes it easier to understand the assembly.

We then take our simple rust program and break down the generated assembly line by line, so understand what's happening underneath the hood.

Understanding assembly Language and the assembly rust generates will help you on that journey to becoming and Advanced Rust Programming expert.

00:00 - introduction
01:03 - create our rust project
03:36 - target folder and rust compile
04:27 - emitting rust assembly during compile
05:42 - cross compiling rust from apple silicon arm to x64 assembly
08:26 - emitting x64 assembly
09:10 - cargo show asm
09:23 - emitting rust assembly interleaved with rust using cargo show asm
11:10 - generating x64 intel assembly using rust and godbolt
12:30 - understanding stack frame memory allocation, stack pointer, rsp and sub
14:22 - variable assignment, mov and virtual registers
15:45 - assembly multiplication using imul
17:30 - storing local variables in the stack / stack frame memory for later use
19:10 - overflow checks and panickibng
21:10 - more calculations and some compiler optmizations
22:11 - understanding stack memory and primitive sizes and fixed memory
23:48 - jmp's are goto's in disguise
24:20 - more stack memory and compiler optimizations
27:45 - printing the result
28:08 - To Be Continued
2 سال پیش در تاریخ 1401/05/31 منتشر شده است.
33,322 بـار بازدید شده
... بیشتر