On Thu, Aug 13, 2015 at 12:53 AM, Iain Buclaw via dmd-internals
<[email protected]> wrote:
> On 12 August 2015 at 00:59, Martin Nowak <[email protected]> wrote:
>
> These are all places where class allocations occur the most it seems.
>
> I was about to propose making this change:
>
>  extern (C) Object _d_newclass(const ClassInfo ci)
>  {
>      auto p = allocmemory(ci.init.length);
> +    *(cast(void **) p) = cast(void*) ci.vtbl;
> -    p[0 .. ci.init.length] = cast(void[])ci.init[];
>      return cast(Object)p;
>  }
>
> But then I checked and found out that Daniel removes all ctors in the D
> conversion. =)
>
> I guess this is the reason why memcpy calls have increased!
>

We don't have support for constructing classes across the language
boundary, and without the memcpy the member variables will be
uninitialized.  D (or at least dmd's druntime) requires the init[]
blit before constructor calls anyway.
_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals

Reply via email to