Thread overview
[D-runtime] Use of X86 and X86_64 in druntime and phobos
Nov 26, 2011
Alex
Nov 26, 2011
Walter Bright
Nov 27, 2011
Alex
[phobos] Use of X86 and X86_64 in druntime and phobos
Nov 27, 2011
Alex
Nov 30, 2011
Sean Kelly
[D-runtime] [phobos] Use of X86 and X86_64 in druntime and phobos
Nov 30, 2011
Alex
[phobos] Use of X86 and X86_64 in druntime and phobos
Dec 02, 2011
Alex
November 26, 2011
Hi folks,

I've noticed an annoying trend in druntime and phobos of using the X86 and X86_64 version identifiers to make _bitness-dependent_ decisions. Some code goes along the lines of:

version (X86)
{
    ...
}
else version (X86_64)
{
    ...
}
else
    static assert(false, "Unknown platform");

In some cases, the assert isn't even present, so you just end up with compile errors that you need to go and investigate.

There's also code such as:

version (X86)
{
    ...
}
else
{
    ...
}

(Notice the unconditional else clause.)

This makes porting of druntime and phobos to non-x86 architectures a massive pain; there are so many places that need to be checked by hand or they won't work correctly on either 32-bit or 64-bit architectures (and in some cases, you won't get any error at compile-time, but rather observe a runtime crash).

I realize most non-DMD compilers maintain their own druntime/phobos trees, but one has to keep in mind that upstream druntime/phobos are merged into these regularly. I believe it is in everyone's best interest if we stop abusing architecture version identifiers as bitness version identifiers. IOW, use D_LP64 instead of X86 and X86_64.

If we can agree on this, I'll gladly submit some patches to both projects to sort this out.

(I ran into these issues while building GDC as an ARM cross-compiler.)

Regards,
Alex
November 25, 2011

On 11/25/2011 9:26 PM, Alex wrote:
> IOW, use D_LP64 instead of X86 and
> X86_64.
>
> If we can agree on this, I'll gladly submit some patches to both projects to sort this out.
>

Sounds good to me.
November 27, 2011
Hi,

Patch for druntime: https://github.com/D-Programming-Language/druntime/pull/93

Regards,
Alex

On Sat, Nov 26, 2011 at 7:08 AM, Walter Bright <walter at digitalmars.com> wrote:
>
>
> On 11/25/2011 9:26 PM, Alex wrote:
>>
>> IOW, use D_LP64 instead of X86 and
>> X86_64.
>>
>> If we can agree on this, I'll gladly submit some patches to both projects to sort this out.
>>
>
> Sounds good to me.
> _______________________________________________
> D-runtime mailing list
> D-runtime at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime
>
November 27, 2011
Hi,

Patch for phobos: https://github.com/D-Programming-Language/phobos/pull/335

Regards,
Alex

On Sat, Nov 26, 2011 at 6:26 AM, Alex <xtzgzorex at gmail.com> wrote:
> Hi folks,
>
> I've noticed an annoying trend in druntime and phobos of using the X86 and X86_64 version identifiers to make _bitness-dependent_ decisions. Some code goes along the lines of:
>
> version (X86)
> {
> ? ?...
> }
> else version (X86_64)
> {
> ? ?...
> }
> else
> ? ?static assert(false, "Unknown platform");
>
> In some cases, the assert isn't even present, so you just end up with compile errors that you need to go and investigate.
>
> There's also code such as:
>
> version (X86)
> {
> ? ?...
> }
> else
> {
> ? ?...
> }
>
> (Notice the unconditional else clause.)
>
> This makes porting of druntime and phobos to non-x86 architectures a massive pain; there are so many places that need to be checked by hand or they won't work correctly on either 32-bit or 64-bit architectures (and in some cases, you won't get any error at compile-time, but rather observe a runtime crash).
>
> I realize most non-DMD compilers maintain their own druntime/phobos trees, but one has to keep in mind that upstream druntime/phobos are merged into these regularly. I believe it is in everyone's best interest if we stop abusing architecture version identifiers as bitness version identifiers. IOW, use D_LP64 instead of X86 and X86_64.
>
> If we can agree on this, I'll gladly submit some patches to both projects to sort this out.
>
> (I ran into these issues while building GDC as an ARM cross-compiler.)
>
> Regards,
> Alex
>
November 30, 2011
Please submit patches.

Sent from my iPhone

On Nov 25, 2011, at 9:26 PM, Alex <xtzgzorex at gmail.com> wrote:

> Hi folks,
> 
> I've noticed an annoying trend in druntime and phobos of using the X86 and X86_64 version identifiers to make _bitness-dependent_ decisions. Some code goes along the lines of:
> 
> version (X86)
> {
>    ...
> }
> else version (X86_64)
> {
>    ...
> }
> else
>    static assert(false, "Unknown platform");
> 
> In some cases, the assert isn't even present, so you just end up with compile errors that you need to go and investigate.
> 
> There's also code such as:
> 
> version (X86)
> {
>    ...
> }
> else
> {
>    ...
> }
> 
> (Notice the unconditional else clause.)
> 
> This makes porting of druntime and phobos to non-x86 architectures a massive pain; there are so many places that need to be checked by hand or they won't work correctly on either 32-bit or 64-bit architectures (and in some cases, you won't get any error at compile-time, but rather observe a runtime crash).
> 
> I realize most non-DMD compilers maintain their own druntime/phobos trees, but one has to keep in mind that upstream druntime/phobos are merged into these regularly. I believe it is in everyone's best interest if we stop abusing architecture version identifiers as bitness version identifiers. IOW, use D_LP64 instead of X86 and X86_64.
> 
> If we can agree on this, I'll gladly submit some patches to both projects to sort this out.
> 
> (I ran into these issues while building GDC as an ARM cross-compiler.)
> 
> Regards,
> Alex
> _______________________________________________
> D-runtime mailing list
> D-runtime at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime
November 30, 2011
Hi,

Already done :)

https://github.com/D-Programming-Language/druntime/pull/93 https://github.com/D-Programming-Language/phobos/pull/335

Regards,
Alex

On Wed, Nov 30, 2011 at 6:43 PM, Sean Kelly <sean at invisibleduck.org> wrote:
> Please submit patches.
>
> Sent from my iPhone
>
> On Nov 25, 2011, at 9:26 PM, Alex <xtzgzorex at gmail.com> wrote:
>
>> Hi folks,
>>
>> I've noticed an annoying trend in druntime and phobos of using the X86 and X86_64 version identifiers to make _bitness-dependent_ decisions. Some code goes along the lines of:
>>
>> version (X86)
>> {
>> ? ?...
>> }
>> else version (X86_64)
>> {
>> ? ?...
>> }
>> else
>> ? ?static assert(false, "Unknown platform");
>>
>> In some cases, the assert isn't even present, so you just end up with compile errors that you need to go and investigate.
>>
>> There's also code such as:
>>
>> version (X86)
>> {
>> ? ?...
>> }
>> else
>> {
>> ? ?...
>> }
>>
>> (Notice the unconditional else clause.)
>>
>> This makes porting of druntime and phobos to non-x86 architectures a massive pain; there are so many places that need to be checked by hand or they won't work correctly on either 32-bit or 64-bit architectures (and in some cases, you won't get any error at compile-time, but rather observe a runtime crash).
>>
>> I realize most non-DMD compilers maintain their own druntime/phobos trees, but one has to keep in mind that upstream druntime/phobos are merged into these regularly. I believe it is in everyone's best interest if we stop abusing architecture version identifiers as bitness version identifiers. IOW, use D_LP64 instead of X86 and X86_64.
>>
>> If we can agree on this, I'll gladly submit some patches to both projects to sort this out.
>>
>> (I ran into these issues while building GDC as an ARM cross-compiler.)
>>
>> Regards,
>> Alex
>> _______________________________________________
>> D-runtime mailing list
>> D-runtime at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/d-runtime
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
December 03, 2011
Hi,

Ping to the phobos devs; the druntime patch has already been merged. Can https://github.com/D-Programming-Language/phobos/pull/335 be merged soon?

Regards,
Alex

On Sat, Nov 26, 2011 at 6:26 AM, Alex <xtzgzorex at gmail.com> wrote:
> Hi folks,
>
> I've noticed an annoying trend in druntime and phobos of using the X86 and X86_64 version identifiers to make _bitness-dependent_ decisions. Some code goes along the lines of:
>
> version (X86)
> {
> ? ?...
> }
> else version (X86_64)
> {
> ? ?...
> }
> else
> ? ?static assert(false, "Unknown platform");
>
> In some cases, the assert isn't even present, so you just end up with compile errors that you need to go and investigate.
>
> There's also code such as:
>
> version (X86)
> {
> ? ?...
> }
> else
> {
> ? ?...
> }
>
> (Notice the unconditional else clause.)
>
> This makes porting of druntime and phobos to non-x86 architectures a massive pain; there are so many places that need to be checked by hand or they won't work correctly on either 32-bit or 64-bit architectures (and in some cases, you won't get any error at compile-time, but rather observe a runtime crash).
>
> I realize most non-DMD compilers maintain their own druntime/phobos trees, but one has to keep in mind that upstream druntime/phobos are merged into these regularly. I believe it is in everyone's best interest if we stop abusing architecture version identifiers as bitness version identifiers. IOW, use D_LP64 instead of X86 and X86_64.
>
> If we can agree on this, I'll gladly submit some patches to both projects to sort this out.
>
> (I ran into these issues while building GDC as an ARM cross-compiler.)
>
> Regards,
> Alex