Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API/ABI differences/issues in d-runtime #17231

Open
dlangBugzillaToGithub opened this issue Jan 23, 2011 · 0 comments
Open

API/ABI differences/issues in d-runtime #17231

dlangBugzillaToGithub opened this issue Jan 23, 2011 · 0 comments
Labels

Comments

@dlangBugzillaToGithub
Copy link

Iain Buclaw (@ibuclaw) reported this on 2011-01-23T09:51:06Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=5478

CC List

Description

I'm going to create this here as further discussion of this ML topic: http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=127599

Other bug reports that may be relevant (to which I'm loosely basing this post on bug802).
http://d.puremagic.com/issues/show_bug.cgi?id=802
http://d.puremagic.com/issues/show_bug.cgi?id=3155


I'll simply document differences between GDC and DMD, however differences between LDC and DMD/GDC is very much welcome as a further addition.

Current notable differences between GDC/DMD:

=== _aaGetX ===
DMD: void* _aaGetX(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey)
GDC: void* _aaGetp(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey)

DMD uses calling convention and architecture dependent code to get pkey in _aaGet.
rt/aaA.d:215 return _aaGetX(aa, keyti, valuesize, cast(void*)(&valuesize + 1));

Though I presume the DMD compiler uses a similar technique to GDC and simply calls _aaGetX directly.


=== _aaGetRvalueX ===
DMD: void* _aaGetRvalueX(AA aa, TypeInfo keyti, size_t valuesize, void* pkey)
GDC: void* _aaGetRvaluep(AA aa, TypeInfo keyti, size_t valuesize, void* pkey)

Ditto above.

=== _aaInX ===
DMD: void* _aaInX(AA aa, TypeInfo keyti, void* pkey)
GDC: void* _aaInp(AA aa, TypeInfo keyti, void* pkey)

Ditto above.

=== _aaDelX ===
DMD: void _aaDelX(AA aa, TypeInfo keyti, void* pkey)
GDC: void _aaDelp(AA aa, TypeInfo keyti, void* pkey)

Ditto above.

=== _d_assocarrayliteralTX ===
DMD: BB* _d_assocarrayliteralTX(TypeInfo_AssociativeArray ti, void[] keys, void[] values)
GDC: BB* _d_assocarrayliteralTp(TypeInfo_AssociativeArray ti, size_t length, void *keys, void *values)

GDC's implementation of _d_assocarrayliteralTp is just an extension of _d_assocarrayliteralT, and is yet been updated.


=== Array ===
Array is defined in five locations:

rt/aaA.d:57:struct Array
rt/qsort.d:31:struct Array
rt/adi.d:40:struct Array
rt/lifetime.d:964:struct Array
rt/qsort2.d:22:struct Array


=== dg_t ===
dg_t is defined in four locations:

src/rt/aaA.d:581:extern (D) typedef int delegate(void *) dg_t;
src/rt/aApplyR.d:29:extern (D) typedef int delegate(void *) dg_t;
src/rt/aApply.d:24:extern (D) typedef int delegate(void *) dg_t;
src/object_.d:2451:    extern (D) typedef scope int delegate(void *) _dg_t;


=== dg2_t ===
dg2_t is defined in four locations:

src/rt/aaA.d:608:extern (D) typedef int delegate(void *, void *) dg2_t;
src/rt/aApplyR.d:491:extern (D) typedef int delegate(void *, void *) dg2_t;
src/rt/aApply.d:199:extern (D) typedef int delegate(void *, void *) dg2_t;
src/object_.d:2454:    extern (D) typedef scope int delegate(void *, void *) _dg2_t;


=== _d_newarraymT ===
DMD: void[] _d_newarraymT(TypeInfo ti, size_t ndims, ...)
GDC: void[] _d_newarraymTp(TypeInfo ti, size_t ndims, size_t* pdim)

DMD's implementation calls a new function _d_newarrayOpT which is similar to GDC's
rt/lifetime.d:851:void[] _d_newarrayOpT(alias op)(TypeInfo ti, size_t ndims, va_list q)

It may be worth fixing GDC to match in this case.


=== _d_newarraymiT ===
DMD: void[] _d_newarraymiT(TypeInfo ti, size_t ndims, ...)
GDC: void[] _d_newarraymiTp(TypeInfo ti, size_t ndims, size_t* pdim)

Ditto above.


=== _d_arrayappendT ===
DMD: void[] _d_arrayappendT(TypeInfo ti, ref byte[] x, byte[] y)
GDC: void[] _d_arrayappendT(TypeInfo ti, Array *px, byte[] y)

This is a change that looks yet to be merged from trunk.


=== _d_arrayappendcTX ===
DMD: byte[] _d_arrayappendcTX(TypeInfo ti, ref byte[] px, size_t n)
GDC: void[] _d_arrayappendcTp(TypeInfo ti, ref byte[] x, byte* argp)

Ditto above.


=== _d_arrayliteralTX ===
DMD: void* _d_arrayliteralTX(TypeInfo ti, size_t length)

Not in GDC, though if added will likely be named _d_arrayliteralTp.


=== _d_array_bounds ===
DMD: void _d_array_bounds(ModuleInfo* m, uint line)
GDC: void _d_array_bounds(string file, uint line)

DMD's implementation is renamed to '_d_array_boundsm' in GDC, as passing ModuleInfo is unimplemented/yet to be implemented.


=== _d_switch_error ===
DMD: void _d_switch_error(ModuleInfo* m, uint line)
GDC: void _d_switch_error(string file, uint line)

Ditto above.


=== _d_hidden_func ===
DMD: void _d_hidden_func()
GDC: void _d_hidden_func(Object o)

DMD's implementation uses architecture dependent asm.


=== size_t/ptrdiff_t/sizediff_t ===

From src/rt/object_.d:
> // NOTE: For some reason, this declaration method doesn't work
> //       in this particular file (and this file only).  It must
> //       be a DMD thing.
> //alias typeof(int.sizeof)                    size_t;
> //alias typeof(cast(void*)0 - cast(void*)0)   ptrdiff_t;

Is there still need for this to be commented out? The alternative is a PITA.
@thewilsonator thewilsonator added the Druntime Specific to druntime label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants