Changes between Initial Version and Version 1 of Internals/MemoryAllocation


Ignore:
Timestamp:
05/11/09 08:09:38 (6 years ago)
Author:
lpolzer
Comment:

Created.

Legend:

Unmodified
Added
Removed
Modified
  • Internals/MemoryAllocation

    v1 v1  
     1Explanation by gb: 
     2 
     3  Memory allocation is per-thread; a thread conses within a private "chunk" of memory by decrementing a per-thread pointer that starts at the high end of its current chunk and comparing that pointer to the low end of the chunk; if the pointer's above the limit, we use the memory, otherwise we need a new chunk: 
     4 
     5{{{ 
     6   [21]    (subl ($ 7) (@ (% fs) 132))  ; subtract the size of a cons - the tag of a 
     7cons 
     8                                        ; from the per-thread pointer 
     9   [30]    (movl (@ (% fs) 132) (% temp0)) ; load the per-thread pointer into a temp 
     10reg 
     11   [38]    (cmpl (@ (% fs) 136) (% temp0)) ; compare to limit 
     12   [46]    (ja L50)                        ; continue if above limit 
     13   [48]    (uuo-alloc)                     ; trap, get a new chunk 
     14L50 
     15   [50]    (andb ($ 248) (@ (% fs) 132))   ; clear tag bits in thread-local storage 
     16   [59]    (movl (% arg_y) (@ 3 (% temp0))) ; store car 
     17   [62]    (movl (% arg_z) (@ -1 (% temp0))) ; store cdr 
     18   [65]    (movl (% temp0) (% arg_z))      ; return cons cell 
     19}}}