Skip to content

Commit 2024f3f

Browse files
committed
Merge branch 'master' of jsoftware.com:jsource
2 parents f9f82ca + 1546586 commit 2024f3f

11 files changed

Lines changed: 38 additions & 17 deletions

File tree

jsrc/Android.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
1919
LOCAL_LDFLAGS += -fopenmp -static-openmp
2020
endif
2121
ifeq ($(TARGET_ARCH_ABI),armeabi)
22-
LOCAL_CFLAGS := -std=c99 -Wno-unknown-warning-option -fPIC -Os -fvisibility=hidden -fwrapv -Werror -Wno-string-plus-int -Wno-empty-body -Wno-parentheses -Wno-pointer-sign -Wno-pointer-to-int-cast -Wno-logical-op-parentheses -Wno-unused-value -Wno-null-dereference -Wno-type-limits -fno-strict-aliasing -mfloat-abi=softfp -march=armv5te -Wno-sign-compare
22+
LOCAL_CFLAGS := -std=c99 -Wno-unknown-warning-option -fPIC -Os -fvisibility=hidden -fwrapv -Werror -Wno-overflow -Wno-string-plus-int -Wno-empty-body -Wno-int-to-pointer-cast -Wno-parentheses -Wno-pointer-sign -Wno-pointer-to-int-cast -Wno-logical-op-parentheses -Wno-unused-value -Wno-null-dereference -Wno-type-limits -fno-strict-aliasing -mfloat-abi=softfp -march=armv5te -Wno-sign-compare
2323
LOCAL_ARM_MODE := arm
2424
LOCAL_CFLAGS += -fopenmp
2525
LOCAL_LDFLAGS += -fopenmp

jsrc/j.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,23 @@ extern unsigned int __cdecl _clearfp (void);
442442
#endif
443443
#endif
444444

445+
#if !SY_64 && defined(__GNUC__) && !defined(__clang__)
446+
#if __GNUC__ < 5
447+
#define __builtin_add_overflow(a,b,c) ({int64_t s=(int64_t)(a)+(int64_t)(b); *(c)=(long)s; (s<INT_MIN||s>INT_MAX);})
448+
#define __builtin_sub_overflow(a,b,c) ({int64_t s=(int64_t)(a)-(int64_t)(b); *(c)=(long)s; (s<INT_MIN||s>INT_MAX);})
449+
#define __builtin_mul_overflow(a,b,c) ({int64_t s=(int64_t)(a)*(int64_t)(b); *(c)=(long)s; (s<INT_MIN||s>INT_MAX);})
450+
#endif
451+
#endif
452+
453+
#if defined(__clang__) && ( (__clang_major__ > 3) || ((__clang_major__ == 3) && (__clang_minor__ > 5)))
454+
/* needed by clang newer versions, no matter double_trick is inline asm or not */
455+
#define NOOPTIMIZE __attribute__((optnone))
456+
#elif __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 3))
457+
#define NOOPTIMIZE __attribute__((optimize("O0")))
458+
#else
459+
#define NOOPTIMIZE
460+
#endif
461+
445462
#define NALP 256 /* size of alphabet */
446463
#define NETX 2000 /* size of error display buffer */
447464
#define NPP 20 /* max value for quad pp */
@@ -1091,7 +1108,7 @@ if(likely(!((I)jtinplace&JTWILLBEOPENED)))z=EPILOGNORET(z); RETF(z); \
10911108
// Note: assigns name before assigning the components of the array, so the components had better not depend on name, i. e. no GATV(z,BOX,AN(z),AR(z),AS(z))
10921109
#define GATVS(name,type,atoms,rank,shaape,size,shapecopier,erraction) \
10931110
{ I bytes = ALLOBYTES(atoms,rank,size,(type)&LAST0,(type)&NAME); \
1094-
if(SY_64){ASSERT((((I)(atoms)>>(TOOMANYATOMSX-RANKTX))|(I)(rank))<=RMAX,EVLIMIT)} \
1111+
if(SY_64){ASSERT((((I)(atoms)>>(SY_64?(TOOMANYATOMSX-RANKTX):0))|(I)(rank))<=RMAX,EVLIMIT)} \
10951112
else{ASSERT(((I)bytes>(I)(atoms)&&(I)(atoms)>=(I)0)&&!((rank)&~RMAX),EVLIMIT)} \
10961113
HISTOCALL \
10971114
name = jtgafv(jt, bytes); \

jsrc/va1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,4 @@ DF2(jtdeadband){A zz;
247247
)
248248
RETF(zz);
249249
}
250-
#endif
250+
#endif

jsrc/va1ss.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515

1616
#define SSINGENC(type) ((type)>>INTX)
1717
#define SSINGCASE(id,subtype) (3*(id)+(subtype)) // encode case/args into one branch value
18-
A jtssingleton1(J jt, A w,I caseno){A z;void *zv;
18+
19+
#if !(defined(__aarch32__)||defined(__arm__)||defined(_M_ARM))
20+
#undef NOOPTIMIZE
21+
#define NOOPTIMIZE
22+
#endif
23+
A NOOPTIMIZE jtssingleton1(J jt, A w,I caseno){A z;void *zv;
1924
F2PREFIP;
2025
I ar=AR(w);
2126
// Calculate inplaceability

jsrc/va2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ DF2(jtatomic2){A z;
11981198
// singleton. we need the rank of the result
11991199
ar-=af; wr-=wf; ar=ar>wr?ar:wr; af=af>wf?af:wf; af+=ar; // set af to max len of frame, ar to max cell rank; then af=max framelen + max rank = resultrank
12001200
forcess:; // branch point for rank-0 singletons from above, always with atomic result
1201-
z=jtssingleton(jt,a,w,af+((I)FAV(self)->lc<<RANKTX)+(((I)jtinplace&3)<<24)+((3*(at>>INTX)+(wt>>INTX))<<26)); // create portmanteau parm reg
1201+
z=jtssingleton(jt,a,w,af|((I)FAV(self)->lc<<RANKTX)|(((I)jtinplace&3)<<24)|((3*(at>>INTX)+(wt>>INTX))<<26)); // create portmanteau parm reg
12021202
if(likely(z!=0)){RETF(z);} // normal case is good return; the rest is retry for singletons
12031203
if(unlikely(jt->jerr<=NEVM)){RETF(z);} // if error is unrecoverable, don't retry
12041204
// if retryable error, fall through. The retry will not be through the singleton code

jsrc/va2ss.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ static NOINLINE I intforD(J jt, D d){D q;I z; // noinline because it uses so ma
3636
}
3737

3838
#define SSINGCASE(id,subtype) (9*(id)+(subtype)) // encode case/args into one branch value
39+
40+
#if !(defined(__aarch32__)||defined(__arm__)||defined(_M_ARM))
41+
#undef NOOPTIMIZE
42+
#define NOOPTIMIZE
43+
#endif
3944
// do singleton operation. ipcaserank bits 0-15=rank of result, 16-23=self->lc code for the operation (with comparisons flagged), 24-25=inplace bits, 26-29 types code
40-
A jtssingleton(J jt, A a,A w,I ipcaserank){A z;I aiv;void *zv;
45+
A NOOPTIMIZE jtssingleton(J jt, A a,A w,I ipcaserank){A z;I aiv;void *zv;
4146
z=0; I ac=AC(a); I wc=AC(w);
4247
// see if we can inplace an assignment. That is always a good idea, though rare
4348
if(unlikely(((B)(a==jt->asginfo.zombieval)&((B)(ipcaserank>>(24+JTINPLACEAX)))&(B)1)+((B)(w==jt->asginfo.zombieval)&((B)(ipcaserank>>(24+JTINPLACEWX)))&(B)1))){

jsrc/x15.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -584,15 +584,6 @@ static void double_trick(double*v, I n){I i=0;
584584
d[56],d[57],d[58],d[59],d[60],d[61],d[62],d[63]);break; \
585585
}
586586

587-
#if defined(__clang__) && ( (__clang_major__ > 3) || ((__clang_major__ == 3) && (__clang_minor__ > 5)))
588-
/* needed by clang newer versions, no matter double_trick is inline asm or not */
589-
#define NOOPTIMIZE __attribute__((optnone))
590-
#elif __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 3))
591-
#define NOOPTIMIZE __attribute__((optimize("O0")))
592-
#else
593-
#define NOOPTIMIZE
594-
#endif
595-
596587
static I NOOPTIMIZE stdcalli(STDCALLI fp,I*d,I cnt,DoF*dd,I dcnt){I r;
597588
SWITCHCALL;
598589
R r;

make2/build_libj.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,11 @@ common="$OPENMP -fPIC -O2 -fvisibility=hidden -fno-strict-aliasing -fno-stack-pr
106106
-Wno-parentheses \
107107
-Wno-pointer-sign \
108108
-Wno-pointer-to-int-cast \
109+
-Wno-return-local-addr \
109110
-Wno-shift-count-overflow \
110111
-Wno-shift-negative-value \
111112
-Wno-sign-compare \
113+
-Wno-string-plus-int \
112114
-Wno-type-limits \
113115
-Wno-uninitialized \
114116
-Wno-unused-parameter \

makemsvc/jconsole/makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
READLINE=1
1+
# READLINE=1
22
ifeq (1,${DEBUG})
33
FDEBUG = /FS /Zi /DDEBUG=1
44
LDEBUG = /DEBUG

makemsvc/jconsole/makefile.win

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
READLINE=1
1+
# READLINE=1
22
!if "1"=="$(DEBUG)"
33
FDEBUG = /FS /Zi /DDEBUG=1
44
LDEBUG = /DEBUG

0 commit comments

Comments
 (0)