6 static char *
rcsid=
"@(#)$Id$";
10 #define p_marked(p) (bpointerof(p)->h.pmark) 11 #define p_mark_on(p) (bpointerof(p)->h.pmark=1) 12 #define p_mark_off(p) (bpointerof(p)->h.pmark=0) 33 {
return(
makeint(ctx->special_bind_count));}
52 #if defined(RGC) && !defined(__HEAP_EXPANDABLE) 72 if (
n==0)
return(
makeint((ctx->stacklimit+100-ctx->stack)));
74 newsize=ckintval(argv[0]);
110 #if !alpha && system5 115 #elif sun3 || sun4 || news || (i386 && (!Cygwin && !Darwin)) || alpha || mips 118 #if sun4 || vax || i386 119 if ((&ctx->stack[0]<=p) && (p<= &ctx->stack[MAXSTACK]))
return(
NULL);
121 if (issymbol(p))
return((
long int)
NULL);
122 #if (WORD_SIZE == 64) 127 if (marked(bp))
return(0);
137 if (ispointer(p))
xmark(ctx,p);}}
138 else if (bp->
h.
elmtype==ELM_POINTER) {
142 if (ispointer(p))
xmark(ctx,p);}
149 {
register int s,r=0;
151 #if !alpha && system5 157 #if (WORD_SIZE == 64) 174 if (ispointer(p)) r+=
xcollect(ctx,p);}}
175 else if (bp->
h.
elmtype==ELM_POINTER) {
180 if (ispointer(p)) r+=
xcollect(ctx,p);}
194 if (!ispointer(p))
return(0);
217 if (!ispointer(p))
return(0);
252 if (isnum(x) || x==UNBOUND || (!
count_symbol && pissymbol(x))
253 || p_marked(x))
return(0);
257 if (isvector(x)) s=vecsize(x);
else s=objsize(x);
261 for (i=0; i<
s; i++)
objsize1(x->c.obj.iv[i]);
263 case ELM_BIT:
object_size+=1+(s+WORD_SIZE-1)/WORD_SIZE;
break;
264 case ELM_BYTE:
case ELM_CHAR:
267 for (i=0; i<
s; i++)
objsize1(x->c.vec.v[i]);
276 if (isnum(x) || x==UNBOUND || (!
count_symbol && pissymbol(x)) ||
277 !p_marked(x))
return;
280 if (isvector(x)) s=vecsize(x);
else s=objsize(x);
283 for (i=0; i<
s; i++)
objsize2(x->c.obj.iv[i]);
286 for (i=0; i<
s; i++)
objsize2(x->c.vec.v[i]);
319 i=j=ckintval(argv[0]);
321 if (cfp==
NULL)
break;
323 while (--j>i) r=
cons(ctx,vpop(),r);
331 int fcount[MAXBUDDY],tcount[MAXBUDDY];
341 for (i=1; i<MAXBUDDY; i++) {
345 fcount[i]=
s; tcount[i]=0;}
361 sprintf(cbuf,
"buddy size free total total-size wanted wanted-size\n");
364 for(i=1; i<MAXBUDDY; i++) {
365 sprintf(cbuf,
"%4d %7ld %5d %6d %8ld %8ld %10ld\n",
370 sprintf(cbuf,
"\ncontext big_alloc small_alloc\n");
372 for (i=1; i<MAXTHREAD; i++) {
374 sprintf(cbuf,
"%4d %12d %12d\n",
387 for (i=1; i<MAXTHREAD; i++) {
396 {
int counts[MAXCLASS],sizes[MAXCLASS];
397 int holecount=0,holesize=0;
405 for(i=0; i<MAXCLASS; i++) counts[i]=sizes[i]=0;
412 for (chp=chunklist; chp!=0; chp=chp->
nextchunk) {
419 if (i<0 || i>=MAXCLASS)
420 fprintf(stderr,
"bad cid %d at %p, bix=%d\n",i,b,b->
h.
bix);
443 for (i=0; i<MAXCLASS; i++) {
445 if (klass && isclass(klass)) {
446 sprintf(buf,
"%32s%7d cells %7d words %6ldKB\n",
448 counts[i],sizes[i],sizes[i]*
sizeof(
pointer)/1024);
450 sprintf(buf,
"%32s%7d cells %7d words %6ldKB\n",
"holes",holecount,
451 holesize,holesize*
sizeof(
pointer)/1024);
463 strm=Spevalof(QTERMIO);
465 for (i=0; i<MAXBUDDY; i++) {
466 sprintf(buf,
"%3d %10ld * %6d = %10ld\n",
482 r=
cons(ctx,p,vpop());}
498 if (
n==2) sub=(argv[1]!=
NIL);
507 for (chp=chunklist; chp!=0; chp=chp->
nextchunk) {
515 (sub && (objcid>=cid && objcid<=
classtab[cid].subcix))) {
516 vpush(makepointer(b));
517 if (ctx->vsp >= ctx->stacklimit) {
525 while (ctx->vsp > spsave) r=
cons(ctx,vpop(),r);
535 register int s,bsize,size;
544 for (chp=chunklist; chp!=0; chp=chp->
nextchunk) {
551 switch(elmtypeof(p)) {
554 for (s=0; s<size; s++)
555 if (p->c.vec.v[s]==target)
goto found;
559 for (s=0; s<size; s++)
560 if (p->c.obj.iv[s]==target)
goto found;
566 if (ctx->vsp>=ctx->stacklimit) {
575 while (ctx->vsp>spsave) r=
cons(ctx,vpop(),r);
590 return(mkbigint(p));}
613 if (etype==ELM_CHAR || etype==ELM_BYTE) {
614 u= (
union un *)&p->
c.
str.
chars[ckintval(argv[1])];
615 if (
n==3) size=argv[2];
else size=
K_LONG;}
616 else if (etype==ELM_FOREIGN) {
617 u= (
union un *)&((
byte *)(p->
c.
ivec.
iv[0]))[ckintval(argv[1])];
618 if (
n==3) size=argv[2];
else size=
K_LONG;}
621 x=bigintval(argv[0]);
623 if (
n==2) size=argv[1];
else size=
K_LONG;}
624 #if (WORD_SIZE == 64) 625 if (size==
K_LONG)
return mkbigint(u->l);
630 return(mkbigint(y));}
661 if (etype==ELM_CHAR || etype==ELM_BYTE) {
662 u= (
union un *)&p->
c.
str.
chars[ckintval(argv[2])];
663 if (
n==4) size=argv[3];
else size=
K_LONG;}
664 else if (etype==ELM_FOREIGN) {
665 u= (
union un *)&((
byte *)(p->
c.
ivec.
iv[0]))[ckintval(argv[2])];
666 if (
n==4) size=argv[3];
else size=
K_LONG;}
669 x=bigintval(argv[1]);
671 if (
n==3) size=argv[2];
else size=
K_LONG;}
672 #if (WORD_SIZE == 64) 673 if (size==
K_LONG) u->l=bigintval(val);
674 else if (size==
K_INTEGER) u->i=ckintval(val);
678 else if (size==
K_BYTE || size==
K_CHAR) u->b=ckintval(val);
679 else if (size==
K_SHORT) u->s=ckintval(val);
682 else if (size==
K_POINTER) u->p=(
void*)ckintval(val);
707 {
struct bindframe *bfp=ctx->bindfp, *nextbfp;
770 return(p->
c.
vec.
v[x]); }
811 pointer_update(Spevalof(
PACKAGE),p);
context * euscontexts[MAXTHREAD]
pointer PEEK(context *ctx, int n, argv)
pointer POKE(context *ctx, int n, argv)
pointer getoutstream(context *, int, pointer)
pointer NEWSTACK(context *ctx, int n, argv)
pointer LIST_ALL_CHUNKS(context *ctx, int n, pointer *argv)
pointer cons(context *, pointer, pointer)
pointer LISTALLREFERENCES(context *ctx, int n, argv)
void allocate_stack(context *, int)
pointer SBCOUNT(context *ctx, int n, pointer *argv)
pointer LISTALLCLASSES(context *ctx, int n, argv)
int xcollect(context *ctx, pointer p)
defun("ADR_TO_STRING", mod, ADR_TO_STRING)
int xmark(context *ctx, pointer p)
pointer CLEAR_ALLOCCOUNT(context *ctx, int n, pointer *argv)
pointer ROOM(context *ctx, int n, argv)
pointer NEXT_SPECIAL_INDEX(context *ctx, int n, argv)
pointer LISTBINDINGS(context *ctx, int n, pointer *argv)
pointer DISPOSE_HOOK(context *ctx, int n, argv)
int writestr(pointer, byte *, int)
pointer BKTRACE(context *ctx, int n, argv)
pointer RECLTREE(context *ctx, int n, argv)
pointer INSTANCELIST(context *ctx, int n, argv)
pointer FREE_COUNTS(context *ctx, int n, pointer *argv)
int rw_wrlock(rwlock_t *)
long buddysize[MAXBUDDY+1]
struct bindframe * lexblink
struct bindframe * dynblink
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
struct catchframe * nextcatch
struct buddyfree buddy[MAXBUDDY+1]
pointer GCTIME(context *ctx, int n, argv)
pointer LISTSPECIALBINDINGS(context *ctx, int n, pointer *argv)
long alloccount[MAXBUDDY]
int rw_unlock(rwlock_t *)
struct specialbindframe * sblink
pointer GEESEE(context *ctx, int n, argv)
pointer MEMORY_REPORT(context *ctx, int n, pointer *argv)
pointer OBJSIZE(context *ctx, int n, argv)
pointer RECLAIM(context *ctx, int n, argv)
pointer objsize1(pointer x)
pointer THREAD_SPECIALS(context *ctx, int n, argv)
pointer EXPORTALL(context *ctx, int n, argv)
static char buf[CHAR_SIZE]
struct class_desc classtab[MAXCLASS]
pointer ALLOC(context *ctx, int n, argv)
void sysfunc(context *ctx, pointer mod)
pointer ADDRESS(context *ctx, int n, argv)
pointer LISTALLCATCHERS(context *ctx, int n, pointer *argv)