Rosalia64 icon indicating copy to clipboard operation
Rosalia64 copied to clipboard

Research: Stack Frames

Open Eeveelution opened this issue 2 years ago • 0 comments

Stack frames don't seem to have anything to do with the memory stack as I initially thought, it's merely a way to allocate registers.

A call creates a stack frame, in which registers are allocated, for both input and output, and those registers can only then be used inside that stack frame and that stack frame only.

The alloc instruction allocates registers, it takes in Size of Frame (SOF), Size of Locals (SOL), or rather in assembly it takes in Size of Inputs immediate; Size of Locals Immediate; and Size of Outputs immediate.

SOL = Size of inputs immediate + size of locals immediate SOF = all 3 together

A call type branch copies the CFM to the PFM.

Eeveelution avatar Nov 07 '22 20:11 Eeveelution