What is a run frame?

In C #, what is the execution frame (also related to this, I heard about frame activation). IIRC is a slot where method parameters go, but cannot remember all the details.

thanks

+4
source share
2 answers

"Execution frame" is a term that is used in interpreted languages, in particular Python. This is a completely different execution model from C #. The closest equivalent is the scope block in the C # method, a piece of code enclosed in brackets with curly braces. Although the Python execution frame can also extend to the function body, it is now equivalent to the stack frame in C #. This is another term for an activation frame.

The C # compiler recognizes declarations that are local to the scope block in C #. There is no runtime, it only recognizes the stack stack, which is active for the life of the whole method. The difference is trivially verified by the compiler by simply declaring the sum of all local variables in all blocks of the scope as an activation frame. This is a luxury that the Python interpreter cannot afford.

+5
source

I believe that you are referring to the stack frame - in this case, the answer is not specific to C # or, indeed, to any particular language, but rather the platform on which your program is running. From the Wikipedia article on the call stack :

The call stack consists of a stack of frames (sometimes called record activation). They are machine-dependent data structures containing routine status information. Each stack frame corresponds to a subroutine call that has not yet returned.

See also this answer to the previous question for an excellent description of the stack, including stack frames.

+2
source

Source: https://habr.com/ru/post/1303303/


All Articles