You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: jsrc/p.c
+36-22Lines changed: 36 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -887,7 +887,7 @@ RECURSIVERESULTSCHECK
887
887
AFactionfn=__atomic_load_n(&FAV(fs)->valencefns[pmask-1],__ATOMIC_RELAXED); // refetch the routine address early. This may chain 2 fetches, which finishes about when the indirect branch is executed
888
888
Aarg1=stack[1].a; // 1st arg, monad or left dyad
889
889
Aarg2=stack[pmask+1].a; // 2nd arg, fs or right dyad
890
-
Aarg3=__atomic_load_n(&stack[2].a,__ATOMIC_RELAXED); arg3=pmask&2?arg3:(A)jt; // fs, if this is a conjunction, for FAOWED testing. If not conj, set to jt which has FAOWED clear but allows reads. Atomic to avoid branch
890
+
Aarg3=__atomic_load_n(&stack[2].a,__ATOMIC_RELAXED); arg3=pmask&2?arg3:0; // fs, if this is a conjunction, for FAOWED testing. If not conj, set to 0 which has FAOWED clear. Atomic to avoid branch
891
891
UI4restok=stack[1].t; // save token # to use for result
892
892
// We set the MODIFIER flag in the call so that jtxdefn/unquote can know that they are modifiers
893
893
// We mark the inputs inplaceable (the first modifier to support that is u`v) - both always, even for adverbs
@@ -911,12 +911,17 @@ RECURSIVERESULTSCHECK
911
911
// Make sure the result is recursive. We need this to guarantee that any named value that has been incorporated has its usecount increased,
while(1){ // for each stacked value, free the value unless it survives to the result, in which case it inherits the FAOWED. Only one FAOWED can be passed on this way
Asymtab=jt->locsyms; {Agsyms=jt->global; symtab=!EXPLICITRUNNING?gsyms:symtab; symtab=!(stack[1].pt&PTASGNLOCAL)?gsyms:symtab;} // use global table if =: used, or symbol table is the short one, meaning 'no symbols'
935
940
Irc;
936
941
if(likely(GETSTACK0PT&PTNAME0))rc=jtsymbis((J)((I)jt|(((US)pt0ecam==0)<<JTFINALASGNX)),QCWORD(stack[0].a),QCWORD(stack[2].a),symtab); // Assign to the known name. If ASSIGNSYM is set, PTNAME0 must also be set
while(1){ // for each stacked value, free the value unless it survives to the result, in which case it inherits the FAOWED. Only one FAOWED can be passed on this way
while(1){ // for each stacked value, free the value unless it survives to the result, in which case it inherits the FAOWED. Only one FAOWED can be passed on this way
PTFROMTYPE(stack[trident].pt,AT(QCWORD(yy))) stack[trident].t=stack[trident-1].t; stack[trident].a=yy; // take err tok from f of hook, g of trident; save result. Must store new type because this line takes adverb hooks also
1000
1014
stack[trident-1]=stack[0]; stack+=trident-1; // close up stack
@@ -1110,10 +1124,10 @@ abandname:;
1110
1124
// If the value is local, we must ra it.
1111
1125
if(unlikely(!ISGLOBAL(sv)))rapos(QCWORD(sv),sv); // ra() the new value first
1112
1126
#endif
1113
-
sv=nameundco(jtinplace, y, sv); // if name_:, go delete the name, leaving the value to be deleted later. sv has QCFAOWED semantics
1127
+
sv=nameundco(jtinplace, y, sv); // if name_:, go delete the name, leaving the value to be deleted later. returned sv has QCFAOWED semantics
1114
1128
y=QCWORD(sv); sv=(A)ISFAOWED(sv); // undco will set FAOWED if it didn't fa() the value; transfer that to sv
1115
1129
}else{y=QCWORD(sv); if(!LOCALRA)sv=(A)ISGLOBAL(sv);} // not name_:, just use the value. sv=non0 if it needs free
1116
-
}else{y=QCWORD(namerefacv(y, sv)); sv=0;} // Replace other acv with reference. Could fail. Undo the ra from syrd if global
1130
+
}else{y=QCWORD(namerefacv(y, sv)); sv=0;} // Replace other acv with reference. Could fail. Undo the ra from syrd if global, so clear sv to indicate no further fa
1117
1131
}else{
1118
1132
// undefined name. This is very subtle. We will return a reference to [: as required by the rules (User might execute ".'undefname' which should return empty with no error).
1119
1133
// This will be formatted for error, if ever, only when returning the value to console level - but at that point the failing sentence has been lost. That will be OK because ASSERTN
// z may not be boxed; but if it is, w must be also.
114
114
if(AR(w)){
115
115
n=AN(w); d=AN(s)-AR(w);
116
-
if((~somefill|(-n&(d-1)))>=0)mvc(k*p,x,k,jt->fillv); // fill required: w empty or shape short (d>0)
116
+
if((~somefill|(-n&(d-1)))>=0)mvc(k*p,x,k,jt->fillv); // fill required: w empty or shape short (d>0). Fills unnecessarily if axis was extended with 1s and the other arg needed fill
117
117
if(n){ // nonempty cell, must copy in the data
118
118
if(n<p){I*v=AV(s); *v=m; RZ(w=take(d?vec(INT,AR(w),d+v):s,w));} // incoming cell smaller than result area: take to result-cell size (uses fill)
119
119
JMC(x,AV(w),k*AN(w),1); // copy in the data, now the right cell shape but possibly shorter than the fill kludge could avoid double copy
0 commit comments