From 6f7ec059bc763d49c753adea70d5cc337f9e353c Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Wed, 20 Jan 2021 12:23:26 +0700 Subject: [PATCH] Remove dead stores. (#240) --- src/car-cdr.c | 3 +-- src/conspage.c | 5 ++--- src/dbgtool.c | 1 - src/fvar.c | 8 -------- src/gcfinal.c | 3 --- src/gcmain3.c | 7 ++----- src/ldsout.c | 5 ----- src/llstk.c | 9 +++------ src/mvs.c | 5 +---- src/rpc.c | 4 +--- src/rplcons.c | 7 +++---- src/testtool.c | 3 +-- src/xcursor.c | 2 -- 13 files changed, 14 insertions(+), 48 deletions(-) diff --git a/src/car-cdr.c b/src/car-cdr.c index ccb90ed..760cd13 100644 --- a/src/car-cdr.c +++ b/src/car-cdr.c @@ -471,12 +471,11 @@ ConsCell *find_close_prior_cell(struct conspage *page, LispPTR oldcell) { unsigned oldoffset = oldcell & 0xFF; unsigned offset = page->next_cell; unsigned prior = 0; - unsigned noffset, poffset; + unsigned noffset; ConsCell *cell; while (offset) { if ((offset < oldoffset) && (offset >= (oldoffset - 14))) { - poffset = offset; noffset = FREECONS(page, offset)->next_free; while ((noffset > offset) && (noffset < oldoffset)) { prior = offset; diff --git a/src/conspage.c b/src/conspage.c index 25e0f14..de8491c 100644 --- a/src/conspage.c +++ b/src/conspage.c @@ -193,11 +193,11 @@ ex: static ConsCell *find_pair_in_page(struct conspage *pg, LispPTR cdrval) { ConsCell *carcell, *cdrcell; - unsigned int offset, prior, priorprior, ppriorprior, noffset, nprior, poffset; + unsigned int offset, prior, priorprior, noffset, nprior, poffset; if (pg->count < 2) return ((ConsCell *)0); - ppriorprior = priorprior = prior = nprior = 0; + priorprior = prior = nprior = 0; for (offset = pg->next_cell; offset; offset = FREECONS(pg, offset)->next_free) { if (prior) { @@ -243,7 +243,6 @@ static ConsCell *find_pair_in_page(struct conspage *pg, LispPTR cdrval) { return (carcell); } } - ppriorprior = priorprior; priorprior = prior; prior = offset; } diff --git a/src/dbgtool.c b/src/dbgtool.c index 5260a3b..24cefd9 100644 --- a/src/dbgtool.c +++ b/src/dbgtool.c @@ -315,7 +315,6 @@ int sf(struct frameex1 *fx_addr68k) { ptr = Addr68k_from_LADDR(STK_OFFSET + bf->ivar); i = 0; while (ptr != (DLword *)bf) { - ptrhi = ptr; ptrlo = ptr + 1; printf(" %6x : 0x%4x 0x%4x ", LADDR_from_68k(ptr), GETWORD(ptr), GETWORD(ptrlo)); ivarindex = get_ivar_name(fx_addr68k, i++, &localivar); diff --git a/src/fvar.c b/src/fvar.c index 2854ec6..d6110e8 100644 --- a/src/fvar.c +++ b/src/fvar.c @@ -79,7 +79,6 @@ void nnewframe(register struct frameex1 *newpfra2, register DLword *achain, regi register UNSIGNED i; /* temp for control */ register int nametablesize; /* NameTable size of current function header. */ register int ph; /* alink temp, also phase */ - struct frameex1 *onewpfra2, *oonewpfra2, *ooonewpfra2; newframe: #ifdef SUN3_OS3_OR_OS4_IL @@ -123,9 +122,6 @@ newframe: } ph &= 0xFFFE; /* to mask off SLOW bit */ - ooonewpfra2 = oonewpfra2; - oonewpfra2 = onewpfra2; - onewpfra2 = newpfra2; newpfra2 = (struct frameex1 *)(-FRAMESIZE + Stackspace + ph); { /* open new block to try and conserve address register */ @@ -433,7 +429,6 @@ LispPTR native_newframe(int slot) register DLword *achain; /* pointer to 1st word of the searching FVAR slot in CurrentFrameExtension */ register int name; /* Atom# of target FVAR slot. */ - struct frameex2 *onewpfra2, *oonewpfra2, *ooonewpfra2; { /* LOCAL temp regs */ register int rslot = slot; @@ -470,9 +465,6 @@ LispPTR native_newframe(int slot) name, VALS_HI_RET(name)); */ return (*((LispPTR *)achain) = VALS_HI_RET(name)); } - ooonewpfra2 = oonewpfra2; - oonewpfra2 = onewpfra2; - onewpfra2 = newpfra2; newpfra2 = (struct frameex2 *)(-FRAMESIZE + Stackspace + (alink & 0xFFFE)); { /* open new block to try and conserve address register */ diff --git a/src/gcfinal.c b/src/gcfinal.c index 031048f..fb6751f 100644 --- a/src/gcfinal.c +++ b/src/gcfinal.c @@ -516,7 +516,6 @@ LispPTR reclaimstackp(LispPTR ptr) /* This is the entry function */ void printarrayblock(LispPTR base) { struct arrayblock *bbase, *btrailer, *ptrailer; - struct arrayblock *bfwd, *bbwd; LispPTR *addr; LispPTR pbase, nbase; @@ -524,8 +523,6 @@ void printarrayblock(LispPTR base) { bbase = (struct arrayblock *)Addr68k_from_LADDR(base); btrailer = (struct arrayblock *)Addr68k_from_LADDR(Trailer(base, bbase)); ptrailer = (struct arrayblock *)Addr68k_from_LADDR(base - ARRAYBLOCKTRAILERWORDS); - bfwd = (struct arrayblock *)Addr68k_from_LADDR(bbase->fwd); - bbwd = (struct arrayblock *)Addr68k_from_LADDR(bbase->bkwd); nbase = base + 2 * bbase->arlen; pbase = base - 2 * ptrailer->arlen; diff --git a/src/gcmain3.c b/src/gcmain3.c index d40511c..6d05899 100644 --- a/src/gcmain3.c +++ b/src/gcmain3.c @@ -300,25 +300,23 @@ returNIL: \n\ LispPTR gcmapscan(void) { register GCENTRY probe; register GCENTRY *entry; - GCENTRY offset, dbgentry, dbgcontents; + GCENTRY offset, dbgcontents; register LispPTR ptr; probe = HTMAIN_ENTRY_COUNT; nextentry: while ((probe = gcscan1(probe)) != NIL) { entry = (GCENTRY *)HTmain + probe; - dbgentry = GETGC(entry); retry: if (HENTRY->collision) { register GCENTRY *prev; register GCENTRY *link; - LispPTR content, dbgfree; + LispPTR content; prev = (GCENTRY *)0; link = (GCENTRY *)HTcoll + GetLinkptr((content = HTLPTR->contents)); linkloop: offset = ((struct htcoll *)link)->free_ptr; - dbgfree = ((struct htcoll *)link)->next_free; if (StkCntIsZero(offset)) { /* Reclaimable object */ ptr = VAG2(GetSegnuminColl(offset), (probe << 1)); @@ -417,7 +415,6 @@ LispPTR gcscanstack(void) { register struct frameex1 *frameex; register struct fnhead *fnheader; frameex = (struct frameex1 *)basicframe; - scanptr = LADDR_from_68k(frameex); { register LispPTR fn_head; #ifdef BIGVM diff --git a/src/ldsout.c b/src/ldsout.c index 352819a..d91dba7 100644 --- a/src/ldsout.c +++ b/src/ldsout.c @@ -79,13 +79,10 @@ int sysout_loader(const char * sysout_file_name, int sys_size) struct stat stat_buf; /* file stat buf */ int i, vp; - int machinetype; char errmsg[255]; int j = 0; - machinetype = 0; - /* Checks for specifying the process size (phase I) */ /* If sys_size == 0 figure out the proper size later */ if ((sys_size != 0) && (sys_size < DEFAULT_PRIME_SYSOUTSIZE)) { @@ -222,8 +219,6 @@ int sysout_loader(const char * sysout_file_name, int sys_size) exit(1); } - machinetype = ifpage.machinetype; - if ((stat_buf.st_size & (BYTESPER_PAGE - 1)) != 0) printf("CAUTION::not an integral number of pages. sysout & 0x1ff = 0x%x\n", (int)(stat_buf.st_size & (BYTESPER_PAGE - 1))); diff --git a/src/llstk.c b/src/llstk.c index 58ecdab..f2a3598 100644 --- a/src/llstk.c +++ b/src/llstk.c @@ -296,8 +296,6 @@ DLword *freestackblock(DLword n, StackWord *start68k, int align) { register int wantedsize; register StackWord *scanptr68k; - StackWord *ooscan, *oscan; - register StackWord *orig68k; register STKBLK *freeptr68k; register StackWord *easp68k; register DLword freesize; @@ -338,8 +336,9 @@ SCAN: scanptr68k = (StackWord *)Addr68k_from_StkOffset(((FX *)scanptr68k)->nextblock); break; default: - orig68k = scanptr68k; - +#ifdef STACKCHECK + StackWord *orig68k = scanptr68k; +#endif while (STKWORD(scanptr68k)->flags != STK_BF) { S_WARN(STKWORD(scanptr68k)->flags == STK_NOTFLG, "NOTFLG not on", scanptr68k); scanptr68k = (StackWord *)(((DLword *)scanptr68k) + DLWORDSPER_CELL); @@ -382,8 +381,6 @@ FREESCAN: freeptr68k = (STKBLK *)scanptr68k; freesize = FSB_size(freeptr68k); FREE: - ooscan = oscan; - oscan = scanptr68k; scanptr68k = (StackWord *)(((DLword *)freeptr68k) + freesize); if (freesize == 0) error("FREESIZE = 0"); diff --git a/src/mvs.c b/src/mvs.c index 4ce8a80..90592d9 100644 --- a/src/mvs.c +++ b/src/mvs.c @@ -271,10 +271,7 @@ LispPTR make_value_list(int argcount, LispPTR *argarray) { void simulate_unbind(FX2 *frame, int unbind_count, FX2 *returner) { int unbind; - LispPTR *stackptr; - DLword *nextblock; - stackptr = (LispPTR *)(Stackspace + frame->nextblock); - nextblock = (DLword *)stackptr; + LispPTR *stackptr = (LispPTR *)(Stackspace + frame->nextblock); for (unbind = 0; unbind < unbind_count; unbind++) { register int value; register LispPTR *lastpvar; diff --git a/src/rpc.c b/src/rpc.c index 7123647..4b18cc9 100644 --- a/src/rpc.c +++ b/src/rpc.c @@ -65,7 +65,7 @@ LispPTR rpc(LispPTR *args) register int s, msec_until_timeout, msec_between_tries, out_length; register int received; register int port; - int dontblock, dest; + int dest; unsigned fromlen; fd_set read_descriptors; struct timeval pertry_timeout, total_timeout, time_waited; @@ -111,8 +111,6 @@ LispPTR rpc(LispPTR *args) /* Open the socket; Might want to make this non-blocking */ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) goto handle_error; - dontblock = 1; - /* The sockets that rpc controls don't block */ fcntl(s, F_SETFL, fcntl(s, F_GETFL, 0) | O_NONBLOCK); diff --git a/src/rplcons.c b/src/rplcons.c index 2d289a3..b41965c 100644 --- a/src/rplcons.c +++ b/src/rplcons.c @@ -41,18 +41,17 @@ LispPTR N_OP_rplcons(register LispPTR list, register LispPTR item) { #ifndef NEWCDRCODING register struct conspage *conspage; register ConsCell *new_cell; -#endif register ConsCell *list68k; - LispPTR register page; +#endif if (!Listp(list)) ERROR_EXIT(item); +/* There are some rest Cell and "list" must be ONPAGE cdr_coded */ +#ifndef NEWCDRCODING page = POINTER_PAGE(list); list68k = (ConsCell *)Addr68k_from_LADDR(list); -/* There are some rest Cell and "list" must be ONPAGE cdr_coded */ -#ifndef NEWCDRCODING if ((GetCONSCount(page) != 0) && (list68k->cdr_code > CDR_MAXINDIRECT)) { GCLOOKUP(item, ADDREF); GCLOOKUP(cdr(list), DELREF); diff --git a/src/testtool.c b/src/testtool.c index 9efb039..eda98cf 100644 --- a/src/testtool.c +++ b/src/testtool.c @@ -1148,7 +1148,7 @@ void all_stack_dump(DLword start, DLword end, DLword silent) { STKH *stkptr; DLword *start68k, *end68k, *orig68k; - DLword size, dummy; + DLword size; int sdlines = 0; extern IFPAGE *InterfacePage; @@ -1165,7 +1165,6 @@ void all_stack_dump(DLword start, DLword end, DLword silent) stkptr = (STKH *)start68k; while (((DLword *)stkptr) < end68k) { - dummy = LADDR_from_68k(stkptr); switch (STKHPTR(stkptr)->flags1) { case STK_GUARD: case STK_FSB: diff --git a/src/xcursor.c b/src/xcursor.c index eab9763..3ba9b8b 100644 --- a/src/xcursor.c +++ b/src/xcursor.c @@ -197,7 +197,6 @@ void set_Xcursor(DspInterface dsp, const uint8_t *bitmap, int hotspot_x, int hot unsigned char image[32]; int i; Pixmap Cursor_src, Cursor_msk; - Screen *screen; #ifdef BYTESWAP if (from_lisp) @@ -209,7 +208,6 @@ void set_Xcursor(DspInterface dsp, const uint8_t *bitmap, int hotspot_x, int hot #endif /* BYTESWAP */ XLOCK; - screen = ScreenOfDisplay(dsp->display_id, DefaultScreen(dsp->display_id)); Cursor_src = XCreatePixmapFromBitmapData(dsp->display_id, dsp->DisplayWindow, (char *)image, 16, 16, 1, 0, 1); /* Has to have a depth of 1! */ Cursor_msk = XCreatePixmapFromBitmapData(dsp->display_id, dsp->DisplayWindow, (char *)image,