From 9d46360c9d83fa95f42f1eebbad49ecd9281fb0d Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 11 Apr 2020 01:26:36 +0200 Subject: backout the gethunk() again, as that breaks the assemblers the assemblers share gethunk() cc/macbody but are compiled without compat.c, so calls such as getenv() trigger malloc() which does its own sbrk() calls, breaking the continuity of the hunk. so this change needs another revision. until then, this is backed out. --- sys/src/cmd/kl/l.h | 2 +- sys/src/cmd/kl/obj.c | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'sys/src/cmd/kl') diff --git a/sys/src/cmd/kl/l.h b/sys/src/cmd/kl/l.h index 169f68c3f..e296e4509 100644 --- a/sys/src/cmd/kl/l.h +++ b/sys/src/cmd/kl/l.h @@ -241,7 +241,7 @@ EXTERN long symsize; EXTERN long staticgen; EXTERN Prog* textp; EXTERN long textsize; -EXTERN uintptr thunk; +EXTERN uintptr tothunk; EXTERN char xcmp[C_NCLASS][C_NCLASS]; EXTERN int version; EXTERN Prog zprg; diff --git a/sys/src/cmd/kl/obj.c b/sys/src/cmd/kl/obj.c index 322a060a3..b778cfd8d 100644 --- a/sys/src/cmd/kl/obj.c +++ b/sys/src/cmd/kl/obj.c @@ -194,7 +194,7 @@ main(int argc, char *argv[]) out: if(debug['v']) { Bprint(&bso, "%5.2f cpu time\n", cputime()); - Bprint(&bso, "%zud memory used\n", thunk); + Bprint(&bso, "%zud memory used\n", tothunk); Bprint(&bso, "%d sizeof adr\n", sizeof(Adr)); Bprint(&bso, "%d sizeof prog\n", sizeof(Prog)); } @@ -983,9 +983,9 @@ gethunk(void) long nh; nh = NHUNK; - if(thunk >= 5L*NHUNK) { + if(tothunk >= 5L*NHUNK) { nh = 5L*NHUNK; - if(thunk >= 25L*NHUNK) + if(tothunk >= 25L*NHUNK) nh = 25L*NHUNK; } h = mysbrk(nh); @@ -993,12 +993,10 @@ gethunk(void) diag("out of memory"); errorexit(); } - if(nhunk == 0) - hunk = h; - else - nh += (h - hunk) - nhunk; - nhunk += nh; - thunk += nh; + + hunk = h; + nhunk = nh; + tothunk += nh; } void -- cgit v1.2.3