[Top][All Lists]
[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: |
Paulo César Pereira de Andrade |
Subject: |
Re: [Lightning] How to call varargs functions from lightning in x86_64? |
Date: |
Thu, 19 Aug 2010 21:56:21 -0300 |
User-agent: |
SquirrelMail/1.4.19 |
Hi,
The attached patch pass these tests in my testing tool:
http://code.google.com/p/exl/source/browse/trunk/check/lightning/varargs.tst
the test basically does:
1.
o call sprintf with 10 integer arguments
o call sscanf with 10 integer pointer arguments
o check that sscanf reads back what sprintf wrote
2.
o call sprintf with 10 double arguments
o call sscanf with 10 double pointer arguments
o check that sscanf reads back what sprintf wrote
3.
o call a jit function with 10 integer arguments
o the jit function validates the 10 integer arguments
4.
o call a jit function with 10 double arguments
o the jit function validates the 10 double arguments
5.
o call a jit function with mixed long,double,long,double...
totalling 10 longs and 10 doubles
o the jit function validates the arguments
6.
o call sprintf with 10 times the pattern of "%d %f", and pass
10 pairs of longs and doubles
o call sscanf and validate the buffer contents
This works in x86_64, but did not check on i386 yet.
Very experimental patch, and probably will only work with varargs
functions for > 8 double arguments, as described in the commit message.
Still need to check calls to prototyped functions with more than 8
double arguments, and, if that changes, that it would be required to
have some hint to jit_prepare, what would not be a bad idea at all,
as then, it could avoid setting %al for the varargs abi, what it
does regardless of calling a varargs or not (but that is minimal
overhead)...
Please review/comment.
This has the tricks that should be common to other lightning logic:
o must call arg_* for every arguments, in left to right order
o must call getarg_* for every argument, in left to right order
o must call jit_prepare before jit_prepare_{f,d} and then may call
jit_prepare_{f,d} any times, but before pushing arguments
If not doing the above, it will not work correctly if generating
more then one jit function, or nested jit functions.
Thanks,
Paulo
0001-Experimental-x86_64-support-for-any-number-of-intege.patch
Description: Text Data
- [Lightning] How to call varargs functions from lightning in x86_64?, Paulo César Pereira de Andrade, 2010/08/16
- Re: [Lightning] How to call varargs functions from lightning in x86_64?, Paolo Bonzini, 2010/08/16
- Re: [Lightning] How to call varargs functions from lightning in x86_64?, Paulo César Pereira de Andrade, 2010/08/16
- Re: [Lightning] How to call varargs functions from lightning in x86_64?, Paolo Bonzini, 2010/08/16
- Re: [Lightning] How to call varargs functions from lightning in x86_64?, Paulo César Pereira de Andrade, 2010/08/16
- Re: [Lightning] How to call varargs functions from lightning in x86_64?, Paulo César Pereira de Andrade, 2010/08/17
- Re: [Lightning] How to call varargs functions from lightning in x86_64?, Paulo César Pereira de Andrade, 2010/08/17
- Re: [Lightning] How to call varargs functions from lightning in x86_64?, Paolo Bonzini, 2010/08/18
- Re: [Lightning] How to call varargs functions from lightning in x86_64?, Paulo César Pereira de Andrade, 2010/08/18
- Re: [Lightning] How to call varargs functions from lightning in x86_64?,
Paulo César Pereira de Andrade <=
- Re: [Lightning] How to call varargs functions from lightning in x86_64?, Paulo César Pereira de Andrade, 2010/08/19
- Re: [Lightning] How to call varargs functions from lightning in x86_64?, Paulo César Pereira de Andrade, 2010/08/20