Re: Unions in Assembly Language
From: f0dder (f0dder_spicedham_at_flork.dk)
Date: 08/26/04
- Next message: f0dder: "Re: Unions in Assembly Language"
- Previous message: Percival: "Re: Unions in Assembly Language"
- In reply to: The Wannabee: "Re: Unions in Assembly Language"
- Next in thread: The Wannabee: "Re: Unions in Assembly Language"
- Reply: The Wannabee: "Re: Unions in Assembly Language"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 26 Aug 2004 18:31:50 +0200
The Wannabee wrote:
> In your example, the code didnt need a calltable, as it only used the
> calltable to call the procs indirectly, while for the example it
> would be better to make the call directly. However, it did show how
> to prepare the tables, and how to call them. Only the dessision
> making and the automated calling was omitted. What I mean by this is
> for example :
Well, duh. When you give an example, you want it to be short and
precise - obviously I wouldn't use a jumptable for something like
that :-)
>> *snip*
>> What VC++ generates is not too far from your asm code - except it
>> uses normal stack calling convention.
>
> Yes. This is a another detail I picked up from WolfGang as well,
> since the stack is memory, it can break optimal cache usage, because
> if some memory is allready cached, and you then push or pop, that
> memory which was cached, can/will be trashed.
>
Again, this was just short example code - if would be the matter of
adding "__fastcall" to get a register calling convention. Not as
flexible as assembly of course, but the option is there.
> But it depends assumefully on the code in question. Buy many times I
> guess in a more complex procedure that calls to subroutines to
> manipulate the same data as in the calling procedure, maybe during a
> loop, avoiding stack usage might make every call a bit faster.
>
...and it might as well be that you need registers preserved, and thus
have to push them after all. There's a lot of considerations and
planning to do. I've seen a few times where forcing "__fastcall" calling
convention actually slowed things down (could happen with handcrafted
assembly too, fastcall is just the name of the convention.)
> My point is that theres not anything significant that can be done in
> HLL that cannot be done faster, better and more optimal in asm, once
> the design is settled. And then the implementation can be bettered by
> each glance on the code in assembly, but in the HLL, because of the
> hidden details, it can look optimal, and not be so. And to learn the
> full potential of asm, I am convienced one must use asm daily, for
> years to see the full range of benfits. Better start now.
>
Yepyep. My answer will be "The compilers I use do the job pretty well
most of the time, and if not, I can always crank out assembly code."
> However, to understand that HLA is not assembly takes but a few weeks.
>
*shrug* - everybody has their own definition of what assembly is,
so this is a pretty silly thing to discuss.
- Next message: f0dder: "Re: Unions in Assembly Language"
- Previous message: Percival: "Re: Unions in Assembly Language"
- In reply to: The Wannabee: "Re: Unions in Assembly Language"
- Next in thread: The Wannabee: "Re: Unions in Assembly Language"
- Reply: The Wannabee: "Re: Unions in Assembly Language"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]