plan9fox/sys/src/cmd/vl
cinap_lenrek 1d3644a168 cc, ?l: fix gethunk() to actually grow allocation
the compilers and linkers use ther own memory allocator.
free memory is between hunk and hunk+nhunk. allocation
works by checking if nhunk is bigger or equal to the
amount needed, and if not, repeatedly call gethunk()
until there is. after that, the allocated amount is added
from hunk and subtracted from nhunk by the user.

the problem was when the needed amount was bigger than
the default NHUNK size gethunk() allocates per call.
gethunk() would not actually grow nhunk, but instead
just set hunk and nhunk variables to the last allocated
block. this resulted in a infinite loop of calls to
gethunk() until sbrk() would hit the maximum size for
the BSS segment.

this change makes gethunk() actually grow the hunk space,
increasing nhunk, and only updating hunk when nhunk was
previously zero. we assume that mysbrk() retuns increasing
addresses and that the space between the previous hunk+nhunk
and the new block base returned by mysbrk() is usable.
2020-04-10 23:11:25 +02:00
..
asm.c
compat.c
l.h cc, ?a, ?l: change thunk type to uintptr 2020-04-10 20:38:45 +02:00
list.c
mkfile
noop.c
obj.c cc, ?l: fix gethunk() to actually grow allocation 2020-04-10 23:11:25 +02:00
optab.c
pass.c
sched.c
span.c