acodercat / function-call-principle Goto Github PK
View Code? Open in Web Editor NEW一篇关于函数调用原理的文章,通过大量的示意图由浅入深分析了函数完整的生命周期。
一篇关于函数调用原理的文章,通过大量的示意图由浅入深分析了函数完整的生命周期。
压栈rbp后,根据上一节函数栈帧应该是将rsp移动到rbp里吧:
callee:
pushq %rbp
movq %rsp, %rbp
; ...
main:
pushq %rbp
movq %rsp, %rbp
; ...
个人以为 stack5.png
的左图有些奇怪:
initial
指的是 销毁栈帧 这个操作之前的状态,那么 bp
至少不应该指向当前函数栈帧 old bp
之外的空间;initial
指的是整个栈帧创建之前的状态,那么 ret addr
应该还没有创建,sp
也不应该指向它;stack5.png
图上方文字描述为:“销毁时先把 栈指针
(sp) 移动到此时 栈基址
(bp) 的位置”,按照 stack5.png
的 initial
状态,那么 sp
应该直接指向图中 bp
指向的区域(根据上文,这里的 bp
或许指的是上一个函数的 old bp
)
综上我认为 stack5.png
的左图有些奇怪。如果我阅读时理解出现偏差,还请大佬直接 close
该 issue
😢
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.