mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-12 05:59:10 +00:00
Introduce ctl::set and ctl::map
We now have a C++ red-black tree implementation that implements standard template library compatible APIs while compiling 10x faster than libcxx. It's not as beautiful as the red-black tree implementation in Plinko but this will get the job done and the test proves it upholds all invariants This change also restores CheckForMemoryLeaks() support and fixes a real actual bug I discovered with Doug Lea's dlmalloc_inspect_all() function.
This commit is contained in:
parent
388e236360
commit
c4c812c154
45 changed files with 2358 additions and 135 deletions
24
ctl/new.cc
24
ctl/new.cc
|
@ -34,7 +34,10 @@ _ctl_alloc(size_t n, size_t a)
|
|||
static void*
|
||||
_ctl_alloc1(size_t n)
|
||||
{
|
||||
return _ctl_alloc(n, 1);
|
||||
void* p;
|
||||
if (!(p = malloc(n)))
|
||||
__builtin_trap();
|
||||
return p;
|
||||
}
|
||||
|
||||
static void*
|
||||
|
@ -68,10 +71,21 @@ COSMOPOLITAN_C_END_
|
|||
now. If you have any brain cells left after reading this comment then go
|
||||
look at the eight operator delete weak references to free in the below. */
|
||||
|
||||
__weak_reference(void* operator new(size_t, ctl::align_val_t), _ctl_alloc);
|
||||
__weak_reference(void* operator new[](size_t, ctl::align_val_t), _ctl_alloc);
|
||||
__weak_reference(void* operator new(size_t), _ctl_alloc1);
|
||||
__weak_reference(void* operator new[](size_t), _ctl_alloc1);
|
||||
__weak_reference(void*
|
||||
operator new(size_t, ctl::align_val_t),
|
||||
_ctl_alloc);
|
||||
|
||||
__weak_reference(void*
|
||||
operator new[](size_t, ctl::align_val_t),
|
||||
_ctl_alloc);
|
||||
|
||||
__weak_reference(void*
|
||||
operator new(size_t),
|
||||
_ctl_alloc1);
|
||||
|
||||
__weak_reference(void*
|
||||
operator new[](size_t),
|
||||
_ctl_alloc1);
|
||||
|
||||
// XXX clang-format currently mutilates these for some reason.
|
||||
// clang-format off
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue