access links in the activation frames on the machine stack
I know that access links on the stack + a display array are a way of implementation for reaching non-local 开发者_StackOverflow中文版objects in nested procedures. Can anyone refer me to a reading material on the subject (google didn't help) or can simply explain me how it works? thanks
I don't know what you mean with display array, but nested procedure support usually does not use an array, but the frame pointer of the each parent is passed to the each child. Since you can lookup the parent's parent stackframe ( typically parentparentptr:=[my parentptr+constant]), this creates a linked list of stackframes.
In the compiler you have to then build a list of variables for each frame, and then you can build an expression (load frame pointer, then load variable by indirect load via framepointer) to access it. In deeply nested structures it is probably worthwhile to lookup the needed parentframes once, and store them on the stack.
精彩评论