From: Kirk McKusick Date: Sun, 11 Jan 1981 10:25:16 +0000 (-0800) Subject: add "ap" and "fp" notion, fix SUCC and PRED X-Git-Tag: BSD-4_1_snap-Snapshot-Development~2586 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/15834a19a72a1c6109fe38a1ff9ac163d7a6c64a add "ap" and "fp" notion, fix SUCC and PRED SCCS-vsn: usr.bin/pascal/px/interp.c 1.2 SCCS-vsn: usr.bin/pascal/px/Makefile 1.2 SCCS-vsn: usr.bin/pascal/px/utilities.c 1.2 SCCS-vsn: usr.bin/pascal/px/vars.h 1.2 --- diff --git a/usr/src/usr.bin/pascal/px/Makefile b/usr/src/usr.bin/pascal/px/Makefile index cf208f9561..b4b26edf04 100644 --- a/usr/src/usr.bin/pascal/px/Makefile +++ b/usr/src/usr.bin/pascal/px/Makefile @@ -1,6 +1,7 @@ -SCCSID = "@(#)Makefile 1.1 %G%" +SCCSID = "@(#)Makefile 1.2 %G%" -CFLAGS = -O -DVAX -DOBJ +CFLAGS = -O +DEFS = -DVAX -DOBJ DESTDIR =/usr/ucb LIBDIR =/usr/lib PASCALDIR = /usr/src/cmd/pascal @@ -9,36 +10,43 @@ CC = cc AS = as RM = rm -f -PXHDR = ${PASCALDIR}/OPnames.h ${PASCALDIR}/objfmt.h\ - ${LIBPCDIR}/libpc.h ${LIBPCDIR}/h01errs.h\ - newvars.h machdep.h +PSHDR = OPnames.h objfmt.h opc.c pic.c +PCHDR = libpc.h h01errs.h + +PXHDR = vars.h machdep.h PXSRC = int.c interp.c except.c utilities.c PXOBJ = int.o interp.o except.o utilities.o -PXUTL = ${PASCALDIR}/opc.c ${PASCALDIR}/pic.c ${PASCALDIR}/version.c\ - make.ed1 panics interp.sed clean.sed +PXUTL = make.ed1 panics interp.sed clean.sed version.c sources: ${PXHDR} ${PXSRC} ${PXUTL} -${PXHDR} ${PXUTL}: - cp $@ . +${PSHDR}: + cp ${PASCALDIR}/$@ $@ +${PCHDR}: + cp ${LIBPCDIR}/$@ $@ + +.c.o: + ${CC} ${CFLAGS} ${DEFS} -c $*.c px: Version.c ${PXOBJ} - ${CC} -O -o px Version.c ${PXOBJ} /usr/src/lib/libpc/pclib -lm -Version.c: ${PASCALDIR}/version.c - ${CC} -o version ${PASCALDIR}/version.c + ${CC} ${CFLAGS} -o px Version.c ${PXOBJ} /usr/src/lib/libpc/libpc -lm +Version.c: version.c + ${CC} ${CFLAGS} -o version version.c ./version >Version.c ${RM} version interp.o interp.s: interp.c - ${CC} -S interp.c + ${CC} ${DEFS} -S interp.c sed -f interp.sed tmp + /usr/lib/pc2 interp.s + /lib/c2 interp.s tmp mv tmp interp.s as -o interp.o interp.s panics.h: panics make.ed1 ex - h02opcs.h ${RM} opc @@ -54,9 +62,9 @@ prt: interp.s grind: sources @vpr READ_ME makefile - @${CC} -o pic pic.c + @${CC} ${CFLAGS} -o pic pic.c @./pic | vpr - @/usr/ucb/vgrind newvars.h objfmt.h machdep.h + @/usr/ucb/vgrind vars.h objfmt.h machdep.h @/usr/ucb/vgrind ${PXSRC} @${RM} pic* @@ -78,19 +86,16 @@ depend: sources # DO NOT DELETE THIS LINE -- make depend uses it # DEPENDENCIES MUST END AT END OF FILE except.o: panics.h -int.o: newvars.h +except.o: vars.h +int.o: vars.h int.o: objfmt.h -interp.o: newvars.h +interp.o: vars.h interp.o: panics.h interp.o: h02opcs.h interp.o: machdep.h +interp.o: h01errs.h interp.o: libpc.h -opc.o: OPnames.h -panic.o: newvars.h -panic.o: panics.h -pic.o: OPnames.h -stats.o: newvars.h -utilities.o: newvars.h +utilities.o: vars.h utilities.o: panics.h utilities.o: h02opcs.h # DEPENDENCIES MUST END AT END OF FILE diff --git a/usr/src/usr.bin/pascal/px/interp.c b/usr/src/usr.bin/pascal/px/interp.c index d4e50dc109..51f5c942fc 100644 --- a/usr/src/usr.bin/pascal/px/interp.c +++ b/usr/src/usr.bin/pascal/px/interp.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)interp.c 1.1 %G%"; +static char sccsid[] = "@(#)interp.c 1.2 %G%"; #include #include "vars.h" @@ -10,14 +10,10 @@ static char sccsid[] = "@(#)interp.c 1.1 %G%"; #include "h01errs.h" #include "libpc.h" -/* debugging variables */ -char opc[10]; -long opcptr = 9; - /* * program variables */ -struct disp _display[MAXLVL]; +union disply _display; struct disp *_dp; long _lino = 0; int _argc; @@ -87,6 +83,21 @@ struct iorechd _err = { 1 /* fsize */ }; +/* + * Px profile array + */ +#ifdef PROFILE +long _profcnts[NUMOPS]; +#endif PROFILE + +/* + * debugging variables + */ +#ifdef DEBUG +char opc[10]; +long opcptr = 9; +#endif DEBUG + interpreter(base) char *base; { @@ -117,54 +128,59 @@ interpreter(base) /* * set up global environment, then ``call'' the main program */ - _display[0].locvars = pushsp(2 * sizeof(struct iorec *)); - *(struct iorec **)(_display[0].locvars + 4) = OUTPUT; - *(struct iorec **)(_display[0].locvars) = INPUT; - _display[0].locvars += 8; /* >>> kludge <<< */ - asm(" bispsw $0xe0"); /* enable overflow traps */ + _display.frame[0].locvars = pushsp(2 * sizeof(struct iorec *)); + _display.frame[0].locvars += 8; /* local offsets are negative */ + *(struct iorec **)(_display.frame[0].locvars - 4) = OUTPUT; + *(struct iorec **)(_display.frame[0].locvars - 8) = INPUT; + enableovrflo(); stp = (struct stack *)pushsp(sizeof(struct stack)); - _dp = &_display[0]; + _dp = &_display.frame[0]; pc.cp = base; for(;;) { +# ifdef DEBUG if (++opcptr == 10) opcptr = 0; opc[opcptr] = *pc.ucp; +# endif DEBUG +# ifdef PROFILE + _profcnts[*pc.ucp]++; +# endif PROFILE switch (*pc.ucp++) { default: panic(PBADOP); continue; case O_NODUMP: _nodump++; - asm(" bicpsw $0xe0");/* disable overflow checks */ + disableovrflo(); /* and fall through */ case O_BEG: _dp += 1; /* enter local scope */ stp->odisp = *_dp; /* save old display value */ tl = *pc.ucp++; /* tl = name size */ stp->entry = pc.hdrp; /* pointer to entry info */ - tl1 = -*pc.lp++; /* tl1 = local variable size */ + tl1 = *pc.lp++; /* tl1 = local variable size */ pc.lp++; /* skip over number of args */ _lino = *pc.usp++; /* set new lino */ pc.cp += tl; /* skip over name text */ stp->file = curfile; /* save active file */ tcp = pushsp(tl1); /* tcp = new top of stack */ blkclr(tl1, tcp); /* zero stack frame */ + tcp += tl1; /* offsets of locals are neg */ + _dp->locvars = tcp; /* set new display pointer */ + _dp->stp = stp; stp->tos = pushsp(0); /* set top of stack pointer */ - _dp->stp = stp; /* set new display pointer */ - /* _dp->locvars = tcp; */ - _dp->locvars = (char *)stp; /* kludge, use prev line */ continue; case O_END: PCLOSE(_dp->locvars); /* flush & close local files */ stp = _dp->stp; curfile = stp->file; /* restore old active file */ *_dp = stp->odisp; /* restore old display entry */ - if (_dp == &_display[1]) + if (_dp == &_display.frame[1]) return; /* exiting main proc ??? */ _lino = stp->lino; /* restore lino, pc, dp */ pc.cp = stp->pc.cp; _dp = stp->dp; - popsp(-stp->entry->framesze + /* pop local vars */ + popsp(stp->entry->framesze + /* pop local vars */ sizeof(struct stack) + /* pop stack frame */ stp->entry->nargs); /* pop parms */ continue; @@ -177,7 +193,7 @@ interpreter(base) stp->lino = _lino; /* save lino, pc, dp */ stp->pc.cp = pc.cp; stp->dp = _dp; - _dp = &_display[tl]; /* set up new display ptr */ + _dp = &_display.frame[tl]; /* set up new display ptr */ pc.cp = tcp; continue; case O_FCALL: @@ -199,11 +215,11 @@ interpreter(base) tl -= sizeof(int) - 1; ERROR(ENARGS, tl / sizeof(int)); } - _dp = &_display[tfp->cbn];/* set up new display ptr */ + _dp = &_display.frame[tfp->cbn];/* new display ptr */ blkcpy(sizeof(struct disp) * tfp->cbn, - &_display[1], &tfp->disp[tfp->cbn]); + &_display.frame[1], &tfp->disp[tfp->cbn]); blkcpy(sizeof(struct disp) * tfp->cbn, - &tfp->disp[0], &_display[1]); + &tfp->disp[0], &_display.frame[1]); continue; case O_FRTN: tl = *pc.cp++; /* tl = size of return obj */ @@ -214,7 +230,7 @@ interpreter(base) blkcpy(tl, tcp, tcp + sizeof(struct formalrtn *)); popsp(sizeof(struct formalrtn *)); blkcpy(sizeof(struct disp) * tfp->cbn, - &tfp->disp[tfp->cbn], &_display[1]); + &tfp->disp[tfp->cbn], &_display.frame[1]); continue; case O_FSAV: tfp = (struct formalrtn *)popaddr(); @@ -223,7 +239,7 @@ interpreter(base) tcp += sizeof(short); tfp->entryaddr = base + *(long *)tcp; blkcpy(sizeof(struct disp) * tfp->cbn, - &_display[1], &tfp->disp[0]); + &_display.frame[1], &tfp->disp[0]); pushaddr(tfp); continue; case O_SDUP2: @@ -247,11 +263,12 @@ interpreter(base) pc.cp = base + *pc.lp; continue; case O_GOTO: - tstp = _display[*pc.cp++].stp; /* ptr to exit frame */ + tstp = _display.frame[*pc.cp++].stp; /* ptr to + exit frame */ pc.cp = base + *pc.lp; stp = _dp->stp; while (tstp != stp) { - if (_dp == &_display[1]) + if (_dp == &_display.frame[1]) ERROR(EGOTO); /* exiting prog ??? */ PCLOSE(_dp->locvars); /* close local files */ curfile = stp->file; /* restore active file */ @@ -511,7 +528,7 @@ interpreter(base) tl = *pc.usp++; tl1 = pop2(); /* index */ tl2 = *pc.sp++; - SUBSC(tl1, tl2, tl2 + *pc.usp++); /* range check */ + SUBSC(tl1, tl2, *pc.usp++); /* range check */ pushaddr(popaddr() + (tl1 - tl2) * tl); continue; case O_INX4: @@ -520,7 +537,7 @@ interpreter(base) tl = *pc.usp++; tl1 = pop4(); /* index */ tl2 = *pc.sp++; - SUBSC(tl1, tl2, tl2 + *pc.usp++); /* range check */ + SUBSC(tl1, tl2, *pc.usp++); /* range check */ pushaddr(popaddr() + (tl1 - tl2) * tl); continue; case O_OFF: @@ -789,73 +806,73 @@ interpreter(base) push8(pop4() / td); continue; case O_RV1: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; push2(*(tcp + *pc.sp++)); continue; case O_RV14: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; push4(*(tcp + *pc.sp++)); continue; case O_RV2: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; push2(*(short *)(tcp + *pc.sp++)); continue; case O_RV24: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; push4(*(short *)(tcp + *pc.sp++)); continue; case O_RV4: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; push4(*(long *)(tcp + *pc.sp++)); continue; case O_RV8: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; push8(*(double *)(tcp + *pc.sp++)); continue; case O_RV: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; tcp += *pc.sp++; tl = *pc.usp++; tcp1 = pushsp(tl); blkcpy(tl, tcp, tcp1); continue; case O_LV: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; pushaddr(tcp + *pc.sp++); continue; case O_LRV1: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; push2(*(tcp + *pc.lp++)); continue; case O_LRV14: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; push4(*(tcp + *pc.lp++)); continue; case O_LRV2: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; push2(*(short *)(tcp + *pc.lp++)); continue; case O_LRV24: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; push4(*(short *)(tcp + *pc.lp++)); continue; case O_LRV4: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; push4(*(long *)(tcp + *pc.lp++)); continue; case O_LRV8: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; push8(*(double *)(tcp + *pc.lp++)); continue; case O_LRV: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; tcp += *pc.lp++; tl = *pc.usp++; tcp1 = pushsp(tl); blkcpy(tl, tcp, tcp1); continue; case O_LLV: - tcp = _display[*pc.ucp++].locvars; + tcp = _display.raw[*pc.ucp++]; pushaddr(tcp + *pc.lp++); continue; case O_IND1: @@ -1112,7 +1129,7 @@ interpreter(base) continue; case O_ASRT: pc.cp++; - ASRT(pop2()); + ASRT(pop2(), ""); continue; case O_FOR1U: pc.cp++; @@ -1260,6 +1277,10 @@ interpreter(base) PFLUSH(); curfile = ERR; continue; + case O_PUT: + pc.cp++; + PUT(curfile); + continue; case O_GET: pc.cp++; GET(curfile); @@ -1394,64 +1415,46 @@ interpreter(base) push2(pop4() & 1); continue; case O_SUCC2: - /* Pi should be fixed to gen code for: - * tl = *pc.cp++; - * if (tl == 0) - * tl = *pc.sp++; - * tl1 = pop4(); - * push2(SUCC(tl1, tl, *pc.sp++)); - */ - pc.cp++; - push2(pop4() + 1); + tl = *pc.cp++; + if (tl == 0) + tl = *pc.sp++; + tl1 = pop4(); + push2(SUCC(tl1, tl, *pc.sp++)); continue; case O_SUCC24: - /* Pi should be fixed to gen code for: - * tl = *pc.cp++; - * if (tl == 0) - * tl = *pc.sp++; - * tl1 = pop4(); - * push4(SUCC(tl1, tl, *pc.sp++)); - */ + tl = *pc.cp++; + if (tl == 0) + tl = *pc.sp++; + tl1 = pop4(); + push4(SUCC(tl1, tl, *pc.sp++)); + continue; case O_SUCC4: - /* Pi should be fixed to gen code for: - * tl = *pc.cp++; - * if (tl == 0) - * tl = *pc.lp++; - * tl1 = pop4(); - * push4(SUCC(tl1, tl, *pc.lp++)); - */ - pc.cp++; - push4(pop4() + 1); + tl = *pc.cp++; + if (tl == 0) + tl = *pc.lp++; + tl1 = pop4(); + push4(SUCC(tl1, tl, *pc.lp++)); continue; case O_PRED2: - /* Pi should be fixed to gen code for: - * tl = *pc.cp++; - * if (tl == 0) - * tl = *pc.sp++; - * tl1 = pop4(); - * push2(PRED(tl1, tl, *pc.sp++)); - */ - pc.cp++; - push2(pop4() - 1); + tl = *pc.cp++; + if (tl == 0) + tl = *pc.sp++; + tl1 = pop4(); + push2(PRED(tl1, tl, *pc.sp++)); continue; case O_PRED24: - /* Pi should be fixed to gen code for: - * tl = *pc.cp++; - * if (tl == 0) - * tl = *pc.sp++; - * tl1 = pop4(); - * push4(PRED(tl1, tl, *pc.sp++)); - */ + tl = *pc.cp++; + if (tl == 0) + tl = *pc.sp++; + tl1 = pop4(); + push4(PRED(tl1, tl, *pc.sp++)); + continue; case O_PRED4: - /* Pi should be fixed to gen code for: - * tl = *pc.cp++; - * if (tl == 0) - * tl = *pc.lp++; - * tl1 = pop4(); - * push4(PRED(tl1, tl, *pc.lp++)); - */ - pc.cp++; - push4(pop4() - 1); + tl = *pc.cp++; + if (tl == 0) + tl = *pc.lp++; + tl1 = pop4(); + push4(PRED(tl1, tl, *pc.lp++)); continue; case O_SEED: pc.cp++; diff --git a/usr/src/usr.bin/pascal/px/utilities.c b/usr/src/usr.bin/pascal/px/utilities.c index 11966f6094..0a5fe69873 100644 --- a/usr/src/usr.bin/pascal/px/utilities.c +++ b/usr/src/usr.bin/pascal/px/utilities.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)utilities.c 1.1 %G%"; +static char sccsid[] = "@(#)utilities.c 1.2 %G%"; #include "vars.h" #include "panics.h" @@ -13,39 +13,47 @@ stats() long sys_time; long child_usr_time; long child_sys_time; - } tbuf; + } tbuf; register double l; register long count; +# ifdef PROFILE +# define proffile "/vb/grad/mckusick/px/profile/pcnt.out" + struct cntrec { + double counts[NUMOPS]; /* instruction counts */ + long runs; /* number of interpreter runs */ + long startdate; /* date profile started */ + long usrtime; /* total user time consumed */ + long systime; /* total system time consumed */ + double stmts; /* number of pascal stmts executed */ + } profdata; + FILE *datafile; +# endif PROFILE if (_nodump) return(0); times(&tbuf); -#ifdef profile +# ifdef PROFILE datafile = fopen(proffile,"r"); - if (datafile != NULL) { - count = fread(&profdata,sizeof(profdata),1,datafile); - if (count != 1) { - for (count = 0; count < numops; count++) - profdata.counts[count] = 0.0; - profdata.runs = 0; - profdata.startdate = time(0); - profdata.usrtime = 0; - profdata.systime = 0; - profdata.stmts = 0; - } - for (count = 0; count < numops; count++) - profdata.counts[count] += profcnts[count]; - profdata.runs += 1; - profdata.stmts += stcnt; - profdata.usrtime += tbuf.usr_time; - profdata.systime += tbuf.sys_time; - datafile = freopen(proffile,"w",datafile); - if (datafile != NULL) { - fwrite(&profdata,sizeof(profdata),1,datafile); - fclose(datafile); - } - } -#endif + if (datafile == NULL) + goto skipprof; + count = fread(&profdata,1,sizeof(profdata),datafile); + if (count != sizeof(profdata)) + goto skipprof; + for (count = 0; count < NUMOPS; count++) + profdata.counts[count] += _profcnts[count]; + profdata.runs += 1; + profdata.stmts += _stcnt; + profdata.usrtime += tbuf.usr_time; + profdata.systime += tbuf.sys_time; + datafile = freopen(proffile,"w",datafile); + if (datafile == NULL) + goto skipprof; + count = fwrite(&profdata,1,sizeof(profdata),datafile); + if (count != sizeof(profdata)) + goto skipprof; + fclose(datafile); +skipprof: +# endif PROFILE l = tbuf.usr_time; l = l / HZ; fprintf(stderr, @@ -60,14 +68,13 @@ backtrace(errnum) register struct stack *ap; register char *cp; register long i, linum; - struct disp disp[MAXLVL]; + struct disply disp; if (_lino <= 0) { fputs("Program was not executed.\n",stderr); return; } - for (i=0; iodisp; - if (mydp <= &_display[1]){ - for (i=0; idp; diff --git a/usr/src/usr.bin/pascal/px/vars.h b/usr/src/usr.bin/pascal/px/vars.h index 4dbeaf65d0..6310e20066 100644 --- a/usr/src/usr.bin/pascal/px/vars.h +++ b/usr/src/usr.bin/pascal/px/vars.h @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -/* static char sccsid[] = "@(#)vars.h 1.1 %G%"; */ +/* static char sccsid[] = "@(#)vars.h 1.2 %G%"; */ #include @@ -56,11 +56,11 @@ #define PIX 1 /* load and go */ #define PIPE 2 /* bootstrap via a pipe */ #define releq 0 -#define relne 1 -#define rellt 2 -#define relgt 3 -#define relle 4 -#define relge 5 +#define relne 2 +#define rellt 4 +#define relgt 6 +#define relle 8 +#define relge 10 /* * interrupt and allocation routines @@ -108,8 +108,8 @@ union progcntr { * | | * | block mark | * | | - * --------------- <-- display entry points here - * | | + * --------------- <-- display entry "stp" points here + * | | <-- display entry "locvars" points here * | local | * | variables | * | | @@ -122,9 +122,10 @@ union progcntr { * - - - - - - - - * * The information in the block mark is thus at positive offsets from - * the display pointer entries while the local variables are at negative - * offsets. The block mark actually consists of two parts. The first - * part is created at CALL and the second at entry, i.e. BEGIN. Thus: + * the display.stp pointer entries while the local variables are at negative + * offsets from display.locvars. The block mark actually consists of + * two parts. The first part is created at CALL and the second at entry, + * i.e. BEGIN. Thus: * * ------------------------- * | | @@ -136,11 +137,11 @@ union progcntr { * | | * | Saved (dp) | * | | - * | Current section name | - * | and entry line ptr | + * | Pointer to current | + * | routine header info | * | | - * | Saved file name and | - * | file buffer ptr | + * | Saved value of | + * | "curfile" | * | | * | Empty tos value | * | | @@ -170,6 +171,11 @@ struct stack { long lino; /* previous line number */ }; +union disply { + struct disp frame[MAXLVL]; + char *raw[2*MAXLVL]; +}; + /* * formal routine structure */ @@ -182,21 +188,21 @@ struct formalrtn { /* * program variables */ -extern struct disp _display[MAXLVL]; /* runtime display */ -extern struct disp *_dp; /* runtime display */ -extern long _lino; /* current line number */ -extern int _argc; /* number of passed args */ -extern char **_argv; /* values of passed args */ -extern long _nodump; /* 1 => no post mortum dump */ -extern long _mode; /* execl by PX, PIPE, or PIX */ -extern long _stlim; /* statement limit */ -extern long _stcnt; /* statement count */ -extern char *_maxptr; /* maximum valid pointer */ -extern char *_minptr; /* minimum valid pointer */ -extern long *_pcpcount; /* pointer to pxp buffer */ -extern long _cntrs; /* number of counters */ -extern long _rtns; /* number of routine cntrs */ - +extern union disply _display; /* runtime display */ +extern struct disp *_dp; /* ptr to active frame */ +extern long _lino; /* current line number */ +extern int _argc; /* number of passed args */ +extern char **_argv; /* values of passed args */ +extern long _nodump; /* 1 => no post mortum dump */ +extern long _mode; /* execl by PX, PIPE, or PIX */ +extern long _stlim; /* statement limit */ +extern long _stcnt; /* statement count */ +extern char *_maxptr; /* maximum valid pointer */ +extern char *_minptr; /* minimum valid pointer */ +extern long *_pcpcount; /* pointer to pxp buffer */ +extern long _cntrs; /* number of counters */ +extern long _rtns; /* number of routine cntrs */ + /* * The file i/o routines maintain a notion of a "current file". * A pointer to this file structure is kept in "curfile". @@ -232,7 +238,7 @@ struct iorec { char buf[BUFSIZ]; /* I/O buffer */ char window[1]; /* file window element */ }; - + /* * unit flags */ @@ -264,23 +270,11 @@ extern long _filefre; /* last used entry in _actfile */ extern struct iorechd input; extern struct iorechd output; extern struct iorechd _err; - -#ifdef profile + /* - * Px execution profile data + * Px execution profile array */ -#define numops 256 -struct cntrec { - double counts[numops]; /* instruction counts */ - long runs; /* number of interpreter runs */ - long startdate; /* date profile started */ - long usrtime; /* total user time consumed */ - long systime; /* total system time consumed */ - double stmts; /* number of pascal statements executed */ - } profdata; -long profcnts[numops]; -#define proffile "/usr/grad/mckusick/px/profile/pcnt.out" -FILE *datafile; /* input datafiles */ -#else -int profcnts; /* dummy just to keep the linker happy */ -#endif +#ifdef PROFILE +#define NUMOPS 256 +extern long _profcnts[NUMOPS]; +#endif PROFILE