lightning
[Top][All Lists]
Advanced

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

[Lightning] Re: Calling convention


From: Ludovic Courtès
Subject: [Lightning] Re: Calling convention
Date: Tue, 02 Oct 2007 07:48:31 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Hi,

"Sandro Magi" <address@hidden> writes:

> 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?

Yes, fortunately.  :-)

>> 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?

Right.

> Combining this with a program in CPS form with
> unconditional jumps for each function call seems fairly
> platform-agnostic.

Ah, I see.  Well, these are not "calls" at the machine level, just
"jumps".

Anyway, I guess this approach is perfectly feasible.

I suppose the CPS transformation would be done at compile-time, right?

> 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?

I dunno.

Thanks,
Ludovic.





reply via email to

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