blob: 6956a641861a5d64d85f6ed8b200e49c0140e1ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#include "lib9.h"
#include "isa.h"
#include "interp.h"
static int depth;
void
memchk(void *p, Type *t)
{
Heap *h;
int i, j;
ulong *v, **base;
if(depth > 100)
return;
depth++;
base = p;
for(i = 0; i < t->np; i++) {
for(j = 0; j < 8; j++) {
if(t->map[i] & (1<<(7-j))) {
v = base[(i*8)+j];
if(v != H) {
h = D2H(v);
hmsize(h);
if(h->ref <= 0)
abort();
if(h->t != nil)
memchk(v, h->t);
}
}
}
}
depth--;
}
void
validstk(void)
{
Type *t;
Frame *f;
uchar *fp;
fp = R.FP;
while(fp != nil) {
f = (Frame*)fp;
t = f->t;
if(t == nil)
t = SEXTYPE(f)->reg.TR;
memchk(f, t);
fp = f->fp;
}
}
|