diff options
| author | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
| commit | 37da2899f40661e3e9631e497da8dc59b971cbd0 (patch) | |
| tree | cbc6d4680e347d906f5fa7fca73214418741df72 /libinterp/validstk.c | |
| parent | 54bc8ff236ac10b3eaa928fd6bcfc0cdb2ba46ae (diff) | |
20060303a
Diffstat (limited to 'libinterp/validstk.c')
| -rw-r--r-- | libinterp/validstk.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/libinterp/validstk.c b/libinterp/validstk.c new file mode 100644 index 00000000..6956a641 --- /dev/null +++ b/libinterp/validstk.c @@ -0,0 +1,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; + } +} |
