[问题] funtion、address、instruction的关系

楼主: NoTeXactLy (NoTeXactLy)   2014-07-03 18:19:06
以下是书本的句子:
When a program reaches the function call instruction, the program stores the
memory address of the instruction immediately following the function call,
copies function arguments to the stack(a block of memory reserved for that
purpose), jumps to the memory location that marks the beginning of the
function, executes the instructon whose address it saved.
出处:
http://tinyurl.com/o6xo4bd
C++ primer plus
books.google.com
请问
function call instruction、instruction、function call这三者指同样东西吗?
而function是指function definition吗?
谢谢
作者: tjjh89017 (伊达政宗)   2014-07-03 19:08:00
这看起来是组合语言的东西function call inst => asm: call some_func
作者: carylorrk (carylorrk)   2014-07-03 21:30:00
address of function call instruction push to stack是runtime 做的事,不是 compile time简单来说这句就是在说每次执行到 function call 指令时会先记下 function return 回来时的位置,也就是当初你call function 跳走的下一条指令
作者: azureblaze (AzureBlaze)   2014-07-03 23:05:00
因为不见得要放stack 虽然一般都放stack
作者: MOONRAKER (㊣牛鹤鳗毛人)   2014-07-03 23:47:00
有创意。身为一个程式修理员,多找几本书看也很合理且合逻辑书上没说to stack就咬死一定没to stack,又不是背六法。果然是背六法的。
作者: Killercat (杀人猫™)   2014-07-04 18:32:00
function arguments放的位置并没有明确定义名称甚至有的还是丢到registry做pass的他唯一的名称就叫作Function Frame居泥在他是不是stack...似乎有点搞错方向了你这东西我只能跟你说 位置颇微妙 你要先搞懂stack/heap怎么长的 比较有这种感觉就是...另外规格也没有指名function frame要丢再哪里 编译器可以自己决定的
作者: witchang   2014-07-06 01:29:00
放不放stack要看平台的Call Convention(呼叫惯例)请查网.functionCall ins 一般是跳跃指令,所以跳之前将引数搬到Reg或Stack是编译器的事情并非Runtime~跳跃指令会纪录返回位置到rpc,return的asm会从rpc调回回去后执行的位址~

Links booklink

Contact Us: admin [ a t ] ucptt.com