Skip to content

Commit f9f82ca

Browse files
committed
Fix PM to account for named explicit operators, and unnamed explicit defs; redef 128!:9 for SR DIP; support IRS in 9:; use streaming store for large mvc(); make 0. comp array use intolerant code
1 parent 3f2b4c8 commit f9f82ca

20 files changed

Lines changed: 549 additions & 313 deletions

File tree

jsrc/af.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ DF1(jtfix){PROLOG(0005);A z;
185185
fauxblock(fauxself); A augself; fauxINT(augself,fauxself,2,0); IAV0(augself)[0]=IAV(self)[0]; IAV0(augself)[1]=(I)namelist; // transfer value to writable block; install empty name array
186186
RZ(z=fixa(augself,AT(w)&VERB+ADV+CONJ?w:symbrdlock(w))); // name comes from string a
187187
// Once a node has been fixed, it doesn't need to be looked at ever again. This applies even if the node itself carries a name. To indicate this
188-
// we set VFIX. We only do so if the node has descendants (or a name). We also turn off VNAMED, which is set in named explicit definitions (I don't
189-
// understand why). We can do this only if we are sure the entire tree was traversed, i. e. we were not just looking for implicit locatives or inverses.
190-
if(!(IAV(self)[0]&(FIXALOCSONLY|FIXALOCSONLYLOWEST|FIXASTOPATINV))&&AT(z)&VERB+ADV+CONJ){V*v=FAV(z); if(v->fgh[0]){v->flag|=VFIX+VNAMED; v->flag^=VNAMED;}} // f is clear for anything in the pst
188+
// we set VFIX. We only do so if the node has descendants (or a name). We can do this only if we are sure the entire tree was traversed, i. e. we were not just looking for implicit locatives or inverses.
189+
if(!(IAV(self)[0]&(FIXALOCSONLY|FIXALOCSONLYLOWEST|FIXASTOPATINV))&&AT(z)&VERB+ADV+CONJ){V*v=FAV(z); if(v->fgh[0]){v->flag|=VFIX;}} // f is clear for anything in the pst
191190
EPILOG(z);
192191
}

jsrc/cx.c

Lines changed: 105 additions & 87 deletions
Large diffs are not rendered by default.

jsrc/dstop.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ B jtdbstop(J jt,DC d,I i){A a;B b,c=0,e;C nw[11],*s,*t,*u,*v;I md,n,p,q;
4242
}
4343
// if no single-step stop, try looking the line up in the stops table
4444
if(i==d->dcstop){d->dcstop=-2; R 0;} /* not stopping if already stopped at the same place */
45-
if(!(JT(jt,dbstops)))R 0; s=CAV(str0(JT(jt,dbstops))); sprintf(nw,FMTI,i);
46-
a=d->dca; n=d->dcm; t=NAV(a)->s; md=d->dcx&&d->dcy?2:1;
45+
if(!(JT(jt,dbstops)))R 0; s=CAV(str0(JT(jt,dbstops))); sprintf(nw,FMTI,i); // s->stop strings, nw=character form of line#
46+
a=d->dca; n=d->dcm; t=NAV(a)->s; md=d->dcx&&d->dcy?2:1; // t->name we are looking for, n=its length, md=valence of call
4747
NOUNROLL while(s){
4848
NOUNROLL while(' '==*s)++s; if(b='~'==*s)++s; while(' '==*s)++s;
4949
u=strchr(s,'*'); v=strchr(s,' '); if(!v)break;;

jsrc/dsusp.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ A jtpee(J jt,A *queue,CW*ci,I err,I lk,DC c){A z=0;
211211
if(jt->jerr)z=0; R z; // if we entered debug, the error may have been cleared. If not, clear the result. Return debug result, which is result to use or 0 to indicate jump
212212
}
213213

214-
// parsex: parse an explicit defn line when the debugger is running
214+
// parsex: parse an explicit defn line when the debugger/pm is running
215215
/* w - line to be parsed */
216216
/* lk - 1 iff locked function; _1 to signal noun error at beginning of sentence */
217217
/* ci - current row of control matrix */
@@ -220,17 +220,18 @@ A jtpee(J jt,A *queue,CW*ci,I err,I lk,DC c){A z=0;
220220

221221
A jtparsex(J jt,A* queue,I m,CW*ci,DC c){A z;B s;
222222
movesentencetosi(jt,queue,m,0); // install sentence-to-be-executed for stop purposes
223-
if(s=dbstop(c,ci->source)){z=0; jsignal(EVSTOP);}
224-
else {z=PARSERVALUE(parsea(queue,m)); }
223+
if(s=dbstop(c,ci->source)){z=0; jsignal(EVSTOP);
224+
}else{ // cx adds a stack entry for PARSE, needed to get anonymous operators right
225+
z=PARSERVALUE(parsea(queue,m));
226+
}
225227
// If we hit a stop, or if we hit an error outside of try./catch., enter debug mode. But if debug mode is off now, we must have just
226228
// executed 13!:0]0, and we should continue on outside of debug mode. Error processing filled the current si line with the info from the parse
227229
if(!z&&jt->uflags.us.cx.cx_c.db){DC t=jt->sitop->dclnk; t->dcj=jt->sitop->dcj=jt->jerr; z=debug(); t->dcj=0;} // d is PARSE type; set d->dcj=err#; d->dcn must remain # tokens
228230
R z;
229231
}
230232

231-
A jtdbunquote(J jt,A a,A w,A self,L *stabent){A t,z;B s;DC d;V*sv;
233+
A jtdbunquote(J jt,A a,A w,A self,DC d){A t,z;B s;V*sv;
232234
sv=FAV(self); t=sv->fgh[0];
233-
RZ(d=deba(DCCALL,a,w,self)); d->dcn=(I)stabent;
234235
if(CCOLON==sv->id&&(sv->flag&VXOP||t&&NOUN&AT(t))){ // : and executable body: either OP (adv/conj now with noun operands) or m : n
235236
ras(self); z=a?dfs2(a,w,self):dfs1(w,self); fa(self);
236237
}else{ /* tacit */
@@ -248,7 +249,7 @@ A jtdbunquote(J jt,A a,A w,A self,L *stabent){A t,z;B s;DC d;V*sv;
248249
}
249250
}
250251
if(d->dcss)ssnext(d,d->dcss); // if we step over/into on the last line of a function, we must stop on the next line of the caller
251-
debz();
252+
// obsolete debz();
252253
R z;
253254
} /* function call, debug version */
254255

jsrc/j.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ I __attribute__((aligned(CACHELINESIZE))) validitymask[16]={-1, -1, 0, 0, -1, -1
5757
__attribute__((aligned(CACHELINESIZE))) I Bnum[22][8*(2-SY_64)] = { // the numbers we keep at hand. 0 and 1 are B01, the rest INT; but the first 2 are integer forms of 0 and 1
5858
CBAIVAL(INT,0), CBAIVAL(INT,1),
5959
CBAIVAL(INT,-10), CBAIVAL(INT,-9), CBAIVAL(INT,-8), CBAIVAL(INT,-7), CBAIVAL(INT,-6), CBAIVAL(INT,-5), CBAIVAL(INT,-4), CBAIVAL(INT,-3), CBAIVAL(INT,-2), CBAIVAL(INT,-1),
60-
CBAIVAL(B01,0), CBAIVAL(B01,1),
60+
CBAIVAL(B01,0), CBAIVAL(B01,1), // these values must be padded with 0 so they can be used as an INT
6161
CBAIVAL(INT,2), CBAIVAL(INT,3), CBAIVAL(INT,4), CBAIVAL(INT,5), CBAIVAL(INT,6), CBAIVAL(INT,7), CBAIVAL(INT,8), CBAIVAL(INT,9)
6262
};
6363

jsrc/j.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ extern unsigned int __cdecl _clearfp (void);
759759
#define FDEPINC(d) {ASSERT(jt->fdepn>=jt->fdepi+(I4)(d),EVSTACK); jt->fdepi+=(I4)(d);}
760760
#define STACKVERIFY
761761
#endif
762-
#define FCONS(x) fdef(0,CFCONS,VERB,jtnum1,jtnum2,0L,0L,(x),VFLAGNONE, RMAX,RMAX,RMAX)
762+
#define FCONS(x) fdef(0,CFCONS,VERB,jtnum1,jtnum2,0L,0L,(x),VJTFLGOK1+VIRS1+VASGSAFE, RMAX,RMAX,RMAX)
763763
// fuzzy-equal is used for tolerant comparisons not related to jt->cct; for example testing whether x in x { y is an integer
764764
#define FUZZ 0.000000000000056843418860808015 // tolerance
765765
// FEQ/FIEQ are used in bcvt, where FUZZ may be set to 0 to ensure only exact values are demoted to lower precision

jsrc/je.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ extern DF2(jtbitwisechar);
600600
extern DF2(jtcharfn2);
601601
extern DF2(jtdeadband);
602602
extern DF2(jtunquote);
603-
extern A jtdbunquote(J,A,A,A,L*);
603+
extern A jtdbunquote(J,A,A,A,DC);
604604
extern DF2(jtdfs2);
605605
extern DF2(jteachl);
606606
extern DF2(jteachr);

jsrc/jt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ typedef struct JSTstruct {
219219
C baselocale[4]; // will be "base"
220220
UI4 baselocalehash; // name hash for base locale
221221
A zpath; // path 'z', used for all initial paths
222+
I cachesizes[3]; // [0]: size of fastest cache [1]: size of largest cache private to each core [2]: size of largest cache shared by all cores
222223
// end of cache line 1
223224
A sbu; /* SB data for each unique symbol */
224225
A p4792; // pointer to p: i. 4792, filled in on first use

jsrc/jtype.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,8 @@ typedef struct {
10051005
#define VCEIL (I)0x4000 /* function is >.@g */
10061006
#define VMOD (I)0x8000 /* function is m&|@g */
10071007
#define VLOCK (I)0x10000 /* function is locked */
1008-
#define VNAMED (I)0x20000 /* named explicit defn */
1008+
// bit 17 free
1009+
// obsolete #define VNAMED (I)0x20000 /* named explicit defn */
10091010
#define VFIX (I)0x40000 /* f. applied */
10101011
#define VXOPRX 19
10111012
#define VXOPR ((I)1<<VXOPRX) /* : defn with u. and x. */

jsrc/p.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void auditblock(J jt,A w, I nonrecurok, I virtok) {
283283

284284

285285

286-
// Run parser, creating a new debug frame. Explicit defs, which make other tests first, then go through jtparsea
286+
// Run parser, creating a new debug frame. Explicit defs, which make other tests first, go through jtparsea except during debug/pm
287287
// the result has bit 0 set if final assignment
288288
// JT flags indicate whether call comes from ".
289289
F1(jtparse){F1PREFIP;A z;

0 commit comments

Comments
 (0)