[dmd-internals] 3rd Biweekly Sprint Planning

Daniel Murphy via dmd-internals dmd-internals at puremagic.com
Wed Aug 12 19:33:48 PDT 2015


On Thu, Aug 13, 2015 at 12:53 AM, Iain Buclaw via dmd-internals
<dmd-internals at puremagic.com> wrote:
> On 12 August 2015 at 00:59, Martin Nowak <code at dawg.eu> 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.


More information about the dmd-internals mailing list