flat assembler
Message board for the users of flat assembler.

Index > Heap > Does NASM have too much C?

Goto page Previous  1, 2, 3
Author
Thread Post new topic Reply to topic
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
So what's this Netwide Assembler bashing all about? Are you one of the NASM authors? I'm confused
Post 29 Jun 2015, 20:31
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
Code:
macro leave {
  mov esp,ebp
  pop ebp
}    
Anyhow the timings will depend upon the CPU in use. There is no guarantee that it will be faster or slower then any alternative.
Post 29 Jun 2015, 21:51
View user's profile Send private message Visit poster's website Reply with quote
fasmnewbie



Joined: 01 Mar 2011
Posts: 553
fasmnewbie
revolution wrote:
Code:
macro leave {
  mov esp,ebp
  pop ebp
}    
Anyhow the timings will depend upon the CPU in use. There is no guarantee that it will be faster or slower then any alternative.


LEAVE is in fact an alternative. It is a complex instruction so much so that even Intel discourage the use of it (refer Optimization Manual from intel). It has higher throughput (3) if compared to simple instructions mov esp,ebp (1/3) -- pop ebp (1/3) the last time I checked.
Post 29 Jun 2015, 22:11
View user's profile Send private message Visit poster's website Reply with quote
fasmnewbie



Joined: 01 Mar 2011
Posts: 553
fasmnewbie
typedef wrote:
What's the name of your assembler sir?
For once, please re-read his answer - he clearly named it Duck Assembler
Post 29 Jun 2015, 22:14
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
fasmnewbie wrote:
LEAVE is in fact an alternative. It is a complex instruction so much so that even Intel discourage the use of it (refer Optimization Manual from intel). It has higher throughput (3) if compared to simple instructions mov esp,ebp (1/3) -- pop ebp (1/3) the last time I checked.
Intel is not the only x86 CPU maker though, Each CPU behaves differently. And even within the same CPU other surrounding instructions can/will affect the performance of any particular instruction.
Post 29 Jun 2015, 22:25
View user's profile Send private message Visit poster's website Reply with quote
redsock



Joined: 09 Oct 2009
Posts: 357
Location: Australia
redsock
The leave instruction goes hand-in-hand with C/C++ framepointers of course, and with my entire library I created a compile time option to include (default), or exclude them.

Interestingly, at least on my decent-spec Opterons and Intel x86_64 alike, there is no noticeable gain by disabling framepointers (and I lose the benefit of sane stackframes for GDB which I quite like having around).

Most often, there are no immediate dependency chains for both entry/setup or the leave instruction which I suspect has something to do with my measurements across thousands of different functions and profiling re: same.

That Intel says not to use leave is most interesting given my observations and the benefits of using them. Smile $0.02 thusly
Post 30 Jun 2015, 07:01
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.