mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-03 11:12:27 +00:00
Bring back gc() function
Renaming gc() to _gc() was a mistake since the better thing to do is put it behind the _COSMO_SOURCE macro. We need this change because I haven't wanted to use my amazing garbage collector ever since we renamed it. You now need to define _COSMO_SOURCE yourself when using amalgamation header and cosmocc users need to pass the -mcosmo flag to get the gc() function Some other issues relating to cancelation have been fixed along the way. We're also now putting cosmocc in a folder named `.cosmocc` so it can be more safely excluded by grep --exclude-dir=.cosmocc --exclude-dir=o etc.
This commit is contained in:
parent
6cb0354e19
commit
a4b455185b
280 changed files with 1362 additions and 1407 deletions
|
@ -54,9 +54,9 @@ void insertionsort(int32_t *a, size_t n) {
|
|||
TEST(djbsort, test4) {
|
||||
static const int kA[] = {4, 3, 2, 1};
|
||||
n = ARRAYLEN(kA);
|
||||
a = memcpy(_gc(malloc(n * 4)), kA, n * 4);
|
||||
b = memcpy(_gc(malloc(n * 4)), kA, n * 4);
|
||||
c = memcpy(_gc(malloc(n * 4)), kA, n * 4);
|
||||
a = memcpy(gc(malloc(n * 4)), kA, n * 4);
|
||||
b = memcpy(gc(malloc(n * 4)), kA, n * 4);
|
||||
c = memcpy(gc(malloc(n * 4)), kA, n * 4);
|
||||
insertionsort(a, n);
|
||||
djbsort_avx2(b, n);
|
||||
djbsort(c, n);
|
||||
|
@ -82,9 +82,9 @@ TEST(djbsort, test64) {
|
|||
-1323943608, -1219421355, -582289873, 1062699814,
|
||||
};
|
||||
n = ARRAYLEN(kA);
|
||||
a = memcpy(_gc(malloc(n * 4)), kA, n * 4);
|
||||
b = memcpy(_gc(malloc(n * 4)), kA, n * 4);
|
||||
c = memcpy(_gc(malloc(n * 4)), kA, n * 4);
|
||||
a = memcpy(gc(malloc(n * 4)), kA, n * 4);
|
||||
b = memcpy(gc(malloc(n * 4)), kA, n * 4);
|
||||
c = memcpy(gc(malloc(n * 4)), kA, n * 4);
|
||||
insertionsort(a, n);
|
||||
djbsort(c, n);
|
||||
ASSERT_EQ(0, memcmp(a, c, n * 4));
|
||||
|
@ -104,7 +104,7 @@ static int CompareInt(const void *a, const void *b) {
|
|||
|
||||
BENCH(djbsort, bench) {
|
||||
n = 256;
|
||||
a = _gc(memalign(32, n * 4));
|
||||
a = gc(memalign(32, n * 4));
|
||||
EZBENCH2("insertionsort[255]", rngset(a, n * 4, _rand64, -1),
|
||||
insertionsort(a, n));
|
||||
EZBENCH2("djbsort[255]", rngset(a, n * 4, _rand64, -1), djbsort(a, n));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue