-
-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part 1 of the experiment to remove doug_lea_allocator.
- Loading branch information
1 parent
2ba0a72
commit a9eb04f
Showing
22 changed files
with
49 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1 @@ | ||
#include "pch.hpp" | ||
|
||
#ifdef USE_ARENA_ALLOCATOR | ||
static const u32 s_arena_size = (128 + 16) * 1024 * 1024; | ||
static char s_fake_array[s_arena_size]; | ||
doug_lea_allocator g_collision_allocator(s_fake_array, s_arena_size, "opcode"); | ||
#endif // #ifdef USE_ARENA_ALLOCATOR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,6 @@ | ||
#pragma once | ||
|
||
#include <algorithm> | ||
|
||
#include "Common/Common.hpp" | ||
#include "xrCore/xrCore.h" | ||
#include "xrCore/Memory/doug_lea_allocator.h" | ||
|
||
#ifdef USE_ARENA_ALLOCATOR | ||
extern doug_lea_allocator g_collision_allocator; | ||
|
||
#define CNEW(type) new (g_collision_allocator.alloc_impl<type>(1)) type | ||
#define CDELETE(ptr) cdelete(ptr) | ||
#define CFREE(ptr) g_collision_allocator.free_impl(ptr) | ||
#define CMALLOC(size) g_collision_allocator.malloc_impl(size) | ||
#define CALLOC(type, count) g_collision_allocator.alloc_impl<type>(count) | ||
#else // #ifdef USE_ARENA_ALLOCATOR | ||
#define CNEW(type) new (xr_alloc<type>(1)) type | ||
#define CDELETE(ptr) xr_delete(ptr) | ||
#define CFREE(ptr) xr_free(ptr) | ||
#define CMALLOC(size) xr_malloc(size) | ||
#define CALLOC(type, count) xr_alloc<type>(count) | ||
#endif // #ifdef USE_ARENA_ALLOCATOR | ||
|
||
template <bool _is_pm, typename T> | ||
struct cspecial_free | ||
{ | ||
IC void operator()(T*& ptr) | ||
{ | ||
void* _real_ptr = dynamic_cast<void*>(ptr); | ||
ptr->~T(); | ||
CFREE(_real_ptr); | ||
} | ||
}; | ||
|
||
template <typename T> | ||
struct cspecial_free<false, T> | ||
{ | ||
IC void operator()(T*& ptr) | ||
{ | ||
ptr->~T(); | ||
CFREE(ptr); | ||
} | ||
}; | ||
|
||
template <class T> | ||
IC void cdelete(T*& ptr) | ||
{ | ||
if (ptr) | ||
{ | ||
cspecial_free<std::is_polymorphic<T>::value, T>()(ptr); | ||
ptr = NULL; | ||
} | ||
} | ||
|
||
#include "Opcode.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.