core.traits?

Mike Franklin slavo5150 at yahoo.com
Wed Jan 9 11:49:40 UTC 2019


On Wednesday, 9 January 2019 at 11:01:46 UTC, Jacob Carlborg 
wrote:
> On 2019-01-09 03:32, Mike Franklin wrote:
>
>> Here's what I think will help:
>> 1.  Get `alloca` or dynamic stack array allocation working.  
>> This will help a lot because we won't have to reach for 
>> `malloc` and friends for simple allocations like generating 
>> dynamic assert messages
>
> What's the problem with "alloca"?

In DMD you can't use it without linking in the runtime, but in 
LDC and GDC, you can.  One of the goals of implementing these 
runtime hooks as templates is to make more features available in 
-betterC builds, or for pay-as-you-go runtime implementations.  
If you need to link in druntime to get `alloca`, you can't 
implement the runtime hooks as templates and have them work in 
-betterC.

>> 2.  Convert `memcpy`, `memset`, and `memcmp` to strongly-typed 
>> D templates so they can be used in the implementations when 
>> converting runtime hooks to templates.  I did some exploration 
>> on that and published my results at 
>> https://github.com/JinShil/memcpyD.  Unfortunately, DMD is 
>> missing an AVX512 implementation so I couldn't continue.
>
> What do you mean "couldn't continue"? It's possible to 
> implement "memcpy" without AVX512. Am I missing something?

Yes, it's possible, but I don't think it will ever be accepted if 
it doesn't perform at least as well as the optimized versions in 
C or assembly that use AVX512 or other SIMD features.  It needs 
to be at least as good as what libc provides, so we need to be 
able to leverage these unique hardware features to get the best 
performance.

Mike


More information about the Digitalmars-d mailing list