简体   繁体   English

在delphi 64位汇编中,.noframe是什么?

[英]What is .noframe in delphi 64-bit assembly?

What is .noframe in delphi 64-bit assembly? 在delphi 64位汇编中,.noframe是什么?

I have seen x64 assembly code like this. 我看过x64汇编代码是这样的。

procedure test;
{$IFDEF CPUX64}
asm
  .noframe
..
..

What is the meaning of .noframe and why should I care? .noframe的含义是什么,我为什么要关心呢?

From the documentation : 文档中

Forcibly disables the generation of a stack frame as long as there are no local variables declared and the parameter count <= 4. Use only for leaf functions. 只要没有声明局部变量且参数​​count <= 4,就强制禁用堆栈帧的生成。 用于叶函数。

A leaf function is one that does not call another function. 叶子函数是不调用另一个函数的函数。 That is one that is always at the bottom of the call tree. 那就是永远在调用树底部的那个。

From http://blogs.embarcadero.com/abauer/2011/10/10/38940 http://blogs.embarcadero.com/abauer/2011/10/10/38940

.NOFRAME 。无框

Some functions never make calls to other functions. 某些功能从不调用其他功能。 These are called “leaf” functions because the don't do any further “branching” out to other functions, so like a tree, they represent the “leaf” For functions such as this, having a full stack frame may be extra overhead you want eliminate. 之所以称它们为“叶子”函数是因为它们不对其他函数做进一步的“分支”,因此像树一样,它们代表“叶子”。对于这样的函数,拥有完整的堆栈框架可能会增加额外的开销要消除。 While the compiler does try and eliminate the stack frame if it can, there are times that it simply cannot automatically figure this out. 尽管编译器会尽力消除堆栈框架,但有时它根本无法自动解决。 If you are certain a frame is unnecessary, you can use this directive as a hint to the compiler. 如果确定不需要框架,则可以将此指令用作编译器的提示。

As far as I know the correct answer wouldn't imply the “leaf function” condition. 据我所知,正确的答案并不意味着“叶功能”状态。 You can use the .noframe when you are sure that 确定可以使用.noframe

  1. the parameter count is ≤ 4, as stated above; 如上所述,参数计数≤4;
  2. you don't need to create a frame for local variables, 您不需要为局部变量创建框架,
  3. the (1), (2) and (3) are also true for all the functions you want to call from this routine. 对于要从​​此例程调用的所有函数,(1),(2)和(3)也适用。

If the “leaf function” statement was true it would mean that you wouldn't use the stack at all in such functions. 如果“叶子函数”语句为true,则意味着您根本不会在此类函数中使用堆栈。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM