Optimizing Struct Layout for Memory Efficiency and Performance
When a struct is instantiated, its members are stored contiguously in memory according to their declaration order. However, this ordering significantly impacts both the total size of the struct and the performance of member access due to memory alignment.
Compilers align data members to specific addres boundaries to optimize CPU access. For exa ...
Posted on Wed, 29 Jul 2026 16:22:31 +0000 by bjoerndalen
x86-64 Machine-Level Program Representation: Registers, Instructions, and Control Flow
x86-64 Register Set and Usage
The x86-64 architecture includes 16 general-purpose registers that store 64-bit values. While these register are general-purpose, they follow conventional usage patterns. The registers r8 through r15 were added in the 80386 architecture extension.
%rax: Return value register
%rbx: Callee-saved register
%rcx: 4th f ...
Posted on Sun, 24 May 2026 18:01:07 +0000 by Bilbozilla
64-bit Assembly Execution Deep Dive: Function Call Mechanics and Stack Frame Management
Function Call Mechanism
A fundamental question that often arises: When function A calls function B, how does B know where to return after completion?
Consider the following code snippet where main invokes compute. Once compute finishes execution, control must flow back to main's return statement. But these two functions are separate entities—ho ...
Posted on Thu, 14 May 2026 04:05:49 +0000 by zild1221