I\'m trying to get a deeper understanding of how the low level operations of programming languages work and especially how they interact with the OS/CPU. I\'ve probably read
Like others noted, there is no need to pop parameters, until they go out of scope.
I will paste some example from "Pointers and Memory" by Nick Parlante. I think the situation is a bit more simple than you envisioned.
Here is code:
void X()
{
int a = 1;
int b = 2;
// T1
Y(a);
// T3
Y(b);
// T5
}
void Y(int p)
{
int q;
q = p + 2;
// T2 (first time through), T4 (second time through)
}
The points in time T1, T2, etc
. are marked in
the code and the state of memory at that time is shown in the drawing: