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
// x <;.0 y and x (<;.0~ -~/"2)~ y where _1 { $x is 1 (i. e. 1 dimension of selection) localuse distinguishes the two cases (relative vs absolute length)
143
143
// We go for minimum overhead in the box allocation and copy
144
-
DF2(jtboxcut0){F12IP;Az;
144
+
DF2(jtboxcut0){F12IP;Az;Ii;
145
145
ARGCHK2(a,w);
146
146
// NOTE: this routine is called from jtwords. In that case, self comes from jtwords and is set up with the parm for x (<;.0~ -~/"2)~ y but with no failover routine.
147
147
// Thus, the preliminary tests must not cause a failover. They don't, because the inputs from jtwords are known to be well-formed
Ik=bplg(t); C*wv=CAV(w); // k is length of an atom of w
161
161
// allocate the result area
162
-
GATV(z,BOX,resatoms,f,AS(a)); if(resatoms==0){RETF(z);} // could avoid filling with 0 if we modified AN after error, or cleared after *tnextpushp
162
+
GATV(z,BOX,resatoms,f,AS(a)); if(resatoms==0){RETF(z);} // scaf could avoid filling with 0 if we modified AN after error, or cleared after *tnextpushp
163
163
// We have allocated the result; now we allocate a block for each cell of w and copy
164
164
// the w values to the new block.
165
165
A*pushxsave; // place to restore tstack to
166
166
AFLAGINIT(z,BOX) // Make result inplaceable; recursive too, since otherwise the boxes won't get freed
167
167
// divert the allocation system to use the result area a tstack
168
168
pushxsave=jt->tnextpushp; jt->tnextpushp=AAV(z); // save tstack info before allocation
169
-
// MUST NOT FAIL UNTIL tstack restored
169
+
// MUST NOT FAIL UNTIL tstack restored ****************************************************************************************************
170
170
Ay; // y is the newly-allocated block
171
171
// Step through each block: fetch start/end; verify both positive and inrange; calc size of block; alloc and move; make block recursive
172
172
I (*av)[2]=(I (*)[2])voidAV(a); // pointer to first start/length pair
173
173
Iabslength=(I)FAV(self)->localuse.boxcut0.parm; // 0 for start/length, ~0 for start/end+1
174
174
wr=wr==0?1:wr; // We use this rank to allocate the boxes - we always create arrays
175
-
Awback=ABACK(w); wback=AFLAG(w)&AFVIRTUAL?wback:w; // w is the backer for new blocks unless it is itself sirtual
176
-
Ii; for(i=0;i<resatoms;++i){
175
+
Awback=ABACK(w); wback=AFLAG(w)&AFVIRTUAL?wback:w; // w is the backer for new blocks unless it is itself virtual
176
+
for(i=0;i<resatoms;++i){
177
177
Istart=av[i][0]; Iendorlen=av[i][1];
178
178
if(!(BETWEENO(start,0,wi))){jt->tnextpushp=pushxsave; R (FAV(self)->localuse.boxcut0.func)(jtfg,a,w,self);} // verify start in range - failover if not
179
179
endorlen+=start&abslength; // convert len to end+1 form
@@ -200,7 +200,7 @@ DF2(jtboxcut0){F12IP;A z;
200
200
// raise the backer for all the virtual blocks taken from it. The first one requires ra() to force the backer recursive; after that we can just add to the usecount. And make w noninplaceable, since it now has an alias at large
201
201
if(unlikely((I)jtfg&JTWILLBEOPENED)){Inboxes=jt->tnextpushp-AAV(z); if(likely(nboxes!=0)){ACIPNO(w); ra(wback); ACADD(wback,nboxes-1);}} // get # boxes allocated without error
// OK to fail now - memory is restored ******************************************************************************************************
204
204
ASSERT(y!=0,EVWSFULL); // if we broke out on allocation failure, fail. Since the block is recursive, when it is tpop()d it will recur to delete contents
205
205
// The result can be called pristine if the contents are DIRECT and the result is recursive, because it contains all copied data
#defineACVCACHEREADUNLOCK __atomic_fetch_sub(&JT(jt,fnasgnct),1,__ATOMIC_ACQ_REL); // decrement the read bits
1352
+
#defineACVCACHEWRITELOCK WRITELOCK(*(S*)&JT(jt,fnasgnct)) // take the lock, ignoring data value
1353
+
#defineACVCACHECLEAR __atomic_fetch_add(&JT(jt,fnasgnct),0x10000, __ATOMIC_ACQ_REL); // increment cache count - used when we aren't freeing the only reference to the acv
1354
+
#defineACVCACHEWRITEUNLOCK ACVCACHECLEAR __atomic_fetch_and(&JT(jt,fnasgnct),(UI)~(0xffff&-WLOCKBIT), __ATOMIC_ACQ_REL); // decrement write lock and increment the upper bits
1355
+
#else
1356
+
#defineACVCACHEREAD JT(jt,fnasgnct) // read the current cache counter
Copy file name to clipboardExpand all lines: jsrc/jt.h
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -396,14 +396,14 @@ typedef struct JSTstruct {
396
396
C_cl6[0];
397
397
Adbstops; /* stops set by the user */
398
398
Adbtrap; // trap sentence, execute when going into suspension
399
-
UI4fnasgnct; // number of assignments to ACV, change to locale path, etc. Lookups of ACVs are cached and
400
-
// reused as long as one of these cache-invalidating actions has happened.
399
+
UIfnasgnct; // number of assignments to ACV, change to locale path, etc. Lookups of ACVs are cached and
400
+
// reused as long as one of these cache-invalidating actions has not happened. Low 16 bits are a lock
401
401
Sdblock; // lock on dbstops/dbtrap
402
402
// rest of cacheline is essentially read-only
403
-
// 2 bytes free
403
+
// 6 bytes free
404
404
Aevm; // message text for the EVxxx codes
405
405
I (*emptylocale)[MAXTHREADS][16]; // locale with no symbols, used when not running explicits, or to avoid searching the local syms. Aligned on odd word boundary, must never be freed. One per task, because they are modified
406
-
Ifiller6[3];
406
+
Ifiller6[2];
407
407
// end of cacheline 6
408
408
409
409
// Cacheline 7: startup (scripts and deprecmsgs), essentially read-only
0 commit comments