Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 0 additions & 72 deletions src/rt/arrayassign.d
Original file line number Diff line number Diff line change
Expand Up @@ -162,45 +162,6 @@ extern (C) void[] _d_arrayassign_r(TypeInfo ti, void[] src, void[] dst, void* pt
return dst;
}

/**
* Does array initialization (not assignment) from another
* array of the same element type.
* ti is the element type.
*/
extern (C) void[] _d_arrayctor(TypeInfo ti, void[] from, void[] to)
{
debug(PRINTF) printf("_d_arrayctor(from = %p,%d, to = %p,%d) size = %d\n", from.ptr, from.length, to.ptr, to.length, ti.tsize);


auto element_size = ti.tsize;

enforceRawArraysConformable("initialization", element_size, from, to);

size_t i;
try
{
for (i = 0; i < to.length; i++)
{
// Copy construction is defined as bit copy followed by postblit.
memcpy(to.ptr + i * element_size, from.ptr + i * element_size, element_size);
ti.postblit(to.ptr + i * element_size);
}
}
catch (Throwable o)
{
/* Destroy, in reverse order, what we've constructed so far
*/
while (i--)
{
ti.destroy(to.ptr + i * element_size);
}

throw o;
}
return to;
}


/**
* Do assignment to an array.
* p[0 .. count] = value;
Expand All @@ -227,36 +188,3 @@ extern (C) void* _d_arraysetassign(void* p, void* value, int count, TypeInfo ti)
free(ptmp);
return pstart;
}

/**
* Do construction of an array.
* ti[count] p = value;
*/
extern (C) void* _d_arraysetctor(void* p, void* value, int count, TypeInfo ti)
{
void* pstart = p;
auto element_size = ti.tsize;

try
{
foreach (i; 0 .. count)
{
// Copy construction is defined as bit copy followed by postblit.
memcpy(p, value, element_size);
ti.postblit(p);
p += element_size;
}
}
catch (Throwable o)
{
// Destroy, in reverse order, what we've constructed so far
while (p > pstart)
{
p -= element_size;
ti.destroy(p);
}

throw o;
}
return pstart;
}
39 changes: 0 additions & 39 deletions src/rt/lifetime.d
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,6 @@ extern (C) void _d_delclass(Object* p) @weak
}
}

/**
* This is called for a delete statement where the value
* being deleted is a pointer to a struct with a destructor
* but doesn't have an overloaded delete operator.
*/
extern (C) void _d_delstruct(void** p, TypeInfo_Struct inf) @weak
{
if (*p)
{
debug(PRINTF) printf("_d_delstruct(%p, %p)\n", *p, cast(void*)inf);

inf.destroy(*p);
GC.free(*p);
*p = null;
}
}

// strip const/immutable/shared/inout from type info
inout(TypeInfo) unqualify(return scope inout(TypeInfo) cti) pure nothrow @nogc
{
Expand Down Expand Up @@ -1872,23 +1855,6 @@ do
return *p;
}

/**
* Append y[] to array x[]
*/
extern (C) void[] _d_arrayappendT(const TypeInfo ti, ref byte[] x, byte[] y) @weak
{
import core.stdc.string;
auto length = x.length;
auto tinext = unqualify(ti.next);
auto sizeelem = tinext.tsize; // array element size
_d_arrayappendcTX(ti, x, y.length);
memcpy(x.ptr + length * sizeelem, y.ptr, y.length * sizeelem);

// do postblit
__doPostblit(x.ptr + length * sizeelem, y.length * sizeelem, tinext);
return x;
}


/**
*
Expand Down Expand Up @@ -2606,11 +2572,6 @@ deprecated unittest
}
}

dtorCount = 0;
S1* s1 = new S1;
_d_delstruct(cast(void**)&s1, typeid(typeof(*s1))); // delete s1;
assert(dtorCount == 1);

dtorCount = 0;
S1[] arr1 = new S1[7];
_d_delarray_t(cast(void[]*)&arr1, typeid(typeof(arr1[0]))); // delete arr1;
Expand Down
2 changes: 0 additions & 2 deletions src/rt/tracegc.d
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ extern (C) void _d_callfinalizer(void* p);
extern (C) void _d_callinterfacefinalizer(void *p);
extern (C) void _d_delclass(Object* p);
extern (C) void _d_delinterface(void** p);
extern (C) void _d_delstruct(void** p, TypeInfo_Struct inf);
extern (C) void _d_delarray_t(void[]* p, const TypeInfo_Struct _);
extern (C) void _d_delmemory(void* *p);
extern (C) byte[] _d_arraycatT(const TypeInfo ti, byte[] x, byte[] y);
extern (C) void[] _d_arraycatnTX(const TypeInfo ti, scope byte[][] arrs);
extern (C) void* _d_arrayliteralTX(const TypeInfo ti, size_t length);
extern (C) void* _d_assocarrayliteralTX(const TypeInfo_AssociativeArray ti,
void[] keys, void[] vals);
extern (C) void[] _d_arrayappendT(const TypeInfo ti, ref byte[] x, byte[] y);
extern (C) byte[] _d_arrayappendcTX(const TypeInfo ti, return scope ref byte[] px, size_t n);
extern (C) void[] _d_arrayappendcd(ref byte[] x, dchar c);
extern (C) void[] _d_arrayappendwd(ref byte[] x, dchar c);
Expand Down