Make some systemic improvements

- add vdso dump utility
- tests now log stack usage
- rename g_ftrace to __ftrace
- make internal spinlocks go faster
- add conformant c11 atomics library
- function tracing now logs stack usage
- make function call tracing thread safe
- add -X unsecure (no ssl) mode to redbean
- munmap() has more consistent behavior now
- pacify fsync() calls on python unit tests
- make --strace flag work better in redbean
- start minimizing and documenting compiler flags
This commit is contained in:
Justine Tunney 2022-05-18 16:41:29 -07:00
parent c6bbca55e9
commit 9208c83f7a
141 changed files with 1948 additions and 1411 deletions

View file

@ -20,7 +20,7 @@
#include "third_party/dlmalloc/dlmalloc.h"
// clang-format off
#define FOOTERS 1
#define FOOTERS 0
#define MSPACES 0
#define HAVE_MMAP 1
@ -351,7 +351,7 @@ unsigned char _BitScanReverse(unsigned long *index, unsigned long mask);
# endif
# endif
# ifdef _SC_PAGE_SIZE
# define malloc_getpagesize sysconf(_SC_PAGE_SIZE)
# define malloc_getpagesize 4096 /*sysconf(_SC_PAGE_SIZE)*/
# else
# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
extern size_t getpagesize();
@ -1514,7 +1514,10 @@ static int init_mparams(void) {
size_t psize;
size_t gsize;
#ifndef WIN32
#if defined(__COSMOPOLITAN__)
psize = 4096;
gsize = 65536;
#elif !defined(WIN32)
psize = malloc_getpagesize;
gsize = ((DEFAULT_GRANULARITY != 0)? DEFAULT_GRANULARITY : psize);
#else /* WIN32 */

View file

@ -49,10 +49,17 @@ $(THIRD_PARTY_DLMALLOC_A).pkg: \
$(THIRD_PARTY_DLMALLOC_A_OBJS) \
$(foreach x,$(THIRD_PARTY_DLMALLOC_A_DIRECTDEPS),$($(x)_A).pkg)
$(THIRD_PARTY_DLMALLOC_A_OBJS): \
# we can't use address sanitizer because:
# address sanitizer depends on dlmalloc
o/$(MODE)/third_party/dlmalloc/dlmalloc.o: \
OVERRIDE_CFLAGS += \
$(NO_MAGIC) \
-ffreestanding \
-fno-sanitize=address
# we must segregate codegen because:
# file contains multiple independently linkable apis
o/$(MODE)/third_party/dlmalloc/dlmalloc.greg.o: \
OVERRIDE_CFLAGS += \
-ffunction-sections \
-fdata-sections

View file

@ -33,7 +33,7 @@ void *dlmalloc_requires_more_vespene_gas(size_t size) {
if ((p = mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0)) != MAP_FAILED) {
if (weaken(__asan_poison)) {
weaken(__asan_poison)((uintptr_t)p, size, kAsanHeapFree);
weaken(__asan_poison)(p, size, kAsanHeapFree);
}
}
return p;