More tests:
-removed some unused code -fixed bug with struct destructors (Mallocator called __dtor instead of __xdtor) -added unittests for events -addded _d_eh_personality null implementation as LDC betterC bug workaround
This commit is contained in:
parent
d0b7138f9f
commit
cb9eaad123
5 changed files with 160 additions and 19 deletions
|
|
@ -95,7 +95,7 @@ package struct EventManager
|
|||
|
||||
void clearEvents() nothrow @nogc
|
||||
{
|
||||
uint threads_count = cast(uint)manager.threads.length;
|
||||
//uint threads_count = cast(uint)manager.threads.length;
|
||||
foreach(ref event;events)
|
||||
{
|
||||
foreach(ref first_block; event.first_blocks)
|
||||
|
|
@ -133,23 +133,11 @@ package struct EventManager
|
|||
|
||||
private void disposeData() nothrow @nogc
|
||||
{
|
||||
clearEvents();
|
||||
if(events)
|
||||
{
|
||||
foreach(ref event;events)
|
||||
{
|
||||
foreach(first_block; event.first_blocks)
|
||||
{
|
||||
EventBlock* block = first_block;
|
||||
EventBlock* next_block;
|
||||
if(block)next_block = first_block.next;
|
||||
while(block)
|
||||
{
|
||||
Mallocator.dispose(block);
|
||||
block = next_block;
|
||||
if(block)next_block = block.next;
|
||||
}
|
||||
}
|
||||
|
||||
Mallocator.dispose(event.blocks);
|
||||
Mallocator.dispose(event.first_blocks);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3138,12 +3138,13 @@ export struct EntityManager
|
|||
struct EntitiesBlock
|
||||
{
|
||||
///return distance (in bytes) from begin of block to data
|
||||
export uint dataDelta() nothrow @nogc pure
|
||||
///TODO: probably to remove. It's used by old code if I remeber correctly.
|
||||
/*export uint dataDelta() nothrow @nogc pure
|
||||
{
|
||||
ushort dif = EntitiesBlock.sizeof;
|
||||
alignNum(dif, type_info.alignment);
|
||||
return dif;
|
||||
}
|
||||
}*/
|
||||
|
||||
///return pointer to first element in block
|
||||
export void* dataBegin() nothrow @nogc pure
|
||||
|
|
|
|||
|
|
@ -187,13 +187,15 @@ static struct Mallocator
|
|||
|
||||
static void dispose(T)(T object) nothrow @nogc
|
||||
{
|
||||
static if(__traits(hasMember, T, "__dtor"))object.__dtor();
|
||||
static if(__traits(hasMember, T, "__xdtor"))object.__xdtor();
|
||||
else static if(__traits(hasMember, T, "__dtor"))object.__dtor();
|
||||
free(cast(void*)object);
|
||||
}
|
||||
|
||||
static void alignDispose(T)(T object)
|
||||
{
|
||||
static if(__traits(hasMember, T, "__dtor"))object.__dtor();
|
||||
static if(__traits(hasMember, T, "__xdtor"))object.__xdtor();
|
||||
else static if(__traits(hasMember, T, "__dtor"))object.__dtor();
|
||||
version(Posix)free(cast(void*)object);
|
||||
else version(Windows)_aligned_free(cast(void*)object);
|
||||
else version(ECSEmscripten)free(cast(void*)object);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue