lightning
[Top][All Lists]
Advanced

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

[Lightning] Re: Calling convention


From: Sandro Magi
Subject: [Lightning] Re: Calling convention
Date: Mon, 1 Oct 2007 20:48:33 -0400

On 10/1/07, Ludovic Courtès <address@hidden> wrote:
> Hi,
>
> "Sandro Magi" <address@hidden> writes:
>
> > Do the jit_prolog, jit_finish, etc. macros implement the C calling
> > convention for the platform?
>
> Roughly, they implement the calling convention of the System V ABI.
> For instance, `jit_prolog' saves registers documented as callee-saved
> that are exposed as lightning registers.

Hm, I'm not sure that answers my question, or if it does, I'm not
clear on it. Perhaps I should be more precise: if I embed a C function
pointer in the emitted machine code using jit_prolog, etc. will the
call succeed? I imagine there's some way to make these calls since
many jitted programs need to call malloc.

> I suspect that to implement a custom (and faster) calling convention,
> you'd have to have access to many details of the underlying platform,
> most notably its complete register set.  However, lightning does not
> allow it, unless you want to sacrifice portability.

Hmm, I was looking into allocating registers using register numbers in
the range of JIT_R_NUM and JIT_V_NUM, which are mandatory for every
platform according to the manual, and they expose all machine
registers do they not? Combining this with a program in CPS form with
unconditional jumps for each function call seems fairly
platform-agnostic.

I do realize x86 is an 'irregular' architecture, in that some
registers are specialized for some uses, but I'm avoiding considering
that optimization for the moment. Is there something platform-specific
in this approach that I've missed?

Sandro




reply via email to

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