flat assembler
Message board for the users of flat assembler.
Index
> Main > Your preferred calling convention |
Author |
|
AsmGuru62 22 Jul 2015, 14:44
__fastcall.
|
|||
22 Jul 2015, 14:44 |
|
PeExecutable 22 Jul 2015, 14:56
Thanks for your response, I would appreciate an explanation why you prefer one convention over the other. (Hopefully not for creating a debate or to create disagreement between different people, but to see the different perspectives from people)
|
|||
22 Jul 2015, 14:56 |
|
AsmGuru62 22 Jul 2015, 18:57
Well, I write my code in FASM only, no integration with other packages.
Pushing parameters to stack seems non-Assemblery - if that is a word, probably not. If I'll use any other convention, my code probably would be no better than C/C++ or maybe even worse. When I say __fastcall - I do not mean standard, described in MSDN, I mean that parameters passed in registers, can be any register. |
|||
22 Jul 2015, 18:57 |
|
HaHaAnonymous 23 Jul 2015, 18:42
Quote:
CDECL. Because I can choose when to change ESP. LOL! |
|||
23 Jul 2015, 18:42 |
|
JohnFound 25 Jul 2015, 08:20
For library public procedures STDCALL - IMO, it is more flexible than others (especially for x86!) and allows some tricks that help optimizing register use.
Sometimes for very simple and for internal use only procedures I use register parameter passing, but it has some great disadvantages. |
|||
25 Jul 2015, 08:20 |
|
cod3b453 25 Jul 2015, 08:56
As it's a library, it's less about preference and more about suitability. If it's aimed at HLL usage, mixing conversions can be both advantageous and detrimental, depending on the critical path. In some cases, one won't have a choice due to the target platform or other libraries enforcing the convention (thread entry points/callbacks etc).
If the library is not intended for HLLs (or just the odd top-level do-all-the-things calls), then I normally aim for "native" convention where I avoid common registers, where appropriate, and pass parameters and return values in and out of procedure-specific registers. I typically end up using r15-8 xmm15-8 etc as this avoids both general purpose instructions (think rep cmpsb etc) and calling convention collisions and therefore reduces state swapping overhead. |
|||
25 Jul 2015, 08:56 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.