flat assembler
Message board for the users of flat assembler.
Index
> Linux > ABI to the drain |
Author |
|
revolution 17 Apr 2023, 12:06
We don't use the SYSV ABI in any of our code except to interface with external libraries.
Nor do we use the MS version FASTCALL. We use what could be equivalent to STDCALL, but modified for 64-bit. The macro we use to setup the SYSV call parameters is scary. To comply with the placements of arguments is mindbogglingly complex IMO. Ints going into one place and floats into another, and overage and "large" components going to a third place. With various random alignment requirements included to "make it faster". It was a paper-faster, rather than a real-world-faster. On paper it might look okay, in functioning code the story is no so clear. We found that in real-world running code all the extra complexity of stack aligning and argument swizzling gave absolutely no advantage over a much simpler STDCALL-style stack. So we decided to not bother adding all the extra complexity for no gain. Useless extra requirements apparently. |
|||
17 Apr 2023, 12:06 |
|
Furs 17 Apr 2023, 18:21
I use custom calling conventions in most cases. Usually generic one, but sometimes one that fits a specific task to avoid having to spill or move registers. I don't care about simplicity, because if I did, I wouldn't be using assembly. I have a big gripe with the stack alignment for SYSV ABI (and I despite the Microsoft ABI).
BTW, I don't write most code in asm, but I do interface with my own code still with custom calls with compiler plugin magic in C++. I say C++ but I use it mostly in spirit of C and asm, just some extra nice functionality (e.g. constexpr for stuff evaluated at compile time, classes for better syntax for objects (but never inheritance!), etc). |
|||
17 Apr 2023, 18:21 |
|
sylware 18 Apr 2023, 09:50
Note: assembly is dead simple, I was coding assembly in my teenage years. It is just something that most people don't want to do.
I think you meant assembly is less comfy as it requires more work upfront than a high level language (and this is irrelevant for a LOT of system components), but I would bet that many here dislike the dependency on those grotesquely and absurdely massive compilers (basically gcc and sometimes clang) and some syntaxes which are on the same grade (c++ being the "best" example but C is already waaaaaay too much). Actually, this dependency is so much toxic in the end and on the long run, this is a sensible reason to code only assembly... |
|||
18 Apr 2023, 09:50 |
|
revolution 18 Apr 2023, 10:35
Furs wrote: I don't care about simplicity ... It makes it harder to find bugs. It makes it harder to understand bugs. It makes it harder to fix bugs. It makes for more bugs, latent bugs, obscure bugs, and heisenbugs. |
|||
18 Apr 2023, 10:35 |
|
Furs 18 Apr 2023, 14:15
Don't get me wrong, it's not like I aim for complexity purposefully. But simplicity is not my main goal when I code. If I had to choose between two identical pieces of code, but one is simpler, obviously I choose simplicity.
BTW, complexity is bad in many cases even for other reasons, so I aim for simplicity implicitly, while aiming for other goals instead. For example: code bloat. |
|||
18 Apr 2023, 14:15 |
|
sylware 18 Apr 2023, 17:53
Complexity has to be dealed on a case by case basis and must embrace the whole system.
Don't listen to the song of those who propose "simplicity" as it usually only moves some complexity away into what ends up being some accute toxic dependency... (like a compiler with super complex syntax...). Don't fool yourself. |
|||
18 Apr 2023, 17:53 |
|
revolution 18 Apr 2023, 19:00
There is a fundamental difference between offloading complexity and eliminating complexity.
For example: One can offload the complexity of robust date/time computations to a library function to handle all the special cases for us. But that doesn't eliminate the complexity of the underlying calculations. The calculations still have to be done, just that they are done by a black box. Compared to: One can eliminate the complexity of SYSV parameter passing rules by not using them, and instead use a regularised system without special cases. |
|||
18 Apr 2023, 19:00 |
|
sylware 18 Apr 2023, 19:58
@revolution yep, this is what I meant. And we know now where the path of the black box leads...
oh... and a black box can be open source... |
|||
18 Apr 2023, 19:58 |
|
DimonSoft 19 Apr 2023, 21:56
revolution wrote: We found that in real-world running code all the extra complexity of stack aligning and argument swizzling gave absolutely no advantage over a much simpler STDCALL-style stack. So we decided to not bother adding all the extra complexity for no gain. Useless extra requirements apparently. So similar to what I used to say to my students on the topic for years (with a few specific examples and related explanations). Good to know I’m not the only one who sees the king is naked. |
|||
19 Apr 2023, 21:56 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.