Skip to content

Commit f9ed047

Browse files
committed
32-bit (compare |)
1 parent c090018 commit f9ed047

5 files changed

Lines changed: 41 additions & 8 deletions

File tree

jsrc/au.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ A jtfdef(J jt,I flag2,C id,I t,AF f1,AF f2,A fs,A gs,A hs,I flag,I m,I l,I r){A
5656
GAT0(z,INT,(VERBSIZE+SZI-1)>>LGSZI,0); v=FAV(z); // allocate as fixed size, and as INT to avoid clearing the area, which will be all filled in
5757
AN(z)=0xdeadbeef; // AN field of function is used for actual rank
5858
if(fs)INCORPRA(fs); if(gs)INCORPRA(gs); if(hs)INCORPRA(hs); // indicate fgh are about to be incorporated, and raise
59-
v->localuse.clr[0]=v->localuse.clr[1]=v->localuse.clr[2]=v->localuse.clr[3]=0; // clear the private field
59+
memset(&v->localuse,0,sizeof(v->localuse));
60+
// obsolete v->localuse.clr[0]=v->localuse.clr[1]=v->localuse.clr[2]=v->localuse.clr[3]=0; // clear the private field
6061
v->valencefns[0] =f1?f1:jtdomainerr1; /* monad C function */
6162
v->valencefns[1] =f2?f2:jtdomainerr2; /* dyad C function */
6263
v->fgh[0] =fs; /* monad */

jsrc/jtype.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -982,17 +982,17 @@ typedef struct {
982982
// the localuse fields are not freed or counted for space, as the f/g/h fields are. They are for local optimizations only.
983983
union {
984984
// start with the larger localuse, which requires a second cacheline. This is 16 bytes, the first 8 of which are in the excess (first) cacheline
985-
I4 clr[4]; // used to init to 0 - extends the union for 32-bit
985+
// obsolete I4 clr[4]; // used to init to 0 - extends the union for 32-bit
986986
struct {AF func; I parm;} boxcut0; // for x <;.0 y and x (<;.0~ -~/"2)~ y, .parm is ~0 for first, 0 for second, and .func points to failover routine (seldom used). func in first cacheline
987-
I4 srank[4]; // for RANK conj, the signed ranks - extends the union in 32-bit
987+
US srank[4]; // for RANK conj, the signed ranks
988988
// the rest do not require both cachelines in 64-bit
989989
struct {
990990
union {
991991
I filler; // pad to cacheline
992992
A cachedloc; // for namerefs ('name'~), the locale address if the name is a direct named lookup (after the first reference)
993993
} lu0;
994994
// end of first cacheline, which is not used much during execution
995-
union { // 8 bytes in the second (main) cacheline
995+
union { // 8 bytes in the second (main) cacheline. Aligned to 8-byte bdy even on 32-bit system
996996
D cct; // for comparison tolerance, FIT conj =!.n OR comparison combination (i.&1@:(e.[!.n])) OR [e. i. ([-.-.)]&n OR m&i[.:] the CCT, 0 for default (never in an actual prehash). For 32-bit, this extends the union, but that's OK since it doesn't add a cacheline.
997997
struct {
998998
I4 cgerx; // For cyclic iterators, the index of the next gerund to execute. Here to avoid conflict with cut
@@ -1025,8 +1025,19 @@ typedef struct {
10251025
typedef struct {
10261026
// the localuse fields are not freed or counted for space, as the f/g/h fields are. They are for local optimizations only.
10271027
union { // 8 bytes in the second (main) cacheline
1028-
US uavandx[2]; // offset from start of va/va1tbl to VA/UA block for adocv [monad then dyad]
1029-
I forcetask; // for t., the flags extracted from n. Bits 0-7=thread pool; bit 8=worker thread only
1028+
D cct; // for comparison tolerance, FIT conj =!.n OR comparison combination (i.&1@:(e.[!.n])) OR [e. i. ([-.-.)]&n OR m&i[.:] the CCT, 0 for default (never in an actual prehash). For 32-bit, this extends the union, but that's OK since it doesn't add a cacheline.
1029+
struct {
1030+
I4 cgerx; // For cyclic iterators, the index of the next gerund to execute. Here to avoid conflict with cut
1031+
I4 cutn; // for u;.n where n is nonzero, n. u/. also goes through this code. There could be cyclic iterators but not boxcut
1032+
} gercut;
1033+
VARPSA *redfn; // for reductions (u/ u/\ u/\.) address of rps block (may be dummy block)
1034+
US uavandx[2]; // offset from start of va/va1tbl to VA/UA block for adocv [monad then dyad]
1035+
AF foldfn; // for Fold final operator, pointer to the dyadic EP of the handler (xdefn or unquote)
1036+
A wvb; // for u&.[:]v, the verb whose inverse is needed
1037+
I linkvb; // for dyads ; (,<) ,&[:]< indicates which function; for (compare[!.n] |), indicates which compare function
1038+
A cachedref; // for namerefs ('name'~), the cached value, or 0 if not cached
1039+
AF fork2hfn; // for dyad fork that is NOT a comparison combination or jtintersect, the function to call to process h (might be in h@][)
1040+
I forcetask; // for t., the flags extracted from n. Bits 0-7=thread pool; bit 8=worker thread only
10301041
} lu1; // this is the high-use stuff in the second cacheline
10311042
AF valencefns[2]; // function to call for monad,dayd
10321043
A fgh[3]; // operands of modifiers. h is used for forks and also as a storage spot for parms. all 3 are freed when the V block is freed

jsrc/va.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,21 @@ I name(I n,I m,void* RESTRICTI x,void* RESTRICTI y,void* RESTRICTI z,J jt){ \
412412
} \
413413
R EVOK; \
414414
}
415+
// support intolerant comparisons explicitly, with absolute value of y
416+
#define ACMP0ABS(f,Tz,Tx,Ty,pfx,pfx0) \
417+
AHDR2(f,B,Tx,Ty){D u,v; \
418+
if(jt->cct!=1.0){ \
419+
if(n-1==0) DQ(m, u=(D)*x++; v=(D)*y++; v=ABS(v); *z=pfx(u,v); z++; ) \
420+
else if(n-1<0)DQ(m, u=(D)*x++; DQC(n, v=(D)*y++; v=ABS(v); *z=pfx(u,v); z++;)) \
421+
else DQ(m, v=(D)*y++; v=ABS(v); DQ(n, u=(D)*x++; *z=pfx(u,v); z++;)); \
422+
}else{ \
423+
if(n-1==0) DQ(m, u=(D)*x++; v=(D)*y++; v=ABS(v); *z=u pfx0 v; z++; ) \
424+
else if(n-1<0)DQ(m, u=(D)*x++; DQC(n, v=(D)*y++; v=ABS(v); *z=u pfx0 v; z++;)) \
425+
else DQ(m, v=(D)*y++; v=ABS(v); DQ(n, u=(D)*x++; *z=u pfx0 v; z++;)); \
426+
} \
427+
R EVOK; \
428+
}
429+
415430

416431

417432
// n and m are never 0.

jsrc/vcomp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@ ACMP0(leDD, B,D,D, TLE, <= )
337337
ACMP0(ltDD, B,D,D, TLT, < )
338338
ACMP0(neDD, B,D,D, TNE, != )
339339
ACMP0(eqDD, B,D,D, TEQ, == )
340+
ACMP0ABS(geabsDD, B,D,D, TGE, >= )
341+
ACMP0ABS(gtabsDD, B,D,D, TGT, > )
342+
ACMP0ABS(leabsDD, B,D,D, TLE, <= )
343+
ACMP0ABS(ltabsDD, B,D,D, TLT, < )
344+
ACMP0ABS(neabsDD, B,D,D, TNE, != )
345+
ACMP0ABS(eqabsDD, B,D,D, TEQ, == )
340346

341347
APFX(gtII, B,I,I, CMPGT,,R EVOK;)
342348
APFX(geII, B,I,I, CMPGE,,R EVOK;)

test/g020a.ijs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ a =. u"u | NB. no prim support
164164
b =. u | NB. tolerant
165165
c =. u!.0"u | NB. intolerant, no prim
166166
d =. u!.0 | NB. intolerant prim
167-
assert. (a -: b)/~ y
168-
assert. (c -: d)/~ y
167+
assert. (a -: b)"0/~ y
168+
assert. (c -: d)"0/~ y
169169
assert. (7!:2 'a~ x') > 2 * (7!:2 'b~ x')
170170
assert. (10000 (6!:2) 'b~ x') > 1.3 * (10000 (6!:2) 'd~ x')
171171
1 return.

0 commit comments

Comments
 (0)