summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-04-11 01:26:36 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2020-04-11 01:26:36 +0200
commit9d46360c9d83fa95f42f1eebbad49ecd9281fb0d (patch)
tree58d0a1110febae03a4b0231c6107adb88fb57821
parent1d3644a1684bd191f3a36568d94c2587c2d9f24f (diff)
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.
-rw-r--r--sys/src/cmd/1l/obj.c7
-rw-r--r--sys/src/cmd/2l/obj.c7
-rw-r--r--sys/src/cmd/5l/obj.c7
-rw-r--r--sys/src/cmd/6l/obj.c7
-rw-r--r--sys/src/cmd/7l/obj.c7
-rw-r--r--sys/src/cmd/8l/obj.c7
-rw-r--r--sys/src/cmd/cc/macbody7
-rw-r--r--sys/src/cmd/kl/l.h2
-rw-r--r--sys/src/cmd/kl/obj.c16
-rw-r--r--sys/src/cmd/ql/l.h2
-rw-r--r--sys/src/cmd/ql/obj.c16
-rw-r--r--sys/src/cmd/vl/obj.c7
12 files changed, 32 insertions, 60 deletions
diff --git a/sys/src/cmd/1l/obj.c b/sys/src/cmd/1l/obj.c
index fae49a6ad..9cc82a56e 100644
--- a/sys/src/cmd/1l/obj.c
+++ b/sys/src/cmd/1l/obj.c
@@ -1099,11 +1099,8 @@ gethunk(void)
diag("out of memory");
errorexit();
}
- if(nhunk == 0)
- hunk = h;
- else
- nh += (h - hunk) - nhunk;
- nhunk += nh;
+ hunk = h;
+ nhunk = nh;
thunk += nh;
}
diff --git a/sys/src/cmd/2l/obj.c b/sys/src/cmd/2l/obj.c
index 653f04fa2..411d2a5f5 100644
--- a/sys/src/cmd/2l/obj.c
+++ b/sys/src/cmd/2l/obj.c
@@ -1121,11 +1121,8 @@ gethunk(void)
diag("out of memory");
errorexit();
}
- if(nhunk == 0)
- hunk = h;
- else
- nh += (h - hunk) - nhunk;
- nhunk += nh;
+ hunk = h;
+ nhunk = nh;
thunk += nh;
}
diff --git a/sys/src/cmd/5l/obj.c b/sys/src/cmd/5l/obj.c
index 1b28978b5..c10d4b8dd 100644
--- a/sys/src/cmd/5l/obj.c
+++ b/sys/src/cmd/5l/obj.c
@@ -1152,11 +1152,8 @@ gethunk(void)
diag("out of memory");
errorexit();
}
- if(nhunk == 0)
- hunk = h;
- else
- nh += (h - hunk) - nhunk;
- nhunk += nh;
+ hunk = h;
+ nhunk = nh;
thunk += nh;
}
diff --git a/sys/src/cmd/6l/obj.c b/sys/src/cmd/6l/obj.c
index e4e8a44fb..5483eebae 100644
--- a/sys/src/cmd/6l/obj.c
+++ b/sys/src/cmd/6l/obj.c
@@ -1222,11 +1222,8 @@ gethunk(void)
diag("out of memory");
errorexit();
}
- if(nhunk == 0)
- hunk = h;
- else
- nh += (h - hunk) - nhunk;
- nhunk += nh;
+ hunk = h;
+ nhunk = nh;
thunk += nh;
}
diff --git a/sys/src/cmd/7l/obj.c b/sys/src/cmd/7l/obj.c
index fc2ba179a..75def5096 100644
--- a/sys/src/cmd/7l/obj.c
+++ b/sys/src/cmd/7l/obj.c
@@ -1178,11 +1178,8 @@ gethunk(void)
diag("out of memory");
errorexit();
}
- if(nhunk == 0)
- hunk = h;
- else
- nh += (h - hunk) - nhunk;
- nhunk += nh;
+ hunk = h;
+ nhunk = nh;
thunk += nh;
}
diff --git a/sys/src/cmd/8l/obj.c b/sys/src/cmd/8l/obj.c
index 7ea392b7f..efdbd4110 100644
--- a/sys/src/cmd/8l/obj.c
+++ b/sys/src/cmd/8l/obj.c
@@ -1196,11 +1196,8 @@ gethunk(void)
diag("out of memory");
errorexit();
}
- if(nhunk == 0)
- hunk = h;
- else
- nh += (h - hunk) - nhunk;
- nhunk += nh;
+ hunk = h;
+ nhunk = nh;
thunk += nh;
}
diff --git a/sys/src/cmd/cc/macbody b/sys/src/cmd/cc/macbody
index e24d6669a..7d837fb43 100644
--- a/sys/src/cmd/cc/macbody
+++ b/sys/src/cmd/cc/macbody
@@ -862,10 +862,7 @@ gethunk(void)
yyerror("out of memory");
errorexit();
}
- if(nhunk == 0)
- hunk = h;
- else
- nh += (h - hunk) - nhunk;
- nhunk += nh;
+ hunk = h;
+ nhunk = nh;
thunk += nh;
}
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
diff --git a/sys/src/cmd/ql/l.h b/sys/src/cmd/ql/l.h
index ec364d0fd..e7822d01e 100644
--- a/sys/src/cmd/ql/l.h
+++ b/sys/src/cmd/ql/l.h
@@ -234,7 +234,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/ql/obj.c b/sys/src/cmd/ql/obj.c
index c74d240f2..dba56bd46 100644
--- a/sys/src/cmd/ql/obj.c
+++ b/sys/src/cmd/ql/obj.c
@@ -273,7 +273,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));
}
@@ -1117,9 +1117,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);
@@ -1127,12 +1127,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
diff --git a/sys/src/cmd/vl/obj.c b/sys/src/cmd/vl/obj.c
index 6a9acafc3..c20e5c98b 100644
--- a/sys/src/cmd/vl/obj.c
+++ b/sys/src/cmd/vl/obj.c
@@ -1075,11 +1075,8 @@ gethunk(void)
diag("out of memory");
errorexit();
}
- if(nhunk == 0)
- hunk = h;
- else
- nh += (h - hunk) - nhunk;
- nhunk += nh;
+ hunk = h;
+ nhunk = nh;
thunk += nh;
}