Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research: Stack Frames #5

Open
Eeveelution opened this issue Nov 7, 2022 · 0 comments
Open

Research: Stack Frames #5

Eeveelution opened this issue Nov 7, 2022 · 0 comments

Comments

@Eeveelution
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant