lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Lightning] Stack register control?


From: Robert Bedichek
Subject: RE: [Lightning] Stack register control?
Date: Thu, 27 Sep 2007 10:42:03 -0700


Sandro,

My code runs inside a Linux process.  I need to have a valid stack pointer at 
all times, in case I get a signal.  It also helps with debugging.  And I make 
calls frequently enough that I would probably lose if I saved and restored the 
ESP register for every call.

My target is an x86 and modern x86's can do loads and stores very quickly, 
usually two per cycle with very low latency to the the first level of memory 
hierarchy.  Some code is faster on some x86 processors when rewritten to use 
memory rather than registers for some of their operands.  This is due to 
scheduling rules and resource conflicts (your loop might be maxed out in 
register accesses but have spare mem slots). I know that sounds crazy, but 
true.  I can't give you a specific example, sorry.  But the point is, memory is 
not such a bad place to have operands on an x86 host.

Rob
-----Original Message-----
From: address@hidden
[mailto:address@hidden
Behalf Of Sandro Magi
Sent: Wednesday, September 26, 2007 6:19 PM
To: address@hidden
Subject: Fwd: [Lightning] Stack register control?


On 9/26/07, Robert Bedichek <address@hidden> wrote:
>
> Short answer: Lightning doesn't assume a stack.
>
> It does provide primitives that manipulate the stack, however.

Great! :-)

I take this to mean I can switch stacks at will then?

> In my system, I reuse EBP (x86 target), and that works fine.  I can't reuse 
> the ESP because my generated code makes C calls.

Can't you switch to a standard stack whenever you need to make C calls?

Sandro


_______________________________________________
Lightning mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lightning




reply via email to

[Prev in Thread] Current Thread [Next in Thread]