Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: fusl/src/malloc/malloc.c

Issue 1706293003: [fusl] Remove some more tabs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #define _GNU_SOURCE 1 #define _GNU_SOURCE
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include <string.h> 3 #include <string.h>
4 #include <limits.h> 4 #include <limits.h>
5 #include <stdint.h> 5 #include <stdint.h>
6 #include <errno.h> 6 #include <errno.h>
7 #include <sys/mman.h> 7 #include <sys/mman.h>
8 #include "libc.h" 8 #include "libc.h"
9 #include "atomic.h" 9 #include "atomic.h"
10 #include "pthread_impl.h" 10 #include "pthread_impl.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 float v; 127 float v;
128 uint32_t r; 128 uint32_t r;
129 }){(int)x} 129 }){(int)x}
130 .r + 130 .r +
131 0x1fffff) >> 131 0x1fffff) >>
132 21) - 132 21) -
133 496; 133 496;
134 } 134 }
135 135
136 #if 0 136 #if 0
137 void __dump_heap(int x) 137 void __dump_heap(int x) {
138 { 138 struct chunk* c;
139 » struct chunk *c; 139 int i;
140 » int i; 140 for (c = (void*)mal.heap; CHUNK_SIZE(c); c = NEXT_CHUNK(c))
141 » for (c = (void *)mal.heap; CHUNK_SIZE(c); c = NEXT_CHUNK(c)) 141 fprintf(stderr, "base %p size %zu (%d) flags %d/%d\n", c, CHUNK_SIZE(c),
142 » » fprintf(stderr, "base %p size %zu (%d) flags %d/%d\n", 142 bin_index(CHUNK_SIZE(c)), c->csize & 15, NEXT_CHUNK(c)->psize & 15);
143 » » » c, CHUNK_SIZE(c), bin_index(CHUNK_SIZE(c)), 143 for (i = 0; i < 64; i++) {
144 » » » c->csize & 15, 144 if (mal.bins[i].head != BIN_TO_CHUNK(i) && mal.bins[i].head) {
145 » » » NEXT_CHUNK(c)->psize & 15); 145 fprintf(stderr, "bin %d: %p\n", i, mal.bins[i].head);
146 » for (i=0; i<64; i++) { 146 if (!(mal.binmap & 1ULL << i))
147 » » if (mal.bins[i].head != BIN_TO_CHUNK(i) && mal.bins[i].head) { 147 fprintf(stderr, "missing from binmap!\n");
148 » » » fprintf(stderr, "bin %d: %p\n", i, mal.bins[i].head); 148 } else if (mal.binmap & 1ULL << i)
149 » » » if (!(mal.binmap & 1ULL<<i)) 149 fprintf(stderr, "binmap wrongly contains %d!\n", i);
150 » » » » fprintf(stderr, "missing from binmap!\n"); 150 }
151 » » } else if (mal.binmap & 1ULL<<i)
152 » » » fprintf(stderr, "binmap wrongly contains %d!\n", i);
153 » }
154 } 151 }
155 #endif 152 #endif
156 153
157 void* __expand_heap(size_t*); 154 void* __expand_heap(size_t*);
158 155
159 static struct chunk* expand_heap(size_t n) { 156 static struct chunk* expand_heap(size_t n) {
160 static int heap_lock[2]; 157 static int heap_lock[2];
161 static void* end; 158 static void* end;
162 void* p; 159 void* p;
163 struct chunk* w; 160 struct chunk* w;
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 #if 1 523 #if 1
527 __madvise((void*)a, b - a, MADV_DONTNEED); 524 __madvise((void*)a, b - a, MADV_DONTNEED);
528 #else 525 #else
529 __mmap((void*)a, b - a, PROT_READ | PROT_WRITE, 526 __mmap((void*)a, b - a, PROT_READ | PROT_WRITE,
530 MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); 527 MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
531 #endif 528 #endif
532 } 529 }
533 530
534 unlock_bin(i); 531 unlock_bin(i);
535 } 532 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698