Are these variables stored on the stack? That is, x:=43;
writes 43 to the stack? And for what pascal processor registers?
- Local variables are probably on the stack. Their addresses will be calculated (by the compiler at the compilation stage, and not during the operation of the function) as the offset from the beginning of the current stack frame, i.e. register pointer stack at the entrance to the function. - avp
|
2 answers
The variable x can turn out to be both a processor register and an address in memory, it all depends on how the compiler decides.
And for what pascal processor registers?
As a rule, it is impossible to directly take, for example, the values from two memory cells, add and put the sum into the third cell. Most arithmetic and logical operations are performed by the processor between registers, since they are physically located in him, and not somewhere "far" in the RAM. Therefore, usually before an operation, values are first loaded into registers, and then an operation is performed on them.
|
Essentially, the expression
x:=3
Equivalent to assembler Movie:
mov x, 3
- OK. And x is the register of the processor, or memory cell? - Ololo
- 2x is the variable "X" - AseN
|