www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - reflection / D's function calling convention?

reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is D's functions calling convention somewhere documented?

I've been tinkering with a reflection module for D.
Gaining access to all dynamic and static symbols is
currently possible as well as calling C functions
(see below) but calling functions with D linkage isn't
yet implemented:



























output:
 strlen('unter den Birnen') -> 16
Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFSBqALK5blCcjpWoRArGZAJ4uf0tgdH2pQdaFL6KIFtVfnu9sMACdHiVN LLWDFZ6wUzPJo+q0PUWfPaU= =NJ5g -----END PGP SIGNATURE-----
Oct 31 2006
next sibling parent reply Walter Bright <newshound digitalmars.com> writes:
Thomas Kuehne wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Is D's functions calling convention somewhere documented?
Not really. It's callee clean stack, args pushed right to left, last arg passed in EAX.
Nov 01 2006
next sibling parent reply Don Clugston <dac nospam.com.au> writes:
Walter Bright wrote:
 Thomas Kuehne wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1

 Is D's functions calling convention somewhere documented?
Not really. It's callee clean stack, args pushed right to left, last arg passed in EAX.
Could you please copy & paste that into the "Function Calling Conventions" part of the ABI page on the spec? It's better than nothing. And maybe add 'this pointer passed in EBX' (if that's true).
Nov 01 2006
parent reply Walter Bright <newshound digitalmars.com> writes:
Don Clugston wrote:
 Could you please copy & paste that into the "Function Calling 
 Conventions" part of the ABI page on the spec? It's better than nothing.
 And maybe add 'this pointer passed in EBX' (if that's true).
I just uploaded a new http://www.digitalmars.com/d/abi.html with more complete information on the D calling convention.
Nov 01 2006
next sibling parent Alexander Panek <alexander.panek brainsware.org> writes:
That looks a way more complete, great!

On Wed, 2006-11-01 at 11:33 -0800, Walter Bright wrote:
 Don Clugston wrote:
 Could you please copy & paste that into the "Function Calling 
 Conventions" part of the ABI page on the spec? It's better than nothing.
 And maybe add 'this pointer passed in EBX' (if that's true).
I just uploaded a new http://www.digitalmars.com/d/abi.html with more complete information on the D calling convention.
Nov 01 2006
prev sibling parent "Chris Miller" <chris dprogramming.com> writes:
On Wed, 01 Nov 2006 14:33:17 -0500, Walter Bright  
<newshound digitalmars.com> wrote:

 Don Clugston wrote:
 Could you please copy & paste that into the "Function Calling  
 Conventions" part of the ABI page on the spec? It's better than nothing.
 And maybe add 'this pointer passed in EBX' (if that's true).
I just uploaded a new http://www.digitalmars.com/d/abi.html with more complete information on the D calling convention.
Great, thanks!
Nov 01 2006
prev sibling parent reply "Chris Miller" <chris dprogramming.com> writes:
On Wed, 01 Nov 2006 05:40:18 -0500, Walter Bright  
<newshound digitalmars.com> wrote:

 Thomas Kuehne wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
  Is D's functions calling convention somewhere documented?
Not really. It's callee clean stack, args pushed right to left, last arg passed in EAX.
Can you please explain some more... For variadic functions, the caller probably cleans up and the last arg not put in EAX. What if the last arg does not fit in EAX; e.g. a char[], is half put in EAX / half on the stack, or all on the stack? Return value: EAX, or also I believe EAX and EDX for 64-bit values. Returning floating point: in floating point register? Bigger return types probably first push a pointer to a return buffer? Variadic TypeInfo[] _arguments pushed last or first or something else?
Nov 01 2006
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Chris Miller" <chris dprogramming.com> wrote in message 
news:op.tib3szvnpo9bzi tanu...
 Can you please explain some more...
Here's all that I've researched: DMD FUNCTION CALLING CONVENTION: params are passed, in general, l-to-r. in functions with varargs, all params are passed r-to-l, and are all pushed. varargs also push the _arguments array as the last (furthest left) param. caller is responsible for cleaning up params to vararg function. typesafe variadic functions just take an array as their variadic arg; the array is built by the caller and passed as a regular array - because it's basically a non-vararg function, params are passed l-to-r. all kinds of ints, pointers, class refs, bools, char, wchar, dchar, func pointers: if not last, push; else, put in EAX longs: push hi, push lo float, ifloat: push double, idouble: push hi, push lo real, ireal: push really hi, push hi, push lo cfloat: push float im, push float re cdouble: push double im, push double re creal: push real im, push real re arrays: push pointer (hi), push length (lo) delegates: push address, push context ptr ('this' or frame ptr) structs: push the whole damn thing, starting at the beginning D METHOD CALLING CONVENTION: Similar to above, with following differences: all kinds of ints, ptrs, refs etc: push 'this' goes into EAX D DELEGATE CALLING CONVENTION: put context in both EAX and EBX -- EBX is not actually used in the delegate though put address in EDX call EDX
 For variadic functions, the caller probably cleans up and the last arg not 
 put in EAX.
Right.
 What if the last arg does not fit in EAX; e.g. a char[], is half put in 
 EAX / half on the stack, or all on the stack?
It's pushed entirely.
 Return value: EAX, or also I believe EAX and EDX for 64-bit values.
I'm pretty sure longs are put in EDX:EAX as you say.
 Returning floating point: in floating point register?
Ooh, not sure about that one.
 Bigger return types probably first push a pointer to a return buffer?
Hmm, guess I didn't do much return type research :S
 Variadic TypeInfo[] _arguments pushed last or first or something else?
It's pushed last, so it's technically the furthest-left param (before all other params).
Nov 01 2006
next sibling parent Don Clugston <dac nospam.com.au> writes:
Jarrett Billingsley wrote:
 "Chris Miller" <chris dprogramming.com> wrote in message 
 news:op.tib3szvnpo9bzi tanu...
 Can you please explain some more...
Here's all that I've researched:
[snip] A great collection! How about tidying it up, and giving the whole thing to Walter to put into the spec?
 Returning floating point: in floating point register?
Ooh, not sure about that one.
Yes, they are returned on top of the x87 floating point stack. This applies to complex types as well: Example: // Calculate cos(y) + i sin(y). creal expi(real y) { asm { fld y; fsincos; fxch st(1), st(0); } }
Nov 01 2006
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jarrett Billingsley schrieb am 2006-11-01:
 "Chris Miller" <chris dprogramming.com> wrote in message 
 news:op.tib3szvnpo9bzi tanu...
 Can you please explain some more...
Here's all that I've researched: DMD FUNCTION CALLING CONVENTION:
Thanks.
 params are passed, in general, l-to-r.

 in functions with varargs, all params are passed r-to-l
<snip> Wouldn't it be easier and less bug prone to use r-to-l for all? Even unidirectional __cdecl/extern(C) seems hard to implement: "Random Testing of C Calling Conventions"; Christian Lindig; 2005 http://www.st.cs.uni-sb.de/~lindig/papers/quest/quest.pdf
 Bigger return types probably first push a pointer to a return buffer?
Hmm, guess I didn't do much return type research :S
Defining that seems to be crucial. The C++ people have serious problems with structs: http://www.agner.org/optimize/calling_conventions.pdf Table 7(methods for returning structure, class and union objects) shows how everybody and his dog uses a different approach. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFSQ12LK5blCcjpWoRAqGRAKChAYjWAjB0BDAZonuVL7CIe2wgYgCeMCOM R6Zzykj4FlI0OaOqvfJkraE= =Vhbq -----END PGP SIGNATURE-----
Nov 01 2006
prev sibling next sibling parent reply =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= <thomas-dloop kuehne.cn> writes:
 boundary="------------000909070804020005060602"

This is a multi-part message in MIME format.
--------------000909070804020005060602
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

 I've been tinkering with a reflection module for D.
Attached is rudimental reflection module for D. limitations: * only supported on *nix systems (porting to Windows should be straight f= orward) * read permissions required in addition to execution permission for findi= ng symbols * the symbol sizes generated by DMD are defective, thus no class/struct s= upport * the D calling convention is undocumented, thus unsupported license: ZLIB Thomas --------------000909070804020005060602 Content-Type: application/zip; name="reflection.zip" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="reflection.zip" UEsDBBQAAgAIAP11YTWHFR9UPQsAAE0gAAAMABUAcmVmbGVjdGlvbi5kVVQJAAOOpUhFjqVI RVV4BADoA2QAtVnrcts2Fv4tPQVWM0lkh1YkO21TKU7ryE4nu71kamemM66HQ1GQxJgXLUHa VnfTJ9t/+2L7nXNAEro4cbu7nY5MAAcfzh3nIM/2Va5nsQ6LKEt7U3VwoExRTlQ2c+aVKZfL LC/ULMtVsdDqVC3zbJ4HSRKlcxUH6bwM5rrdVupG54Z2HPb7Xx4MBgf9gRr0h4PD4dHXtDzO lqs8mi8K1R3vMZG6WGRJYNTf/v2vRarVy4KH316XG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xzZ5 UVBw3ZxnxjMjv0QeEbgHw8HgkCBi79Ak4gDkB4ceQ9IN9hyhU6t/fko58vRjIUt1BxzcASQP A8eEtkC4C7QHOUhCL4UQUVsYMHoSqaLy4yNTLFwKoK2lliYx4B5NbuDCbil7CpbCtnj6Dbvq mXZ4RCD0hQJbDBh1DbA5QPfcgY4IFvtafcT7IsgCgcE4LbKQFLNJp9RHvw6Mdq7eU7Yby0xt M4EcLJtcd0N7NMrhXFip13W3rkOc54XJyGRBjA7vGwo6Hm5uJ63IWynCn/KbLMnWiyeggy1I l8wN/ilIO5IL5YlC3jftiayy6G1t73mptsbAzD8+wMwAun5uYDoF6+3Vw5jbdsIwGzHW0Vdd kcKM+6vHU1TzxQWrb1BLAQIXAxQAAgAIAP11YTWHFR9UPQsAAE0gAAAMAA0AAAAAAAEAAACw gQAAAAByZWZsZWN0aW9uLmRVVAUAA46lSEVVeAAAUEsBAhcDFAACAAgAQXBhNbQyIT67BwAA oxIAAAUADQAAAAAAAQAAAKCBfAsAAGVsZi5jVVQFAAPKmkhFVXgAAFBLAQIXAxQAAgAIACR2 YTUwTD2wQwEAAGkCAAAKAA0AAAAAAAEAAACwgW8TAAByZWFkbWUudHh0VVQFAAPTpUhFVXgA AFBLBQYAAAAAAwADAMwAAADvFAAAAAA= --------------000909070804020005060602--
Nov 01 2006
parent reply "Frank Benoit (keinfarbton)" <benoit tionex.removethispart.de> writes:
Hi Thomas

Great, that you are on the way to bring reflection to work.

In the demo you call a c-function and a pascal-function. Is D equal to
pascal calling conventions?

Can I use this to call D functions?
Is there a way, to call an object method?

Frank
Nov 13 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Frank Benoit (keinfarbton) schrieb am 2006-11-14:
 In the demo you call a c-function and a pascal-function. Is D equal to
 pascal calling conventions?
No.
 Can I use this to call D functions?
 Is there a way, to call an object method?
Not yet. I'm currently rewriting to support C, D and C++. (I forgot how limited C++'s templates and variadic arguments are ...) Adding support for D's calling convention is going to be the next step. Though keep in mind that there are 3 different D calling conventions: GDC, DMD-Linux and DMD-Windows. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFWXy1LK5blCcjpWoRApvgAJ9l+n2rLueVeSogO656l58NYTWpKACfakXE jl56lV8/Kaj/EjHataZvu4I= =icmZ -----END PGP SIGNATURE-----
Nov 14 2006
prev sibling parent reply Wolfgang Draxinger <wdraxinger darkstargames.de> writes:
Thomas Kuehne wrote:

 Is D's functions calling convention somewhere documented?
 
 I've been tinkering with a reflection module for D.
 Gaining access to all dynamic and static symbols is
 currently possible as well as calling C functions
 (see below) but calling functions with D linkage isn't
 yet implemented:
I'm currently working on a preliminary ABI, plattform neutral ABI for D. Plattform neutral in the sense, that everything that is plattform related is expressed by reference to additional plattform specific structured. This ABI also differentiates between compile time, linkage time and runtime level, which is IMHO required to get reflection and introspection done in a elegant way. Along with that I'm also working on a fork of the GDC compiler and a custom set ot GNU binutils that follow that ABI. The ABI itself is binary format neutral, though I'm also working on a special version of the ELF format optimized for that ABI, which uses DWARF to store reflection and introspection information, instead of placing that in a additional .data section. I hope to have a relase candidate in late December. Wolfgang Draxinger -- E-Mail address works, Jabber: hexarith jabber.org, ICQ: 134682867
Nov 14 2006
parent "John Reimer" <terminal.node gmail.com> writes:
On Tue, 14 Nov 2006 05:27:57 -0800, Wolfgang Draxinger  
<wdraxinger darkstargames.de> wrote:

 Thomas Kuehne wrote:

 Is D's functions calling convention somewhere documented?

 I've been tinkering with a reflection module for D.
 Gaining access to all dynamic and static symbols is
 currently possible as well as calling C functions
 (see below) but calling functions with D linkage isn't
 yet implemented:
I'm currently working on a preliminary ABI, plattform neutral ABI for D. Plattform neutral in the sense, that everything that is plattform related is expressed by reference to additional plattform specific structured. This ABI also differentiates between compile time, linkage time and runtime level, which is IMHO required to get reflection and introspection done in a elegant way. Along with that I'm also working on a fork of the GDC compiler and a custom set ot GNU binutils that follow that ABI. The ABI itself is binary format neutral, though I'm also working on a special version of the ELF format optimized for that ABI, which uses DWARF to store reflection and introspection information, instead of placing that in a additional .data section. I hope to have a relase candidate in late December. Wolfgang Draxinger
Wow! I'm interseted! -JJR
Nov 15 2006