diff --git a/jemalloc/include/jemalloc/internal/tcache.h b/jemalloc/include/jemalloc/internal/tcache.h index df302fba..e5061114 100644 --- a/jemalloc/include/jemalloc/internal/tcache.h +++ b/jemalloc/include/jemalloc/internal/tcache.h @@ -70,16 +70,16 @@ extern __thread tcache_t *tcache_tls JEMALLOC_ATTR(tls_model("initial-exec")); # define TCACHE_GET() tcache_tls # define TCACHE_SET(v) do { \ - tcache_tls = (v); \ + tcache_tls = (tcache_t *)(v); \ pthread_setspecific(tcache_tsd, (void *)(v)); \ } while (0) #else -extern pthread_key_t tcache_tsd; # define TCACHE_GET() ((tcache_t *)pthread_getspecific(tcache_tsd)) # define TCACHE_SET(v) do { \ pthread_setspecific(tcache_tsd, (void *)(v)); \ } while (0) #endif +extern pthread_key_t tcache_tsd; /* * Number of tcache bins. There are nbins small-object bins, plus 0 or more diff --git a/jemalloc/test/posix_memalign.c b/jemalloc/test/posix_memalign.c index 0f2c879c..cd3cadc9 100644 --- a/jemalloc/test/posix_memalign.c +++ b/jemalloc/test/posix_memalign.c @@ -9,7 +9,7 @@ #define CHUNK 0x100000 /* #define MAXALIGN ((size_t)0x80000000000LLU) */ -#define MAXALIGN ((size_t)0x40000000LLU) +#define MAXALIGN ((size_t)0x2000000LLU) #define NITER 4 int @@ -46,8 +46,8 @@ main(void) alignment = 0x8000000000000000LLU; size = 0x8000000000000000LLU; #else - alignment = 0x8000 0000LU; - size = 0x8000 0000LU; + alignment = 0x80000000LU; + size = 0x80000000LU; #endif err = JEMALLOC_P(posix_memalign)(&p, alignment, size); if (err == 0) { @@ -86,22 +86,21 @@ main(void) for (i = 0; i < NITER; i++) ps[i] = NULL; - for (alignment = sizeof(void *); + for (alignment = 8; alignment <= MAXALIGN; alignment <<= 1) { total = 0; fprintf(stderr, "Alignment: %zu\n", alignment); for (size = 1; size < 3 * alignment && size < (1U << 31); - size += (alignment >> 2) - 1) { + size += (alignment >> (LG_SIZEOF_PTR-1)) - 1) { for (i = 0; i < NITER; i++) { err = JEMALLOC_P(posix_memalign)(&ps[i], alignment, size); if (err) { fprintf(stderr, - "Error for size 0x%x %zu : %s\n", - (unsigned)size, size, - strerror(err)); + "Error for size %zu (0x%zx): %s\n", + size, size, strerror(err)); exit(1); } total += JEMALLOC_P(malloc_usable_size)(ps[i]); diff --git a/jemalloc/test/posix_memalign.exp b/jemalloc/test/posix_memalign.exp index f815b2fe..b5061c72 100644 --- a/jemalloc/test/posix_memalign.exp +++ b/jemalloc/test/posix_memalign.exp @@ -22,9 +22,4 @@ Alignment: 4194304 Alignment: 8388608 Alignment: 16777216 Alignment: 33554432 -Alignment: 67108864 -Alignment: 134217728 -Alignment: 268435456 -Alignment: 536870912 -Alignment: 1073741824 Test end