lightning
[Top][All Lists]
Advanced

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

Re: [Lightning] How to call varargs functions from lightning in x86_64?


From: Paolo Bonzini
Subject: Re: [Lightning] How to call varargs functions from lightning in x86_64?
Date: Wed, 18 Aug 2010 09:59:08 +0200

>>> It's not insurmountable, but it needs a new form of prepare statement
>>> or something like that.
>>
>>   Now, the test cases works for both, i386 and x86_64.
>
>  I think it can be implemented significantly better lightning support
> for x86_64. It would require setting a flag in jit_prepare() if:
>
> o The user specified it is a varargs prepare, like adding a new
>  jit_vararg(num) to be used instead of jit_prepare(num). This is the
>  only real change to lightning, and should be better than blindly
>  setting %rax when it is not required

Yes, that's okay, though the cost of a single mov to %rax is not
too bad.

>  I believe this should be reasonable, of course only support for
> basic data types is done, otherwise it would defeat the lightning
> purpose as jit, but removing the 6 (+n float) arguments would be
> cheap, and not too hard to implement. What do you think?

I agree.

>  BTW, please pardon my ignorance :-), but could it be made cheaper
> to "callq routine_address", instead of "movabs routine_address,%r9;
> callq *%r9"? I think there should be a reason (not sitting in front
> of a x86_64, so cannot test it myself right now...)

Yes, though I don't have a manual at hand to double check.

Paolo



reply via email to

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