Remove unused FFI_CLOSURE_TEST It was here since the first commit c6dddbd (warning: huge diff) and it wasn't defined by the configure script. It was probably used manually during development.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
diff --git a/src/closures.c b/src/closures.c
index 05849e0..2e0ffb4 100644
--- a/src/closures.c
+++ b/src/closures.c
@@ -331,14 +331,6 @@ ffi_closure_free (void *ptr)
/* Don't allocate more than a page unless needed. */
#define DEFAULT_GRANULARITY ((size_t)malloc_getpagesize)
-#if FFI_CLOSURE_TEST
-/* Don't release single pages, to avoid a worst-case scenario of
- continuously allocating and releasing single pages, but release
- pairs of pages, which should do just as well given that allocations
- are likely to be small. */
-#define DEFAULT_TRIM_THRESHOLD ((size_t)malloc_getpagesize)
-#endif
-
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -758,10 +750,6 @@ dlmmap (void *start, size_t length, int prot,
&& flags == (MAP_PRIVATE | MAP_ANONYMOUS)
&& fd == -1 && offset == 0);
-#if FFI_CLOSURE_TEST
- printf ("mapping in %zi\n", length);
-#endif
-
if (execfd == -1 && is_emutramp_enabled ())
{
ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset);
@@ -807,10 +795,6 @@ dlmunmap (void *start, size_t length)
msegmentptr seg = segment_holding (gm, start);
void *code;
-#if FFI_CLOSURE_TEST
- printf ("unmapping %zi\n", length);
-#endif
-
if (seg && (code = add_segment_exec_offset (start, seg)) != start)
{
int ret = munmap (code, length);
@@ -879,26 +863,6 @@ ffi_closure_free (void *ptr)
dlfree (ptr);
}
-
-#if FFI_CLOSURE_TEST
-/* Do some internal sanity testing to make sure allocation and
- deallocation of pages are working as intended. */
-int main ()
-{
- void *p[3];
-#define GET(idx, len) do { p[idx] = dlmalloc (len); printf ("allocated %zi for p[%i]\n", (len), (idx)); } while (0)
-#define PUT(idx) do { printf ("freeing p[%i]\n", (idx)); dlfree (p[idx]); } while (0)
- GET (0, malloc_getpagesize / 2);
- GET (1, 2 * malloc_getpagesize - 64 * sizeof (void*));
- PUT (1);
- GET (1, 2 * malloc_getpagesize);
- GET (2, malloc_getpagesize / 2);
- PUT (1);
- PUT (0);
- PUT (2);
- return 0;
-}
-#endif /* FFI_CLOSURE_TEST */
# else /* ! FFI_MMAP_EXEC_WRIT */
/* On many systems, memory returned by malloc is writable and