20,7 → 20,7 |
; esi= nb |
; ebx= idx |
; |
align 4 |
align 16 |
malloc: |
push esi |
|
31,8 → 31,8 |
and esi, -8 |
add esi, 8 |
|
mov ecx, mst.mutex |
call mutex_lock |
mov ebx, mst.mutex |
call wait_mutex ;ebx |
|
cmp esi, 256 |
jae .large |
92,13 → 92,9 |
pop edi |
pop ebp |
.done: |
mov esi, eax |
mov ecx, mst.mutex |
call mutex_unlock |
mov eax, esi |
pop esi |
mov [mst.mutex], 0 |
ret |
|
.split: |
lea ebx, [edx+8] ;ebx=mem |
|
137,10 → 133,10 |
mov [edx+12], eax ; F->bk = r; |
mov [eax+8], edx ; r->fd = F; |
mov [eax+12], ecx ; r->bk = B; |
|
mov eax, ebx |
jmp .done |
|
pop esi |
mov [mst.mutex], 0 |
ret |
.small: |
|
; if (ms.treemap != 0 && (mem = malloc_small(nb)) != 0) |
154,8 → 150,9 |
call malloc_small |
test eax, eax |
jz .from_top |
jmp .done |
|
pop esi |
and [mst.mutex], 0 |
ret |
.large: |
|
; if (ms.treemap != 0 && (mem = malloc_large(nb)) != 0) |
192,15 → 189,18 |
mov [edx+4], eax |
mov [ecx+4], esi |
lea eax, [ecx+8] |
jmp .done |
|
pop esi |
and [mst.mutex], 0 |
ret |
.fail: |
xor eax, eax |
jmp .done |
pop esi |
and [mst.mutex], 0 |
ret |
|
; param |
; eax= mem |
align 4 |
|
free: |
push edi |
mov edi, eax |
211,8 → 211,8 |
test byte [edi+4], 2 |
je .fail |
|
mov ecx, mst.mutex |
call mutex_lock |
mov ebx, mst.mutex |
call wait_mutex ;ebx |
|
; psize = p->head & (~3); |
|
289,10 → 289,7 |
mov [mst.top], edi |
mov [edi+4], eax |
.fail2: |
mov esi, eax |
mov ecx, mst.mutex |
call mutex_unlock |
mov eax, esi |
and [mst.mutex], 0 |
pop esi |
.fail: |
pop edi |
413,15 → 410,13 |
mov [esi+8], edx ;P->fd = F |
mov [esi+12], eax ;P->bk = B |
pop esi |
mov ecx, mst.mutex |
call mutex_unlock |
and [mst.mutex], 0 |
ret |
.large: |
mov ebx, eax |
call insert_large_chunk |
pop esi |
mov ecx, mst.mutex |
call mutex_unlock |
and [mst.mutex], 0 |
ret |
|
|
1030,8 → 1025,5 |
cmp eax, mst.smallbins+512 |
jb @B |
|
mov ecx, mst.mutex |
call mutex_init |
|
ret |
|