Skip to content

Commit

Permalink
purge obsolete code
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryHRich committed Jan 5, 2025
1 parent 4903c38 commit b33fc15
Show file tree
Hide file tree
Showing 28 changed files with 6 additions and 161 deletions.
6 changes: 2 additions & 4 deletions jsrc/af.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ B jthasimploc(J jt,A w){A hs,*u;V*v;
if(AT(thisname)&NOUN)R 0; // if noun~, leave as is
NM* thisnameinfo=NAV(thisname); // the NM block for the current name
if(!(thisnameinfo->flag&NMIMPLOC))R 0; // not u./v.
// obsolete if(!(jtprobe((J)((I)jt+NAV(thisname)->m),NAV(thisname)->s,NAV(thisname)->hash,jt->locsyms)))R 0; // assigned value does not exist
if(!probex(NAV(thisname)->m,NAV(thisname)->s,SYMORIGIN,NAV(thisname)->hash,jt->locsyms))R 0; // assigned value does not exist
if(!probex(NAV(thisname)->m,NAV(thisname)->s,SYMORIGIN,NAV(thisname)->hash,jt->locsyms))R 0; // assigned value does not exist
R 1;
case CATDOT:
case CGRCO:
Expand Down Expand Up @@ -135,8 +134,7 @@ static A jtfixa(J jt,A a,A w){A f,g,h,wf,x,y,z=w;V*v;fauxblock(fauxself); A aa;
if(thisname){ // name given
NM* thisnameinfo=NAV(thisname); // the NM block for the current name
if(thisnameinfo->flag&NMIMPLOC){ // implicit locative
// obsolete if((jtprobe((J)((I)jt+NAV(thisname)->m),NAV(thisname)->s,NAV(thisname)->hash,jt->locsyms))){ // name is defined
if(probex(NAV(thisname)->m,NAV(thisname)->s,SYMORIGIN,NAV(thisname)->hash,jt->locsyms)){ // name is defined
if(probex(NAV(thisname)->m,NAV(thisname)->s,SYMORIGIN,NAV(thisname)->hash,jt->locsyms)){ // name is defined
// If our ONLY mission is to replace implicit locatives, we are finished after replacing this locative IF
// (1) we want to replace only first-level locatives; (2) there are no more locatives in this branch after the replacement
if(aif&FIXALOCSONLYLOWEST)R x; // return looked-up value once we hit one
Expand Down
1 change: 0 additions & 1 deletion jsrc/am.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ F1(jtcasev){A b,*u,*v,w1,x,y,z;B*bv,p,q;I*aa,c,*iv,j,m,n,r,*s,t;
// fast (no-error) case; and of course if the use-count is only 2 (incremented by the call to symbrd from 1). But if the assignment is local, we also have to make
// sure abc is locally defined
if(p=q&&0<=c&&AC(u[c])<=ACUC2&&!(AFLAG(u[c])&AFRO)) { // passes quick check: 2-name fast case, reassigned name, modifiable usecount, not read-only
// obsolete p= (!EXPLICITRUNNING) || CAV(QCWORD(AAV(v[m+2])[1]))[0]!=CASGN || jtprobe((J)((I)jt+NAV(QCWORD(AAV(v[m+2])[0]))->m),NAV(QCWORD(AAV(v[m+2])[0]))->s,NAV(QCWORD(AAV(v[m+2])[0]))->hash, jt->locsyms); // OK if not in explicit, or not local assignment, or name defined
p= (!EXPLICITRUNNING) || CAV(QCWORD(AAV(v[m+2])[1]))[0]!=CASGN || probex(NAV(QCWORD(AAV(v[m+2])[0]))->m,NAV(QCWORD(AAV(v[m+2])[0]))->s,SYMORIGIN,NAV(QCWORD(AAV(v[m+2])[0]))->hash, jt->locsyms); // OK if not in explicit, or not local assignment, or name defined
// Get the pointer to the parsed sentence; go to its data; take pointer for word[1]; go to its (character) data; take first character
// then look up the symbol entry for word[0]
Expand Down
1 change: 0 additions & 1 deletion jsrc/ar.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ static A jtredsp1(J jt,A w,A self,C id,VARPSF ado,I cv,I f,I r,I zt){A e,x,z;I m

DF1(jtredravel){A f,x,z;I n;P*wp;
F1PREFIP;PROLOG(0000);
// obsolete if(likely(!ISSPARSE(AT(w)))){RZ(z=reduce(jtravel(jtinplace,w),f));
if(likely(!ISSPARSE(AT(w)))){RZ(z=on1cell(jtinplace,w,self)); // reversion is the normal path
}else{
ARGCHK1(w);
Expand Down
1 change: 0 additions & 1 deletion jsrc/ca.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ static DF2(jtmodpow2){A h;B b,c;I m,n,x,z;
if(unlikely(((AT(a)|AT(w))&(NOUN&~(INT+XNUM)))!=0)){ // convert any non-INT arg to INT if it can be done exactly
if(RAT&AT(a))RZ(a=pcvt(XNUM,a)) else if(!(AT(a)&INT+XNUM))RZ(a=pcvt(INT,a));
if(RAT&AT(w))RZ(w=pcvt(XNUM,w)) else if(!(AT(w)&INT+XNUM))RZ(w=pcvt(INT,w));
// obsolete if(((AT(a)|AT(w))&(NOUN&~(INT+XNUM)))!=0)R residue(h,expn2(a,w)); // if not (both args INT and power positive) revert to long form
if(((AT(a)|AT(w))&(NOUN&~(INT+XNUM)))!=0)R jtupon2(jt,a,w,self); // if not (both args INT and power positive) revert to long form
}
// both args are integral, but possibly extended
Expand Down
3 changes: 0 additions & 3 deletions jsrc/cf.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,10 @@ static DF1(jthkiota){A a,e;I n;P*p;
SETIC(w,n);
if(unlikely((AT(w)&SPARSE+B01)==SPARSE+B01)&&1==AR(w)){ // sparse boolean list
p=PAV(w); a=SPA(p,a); e=SPA(p,e);
// obsolete R BAV(e)[0]||equ(mtv,a) ? repeat(w,IX(n))
if(BAV(e)[0]||equ(mtv,a))goto revert; // revert if no sparse axes or fill ele is not 0
R repeat(SPA(p,x),ravel(SPA(p,i))); // select from the indexes (of nonzeros)
}
if(B01&AT(w)&&1>=AR(w))R ifb(n,BAV(w)); // use special code for boolean atom/list
// obsolete : repeat(w,IX(n));
revert: ;
R jthook1cell(jt,w,self);
} /* special code for (# i.@#) y */
Expand All @@ -234,7 +232,6 @@ static DF1(jthkodom){I n,*v;
}
revert: ;
R jthook1cell(jt,w,self);
// obsolete R CALL2(FAV(fs)->valencefns[1],w,CALL1(FAV(gs)->valencefns[0],w,gs),fs);
} /* special code for (#: i.@(* /)) */

static DF1(jthkindexofmaxmin){
Expand Down
1 change: 0 additions & 1 deletion jsrc/cx.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ nextlinedebug:;
// Check for assert. Since this is only for T-blocks we tolerate the test (rather than duplicating code)
if(unlikely(TEQ5(tcesx,CASSERT))){
if(JT(jt,assert)){
// obsolete parseline(t,{if(likely((tcesx&((UI8)TCESXCECANT<<32))!=0))tpop(old);else z=gc(z,old);},); if(t&&!(NOUN&AT(t)&&all1(eq(num(1),t))))t=pee(cwsent,CWTCESX2(cwsent,ic),EVASSERT,NPGpysfmtdl<<(BW-2),jt->sitop->dclnk); // if assert., signal post-execution error if result not all 1s.
parseline(t,{if((UI)jt->tnextpushp-(UI)old>TPOPSLACK*SZI)if(likely((tcesx&((UI8)TCESXCECANT<<32))!=0))tpop(old);else z=gc(z,old);},);
if(t&&!(NOUN&AT(t)&&all1(eq(num(1),t))))t=pee(cwsent,CWTCESX2(cwsent,ic),EVASSERT,NPGpysfmtdl<<(BW-2)); // if assert., signal post-execution error if result not all 1s.
if(likely(t!=0)){ // assert without error
Expand Down
2 changes: 0 additions & 2 deletions jsrc/d.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ A jteformat(J jt,A self,A a,A w,A m){
// we have to reset the state of the error system after saving what we will need
I pareninfo = (jt->emsgstate&EMSGSTATEPAREN)>>EMSGSTATEPARENX; // unbalanced-paren info from infererrtok
RESETERR; jt->emsgstate|=EMSGSTATEFORMATTED; // clear error system; indicate that we are starting to format, so that the error line will not be modified during eformat
// obsolete A nam=nfs(10,"eformat_j_"); A val; if((val=syrd(nam,jt->locsyms))==0)goto noeformat; if((val=QCWORD(namerefacv(nam,val)))==0)goto noeformat;
// obsolete if(!(val&&LOWESTBIT(AT(val))&VERB))goto noeformat; // there is always a ref, but it may be to [:. Undo ra() in syrd
A nam=nfs(10,"eformat_j_"); A val; if((val=syrd(nam,jt->locsyms))==0)goto noeformat;
if((val=QCWORD(namerefacv(nam,QCWORD(val))))==0)goto noeformat; if(!(val&&LOWESTBIT(AT(val))&VERB))goto noeformat; // there is always a ref, but it may be to [:. namerefscv will undo ra() in syrd
// we also have to reset processing state: ranks. It seems too hard to force eformat to infer the ranks from the args
Expand Down
1 change: 0 additions & 1 deletion jsrc/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ void breakclose(JS jt);
// result is NUL-terminated string which is on the tstack
// We echo the string before returning
static C* nfeinput(JS jt,C* s){A y;
// obsolete WITHATTNDISABLED(y=jtstr0(MDTHREAD(jt),jtexec1(MDTHREAD(jt),jtcstr(MDTHREAD(jt),s),ds(CEXEC)));) // exec the sentence with break interrupts disabled to get the string; NUL-terminate
WITHATTNDISABLED(y=jtstr0(MDTHREAD(jt),PARSERVALUE(jtparse((JTT*)((I)MDTHREAD(jt)|JTFROMEXEC),jtddtokens(MDTHREAD(jt),jtcstr(MDTHREAD(jt),s),4+1+0))));); // replace DDs, but require that they be complete within the string (no jgets); 0 is !!EXPLICITRUNNING; execute, NUL-terminate

if(!y){breakclose(jt);exit(2);} /* J input verb failed */
Expand Down
1 change: 0 additions & 1 deletion jsrc/j.h
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,6 @@ struct jtimespec jmtfclk(void); //'fast clock'; maybe less inaccurate; intended
#define BLOOMSET(b,c) ((b)[(c)>>LGBB]|=(1<<((c)&BB-1))) // set Bloom bit c in b. Requires write lock on the locale
#define BLOOMCLEAR(l) mvc(BLOOMLEN(l),BLOOMBASE(l),MEMSET00LEN,MEMSET00) // reset Bloom filter to 0s
#define BLOOMFILL(l) {((LX*)BLOOMBASE(l))[0]=-1; if(unlikely((UI)AN(l)>sizeof(LX)*BB))memset(BLOOMBASE(l),0xff,BLOOMLEN(l));} // reset Bloom filter to 1s (for local table) - usually with 1 store (if <=32 chains)
// obsolete #define BLOOMMASK(hash) ((0x1LL<<((hash)&(BW-1)))) // Bloom filter for a given hash
#define BMK(x) (1LL<<(x)) // bit number x
// test for equality of 2 8-bit values simultaneously
#define BOTHASUS(x,y) (((US)(C)(x)<<8)+(US)(C)(y))
Expand Down
1 change: 0 additions & 1 deletion jsrc/je.h
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,6 @@ extern B jtpreparse(J,A,A*,A*);
extern B jtprimitive(J,A);
extern A probe(I,C*,L *,UI8);
extern B jtprobedel(J,C*,UI4,A);
// obsolete extern L* jtprobeis(J, A, A);
extern L* jtprobeisres(J, A, A);
extern L* jtprobeislocal(J,A,A);
extern A jtprobequiet(J, A);
Expand Down
11 changes: 0 additions & 11 deletions jsrc/jtype.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ struct AD {
union {
I m; // Multi-use field. (1) For NJA/SMM blocks, size of allocation. (2) in syncos, a credential to allow pthread calls
// (3) for SYMB tables for explicit definitions (i. e. local SYMB tables), the address of the calling symbol table;
// obsolete for other SYMB tables, a Bloom filter of the hashes assigned in the locale (using the low bits of the hash)
// (4) for the block holding the amend offsets in x u} y, the number of axes of y that are built into the indexes in u
// (5) in the return from wordil, holds the number of words if any final NB. is discarded; (6) in the result of indexofsub when called for FORKEY, contains the
// number of partitions found; (7) in the self block for y L: n and u S: n, the address of the fs block for u; (8) in the call to jtisf (multiple assignment), holds the
Expand Down Expand Up @@ -658,7 +657,6 @@ struct AD {
#define ACSETPERM(x) {AC(x)=ACPERMANENT+100000; __atomic_fetch_or(&AFLAG(x),(AT(x)&RECURSIBLE),__ATOMIC_ACQ_REL);} // Make a block permanent from now on. In case other threads have committed to changing the usecount, make it permanent with a margin of safety
#define SGNIFPRISTINABLE(c) ((c)+ACPERMANENT) // sign is set if this block is OK in a PRISTINE boxed noun
// s is an expression that is neg if it's OK to inplace
// obsolete #define ASGNINPLACENEG(s,w) ((s)&(AC(w)|SGNIF(jt->zombieval==w,0))) // neg if OK to inplace ordinary operation, either because the block is inplaceable or because it's an assignment to zombie
#if SY_64
// Note: the following will fail if bit 63 of address may differ between jt->zombieval and w. That will not be in my lifetime. When it happens, perhaps clang will have fixed the version above not to create a branch
#define ASGNINPLACENEG(s,w) ((s)&(AC(w)|(((I)jt->zombieval^(I)w)-1))) // neg if OK to inplace ordinary operation, either because the block is inplaceable or because it's an assignment to zombie
Expand Down Expand Up @@ -897,11 +895,6 @@ typedef DST* DC;
#define VALTYPENAMELESS ((SYMBX-LASTNOUNX)+1) // 6 set in nameless non-locative ACV, to suppress reference creation.
#define VALTYPESPARSE ((CONWX-LASTNOUNX)+1) // 7 set in sparse noun, which is the only type of a stored value that requires traverse. Has bit 0 set, as befits a noun
#define NAMELESSQCTOTYPEDQC(q) q=(A)(((I)q&~0xf)+ATYPETOVALTYPEACV(AT(QCWORD(q)))); // q is name of NAMELESS QC; result has QC type for AT(q) with unchanged semantics
// obsolete // scaf remove the following
// obsolete #define QCGLOBALX 5
// obsolete #define QCGLOBAL ((I)1<<QCGLOBALX) // set if the name was found in a global table
// obsolete #define ISGLOBAL(w) ((I)w&QCGLOBAL) // true if global, if w has QCGLOBAL semantics
// obsolete #define CLRGLOBAL(w) (A)((I)(w)&~QCGLOBAL)
// In the LSBs returned by syrd1() bit 4 has QCNAMEDLOC semantics (bit 5 is garbage):
#define QCNAMEDLOCX 4 // set if the value was found in a named locale, clear if numbered
#define QCNAMEDLOC ((I)1<<QCNAMEDLOCX) // set if the value was found in a named locale, clear if numbered
Expand Down Expand Up @@ -954,7 +947,6 @@ typedef struct {
LX next; // LX of next value in chain. 0 for end-of-chain. SYMNONPERM is set in chain field if the next-in-chain exists and is not LPERMANENT. Not used in LINFO
S sn; // script index the name was defined in. Not used for LINFO
C flag; // Lxx flags, see below. Not used for LINFO (AR is used for locale flags)
// obsolete C valtype; // if a value is set, this holds the QCxxx type for the word 0 if no value. QCSYMVAL semantics
} L; // name must come first because of the way we use validitymask[11]

// FOR EXECUTING LOCAL SYMBOL TABLES: AK() points to the active global symbol table, AM() points to the calling local symbol table.
Expand Down Expand Up @@ -982,8 +974,6 @@ typedef struct {
#define LOCNUM(g) (I)LOCNUMW(g)
#define LOCPATH(g) (g)->kchain.locpath // the path, allocated with rank 1 (so the path is in one cacheline). If 0, the locale has been deleted. The path runs from LOCPATH backwards
// to end with the ending 0 at AAV1()[0]
// obsolete #define LOCBLOOM(x) AM(x)
// obsolete #define BLOOMOR(x,v) {LOCBLOOM(x)|=(v);} // or a new value into the Bloom filter. MUST be done under lock


// Macros to incr/decr execct of a locale
Expand Down Expand Up @@ -1374,7 +1364,6 @@ typedef struct __attribute__((aligned(CACHELINESIZE))) {I memhdr[AKXR(0)/SZI]; u
#define MEMSET00LEN (4*SZI) // length of MEMSET00
#define MEMSETFF ((C*)(validitymask+8)) // 2 words of FF, for memset (only 2 in 32-bit systems)
#define MEMSETFFLEN (2*SZI) // length of MEMSETFF
// obsolete #define MEMSETFF ((C*)(iotavec-IOTAVECBEGIN+0xff)) // 1 byte of 0xff, for memset
#define MEMSET01 ((C*)(iotavec-IOTAVECBEGIN+1)) // 1 byte of 0x01, for memset


Expand Down
2 changes: 0 additions & 2 deletions jsrc/m.c
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,6 @@ if(np&&AC(np)<0)SEGFAULT; // contents are never inplaceable
// If it is a nameref, clear the bucket info. Explanation in nameref()
if(unlikely(v->id==CTILDE))if(v->fgh[0]&&AT(v->fgh[0])&NAME)NAV(v->fgh[0])->bucket=0;
// Recur on each component
// obsolete raonlys(v->fgh[0]); raonlys(v->fgh[1]); raonlys(v->fgh[2]);
DO(3, if(v->fgh[i])ra(v->fgh[i]);) // ra f, g, h
} else if(t&(RAT|XNUM|XD)) {A* RESTRICT v=AAV(wd);
// single-level indirect forms. handle each block
Expand Down Expand Up @@ -1023,7 +1022,6 @@ runout:; //
}
} else if(t&(VERB|ADV|CONJ)){V* RESTRICT v=FAV(wd);
// ACV.
// obsolete fana(v->fgh[0]); fana(v->fgh[1]); fana(v->fgh[2]);
DO(3, fana(v->fgh[i]);) // free f, g, h
} else if(t&NAME){A ref; // NAMEs are usually in verb defns and don't get freed
if((ref=QCWORD(NAV(wd)->cachedref))!=0 && !(ACISPERM(ref))){I rc; // reference, and not permanent, which means not to a nameless adv. must be to a ~ reference
Expand Down
Loading

0 comments on commit b33fc15

Please sign in to comment.