flat assembler
Message board for the users of flat assembler.
Index
> Main > push A, ret or jmp A? |
Author |
|
edfed 13 May 2011, 10:54
jmp A is faster, i don't see why 2 instructions should be faster than just one.
even if push/ret is HW optimized, jmp too is optimized, then, jmp is faster but if you want to make some code obfuscation, push, code, ret is a good solution |
|||
13 May 2011, 10:54 |
|
bitshifter 13 May 2011, 11:43
Either one could be faster, depending on the surrounding context...
|
|||
13 May 2011, 11:43 |
|
ass0 13 May 2011, 11:58
i gues jmp address takes more bytes to encode...plus it may not be aligned.
_________________ Nombre: Aquiles Castro. Location2: about:robots |
|||
13 May 2011, 11:58 |
|
LocoDelAssembly 13 May 2011, 14:44
Artlav, would be possible for you to share your speed testing code? Besides the fact PUSH/RET is harder for the processor to predict the target (if not impossible), you spoil the processor's return address buffer because the RET isn't paired with a CALL.
|
|||
13 May 2011, 14:44 |
|
revolution 07 Jun 2011, 11:22
I think a more appropriate answer would be: If you can't measure any perceivable difference in your code then is does not matter which code sequence you use.
|
|||
07 Jun 2011, 11:22 |
|
Enko 07 Jun 2011, 14:10
push A
ret whould be not a bad trick for obfuscating the code for some noob reversers. |
|||
07 Jun 2011, 14:10 |
|
ctl3d32 07 Jun 2011, 14:41
Enko wrote: push A Hey! What do i have to do with it? Leave me alone! |
|||
07 Jun 2011, 14:41 |
|
asmdev 08 Jun 2011, 05:47
According to "some" manuals that I have read "some years ago", call & ret are meant to work together. If you got one "call" instruction and then "ret" following the call (some instructions are allowed in between) then CPU will cache call+ret pair.
So if we are inside function that was called and executing some other functions: Code: ; We are inside some function push A ;calling some ret ; other function Then "call" of the function that we are inside in will be paired with the "ret" belonging to a different function. To which extend this can affect performance I don't know. After I have typed this I can see that precise logic is way too complicated. |
|||
08 Jun 2011, 05:47 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.