Skip to content

Commit 92841ff

Browse files
committed
Merge branch 'master' of jsoftware.com:jsource
Short-caching of verbs broken
2 parents e879851 + 85cb457 commit 92841ff

17 files changed

+794
-340
lines changed

.github/workflows/jsource.yml

Lines changed: 327 additions & 58 deletions
Large diffs are not rendered by default.

jsrc/jconsole.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@
2828
#include "j.h"
2929
#include "jeload.h"
3030

31-
#if !defined(_WIN32) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__wasm__) //temporary
31+
#if defined(__APPLE__) || defined(_WIN32) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__wasm__) //temporary
32+
#undef LIBBACKTRACE
33+
#else
34+
#undef LIBBACKTRACE
35+
#ifndef DEBUG
36+
#define LIBBACKTRACE
37+
#endif
38+
#endif
39+
40+
#ifdef LIBBACKTRACE
3241
#include "../libbacktrace/backtrace.h"
3342
#endif
3443

@@ -52,7 +61,7 @@ static BOOL WINAPI CtrlHandler(DWORD fdwCtrlType){
5261
}
5362
}
5463
#endif
55-
#if !defined(_WIN32) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__wasm__) //temporary
64+
#ifdef LIBBACKTRACE
5665
static int err_write(void *data, uintptr_t pc, const char *file, int line, const char *function){
5766
char buf[512];
5867
file = file ? file : "?";
@@ -268,7 +277,7 @@ JST* jt;
268277

269278
int main(int argc, char* argv[])
270279
{
271-
#if !defined(_WIN32) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__wasm__) //temporary
280+
#ifdef LIBBACKTRACE
272281
signal(SIGSEGV,sigsegv);
273282
signal(SIGILL,sigsegv);
274283
#ifdef __APPLE__

make2/build_jamalgam.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ if [ "" = "$CFLAGS" ]; then
1010
# OPTLEVEL will be merged back into CFLAGS, further down
1111
# OPTLEVEL is probably overly elaborate, but it works
1212
case "$_DEBUG" in
13-
3) OPTLEVEL=" -O2 -g "
13+
3) OPTLEVEL=" -O2 -g " ; DEBUG=1
1414
NASM_FLAGS="-g";;
15-
2) OPTLEVEL=" -O0 -ggdb -DOPTMO0 "
15+
2) OPTLEVEL=" -O0 -ggdb -DOPTMO0 " ; DEBUG=1
1616
NASM_FLAGS="-g";;
17-
1) OPTLEVEL=" -O2 -g "
17+
1) OPTLEVEL=" -O2 -g " ; DEBUG=1
1818
NASM_FLAGS="-g"
1919
jplatform64=$(./jplatform64.sh)-debug;;
20-
*) OPTLEVEL=" -O2 ";;
20+
*) OPTLEVEL=" -O2 "; DEBUG=0 ;;
2121
esac
2222
else
23-
case "$CFLAGS" in *-O0*) OPTLEVEL=" -DOPTMO0 ";; *) ;; esac
23+
case "$CFLAGS" in *-O0*) OPTLEVEL=" -DOPTMO0 " ; DEBUG=1 ;; *) DEBUG=0 ;; esac
2424
fi
2525
echo "jplatform64=$jplatform64"
2626

@@ -166,6 +166,10 @@ fi
166166

167167
common="$common -DJAMALGAM"
168168

169+
if [ $DEBUG -eq 1 ] ; then
170+
common="$common -DDEBUG"
171+
fi
172+
169173
case "$jplatform64" in
170174
darwin/*) common="$common -fno-common" ;; # other platforms already default to this
171175
esac

make2/build_jconsole.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ if [ "" = "$CFLAGS" ]; then
1010
# OPTLEVEL will be merged back into CFLAGS, further down
1111
# OPTLEVEL is probably overly elaborate, but it works
1212
case "$_DEBUG" in
13-
3) OPTLEVEL=" -O2 -g "
13+
3) OPTLEVEL=" -O2 -g " ; DEBUG=1
1414
NASM_FLAGS="-g";;
15-
2) OPTLEVEL=" -O0 -ggdb "
15+
2) OPTLEVEL=" -O0 -ggdb -DOPTMO0 " ; DEBUG=1
1616
NASM_FLAGS="-g";;
17-
1) OPTLEVEL=" -O2 -g "
17+
1) OPTLEVEL=" -O2 -g " ; DEBUG=1
1818
NASM_FLAGS="-g"
1919
jplatform64=$(./jplatform64.sh)-debug;;
20-
*) OPTLEVEL=" -O2 ";;
20+
*) OPTLEVEL=" -O2 "; DEBUG=0 ;;
2121
esac
22-
22+
else
23+
case "$CFLAGS" in *-O0*) OPTLEVEL=" -DOPTMO0 " ; DEBUG=1 ;; *) DEBUG=0 ;; esac
2324
fi
2425
echo "jplatform64=$jplatform64"
2526

make2/build_libj.sh

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ if [ "" = "$CFLAGS" ]; then
1212
# OPTLEVEL will be merged back into CFLAGS, further down
1313
# OPTLEVEL is probably overly elaborate, but it works
1414
case "$_DEBUG" in
15-
3) OPTLEVEL=" -O2 -g "
15+
3) OPTLEVEL=" -O2 -g " ; DEBUG=1
1616
NASM_FLAGS="-g";;
17-
2) OPTLEVEL=" -O0 -ggdb -DOPTMO0 "
17+
2) OPTLEVEL=" -O0 -ggdb -DOPTMO0 " ; DEBUG=1
1818
NASM_FLAGS="-g";;
19-
1) OPTLEVEL=" -O2 -g "
19+
1) OPTLEVEL=" -O2 -g " ; DEBUG=1
2020
NASM_FLAGS="-g"
2121
jplatform64=$(./jplatform64.sh)-debug;;
22-
*) OPTLEVEL=" -O2 ";;
22+
*) OPTLEVEL=" -O2 "; DEBUG=0 ;;
2323
esac
2424
else
25-
case "$CFLAGS" in *-O0*) OPTLEVEL=" -DOPTMO0 ";; *) ;; esac
25+
case "$CFLAGS" in *-O0*) OPTLEVEL=" -DOPTMO0 " ; DEBUG=1 ;; *) DEBUG=0 ;; esac
2626
fi
2727
echo "jplatform64=$jplatform64"
2828

@@ -167,6 +167,10 @@ else
167167

168168
fi
169169

170+
if [ $DEBUG -eq 1 ] ; then
171+
common="$common -DDEBUG"
172+
fi
173+
170174
case "$jplatform64" in
171175
darwin/*) common="$common -fno-common" ;; # other platforms already default to this
172176
esac
@@ -388,7 +392,7 @@ case $jplatform64 in
388392
raspberry/j32*) # linux raspbian arm
389393
TARGET=libj.so
390394
CFLAGS="$common -std=gnu99 -Wno-overflow -marm -march=armv6 -mfloat-abi=hard -mfpu=vfp -DRASPI "
391-
LDFLAGS=" -shared -Wl,-soname,libj.so -lm -ldl $LDTHREAD $LDOPENMP "
395+
LDFLAGS=" -shared -Wl,-soname,libj.so -lm -ldl $LDTHREAD $LDOPENMP -Wl,-z,noexecstack "
392396
SRC_ASM="${SRC_ASM_RASPI32}"
393397
GASM_FLAGS=""
394398
FLAGS_SLEEF=" -DENABLE_VECEXT " # broken in upstream
@@ -398,7 +402,7 @@ case $jplatform64 in
398402
raspberry/j64*) # linux arm64
399403
TARGET=libj.so
400404
CFLAGS="$common -march=armv8-a+crc -DRASPI -DC_CRC32C=1 " # mno-outline-atomics unavailable on clang-7
401-
LDFLAGS=" -shared -Wl,-soname,libj.so -lm -ldl $LDTHREAD $LDOPENMP "
405+
LDFLAGS=" -shared -Wl,-soname,libj.so -lm -ldl $LDTHREAD $LDOPENMP -Wl,-z,noexecstack "
402406
OBJS_AESARM=" aes-arm.o "
403407
SRC_ASM="${SRC_ASM_RASPI}"
404408
GASM_FLAGS=""
@@ -413,7 +417,7 @@ case $jplatform64 in
413417
CFLAGS="$common -m32 -msse2 -mfpmath=sse "
414418
# slower, use 387 fpu and truncate extra precision
415419
# CFLAGS="$common -m32 -ffloat-store "
416-
LDFLAGS=" -shared -Wl,-soname,libj.so -m32 -lm -lkvm $LDOPENMP32 $LDTHREAD "
420+
LDFLAGS=" -shared -Wl,-soname,libj.so -m32 -lm -lkvm $LDTHREAD $LDOPENMP32 -Wl,-z,noexecstack "
417421
OBJS_AESNI=" aes-ni.o "
418422
SRC_ASM="${SRC_ASM_LINUX32}"
419423
GASM_FLAGS="-m32"
@@ -424,7 +428,7 @@ case $jplatform64 in
424428
openbsd/j64arm) # openbsd arm64
425429
TARGET=libj.so
426430
CFLAGS="$common -march=armv8-a+crc -DC_CRC32C=1 " # mno-outline-atomics unavailable on clang-7
427-
LDFLAGS=" -shared -Wl,-soname,libj.so -lm -lkvm $LDTHREAD $LDOPENMP "
431+
LDFLAGS=" -shared -Wl,-soname,libj.so -lm -lkvm $LDTHREAD $LDOPENMP -Wl,-z,noexecstack "
428432
OBJS_AESARM=" aes-arm.o "
429433
SRC_ASM="${SRC_ASM_RASPI}"
430434
GASM_FLAGS=""
@@ -435,7 +439,7 @@ case $jplatform64 in
435439
openbsd/j64avx512*) # openbsd intel 64bit avx512
436440
TARGET=libj.so
437441
CFLAGS="$common -DC_AVX2=1 -DC_AVX512=1 "
438-
LDFLAGS=" -shared -Wl,-soname,libj.so -lm -lkvm $LDTHREAD $LDOPENMP "
442+
LDFLAGS=" -shared -Wl,-soname,libj.so -lm -lkvm $LDTHREAD $LDOPENMP -Wl,-z,noexecstack "
439443
CFLAGS_SIMD=" -march=skylake-avx512 -mtune=skylake-avx512 -mavx2 -mfma -mbmi -mbmi2 -mlzcnt -mmovbe -mpopcnt -mno-vzeroupper "
440444
OBJS_FMA=" gemm_int-fma.o "
441445
OBJS_AESNI=" aes-ni.o "
@@ -449,7 +453,7 @@ case $jplatform64 in
449453
openbsd/j64avx2*) # openbsd intel 64bit avx2
450454
TARGET=libj.so
451455
CFLAGS="$common -DC_AVX2=1 "
452-
LDFLAGS=" -shared -Wl,-soname,libj.so -lm -lkvm $LDTHREAD $LDOPENMP "
456+
LDFLAGS=" -shared -Wl,-soname,libj.so -lm -lkvm $LDTHREAD $LDOPENMP -Wl,-z,noexecstack "
453457
CFLAGS_SIMD=" -march=skylake -mtune=skylake -mavx2 -mfma -mbmi -mbmi2 -mlzcnt -mmovbe -mpopcnt -mno-vzeroupper "
454458
OBJS_FMA=" gemm_int-fma.o "
455459
OBJS_AESNI=" aes-ni.o "
@@ -462,7 +466,7 @@ case $jplatform64 in
462466
openbsd/j64*) # openbsd intel 64bit nonavx
463467
TARGET=libj.so
464468
CFLAGS="$common -msse3 "
465-
LDFLAGS=" -shared -Wl,-soname,libj.so -lm -lkvm $LDTHREAD $LDOPENMP "
469+
LDFLAGS=" -shared -Wl,-soname,libj.so -lm -lkvm $LDTHREAD $LDOPENMP -Wl,-z,noexecstack "
466470
OBJS_AESNI=" aes-ni.o "
467471
SRC_ASM="${SRC_ASM_LINUX}"
468472
GASM_FLAGS=""
@@ -477,7 +481,7 @@ case $jplatform64 in
477481
CFLAGS="$common -m32 -msse2 -mfpmath=sse "
478482
# slower, use 387 fpu and truncate extra precision
479483
# CFLAGS="$common -m32 -ffloat-store "
480-
LDFLAGS=" -shared -Wl,-soname,libj.so -m32 -lm $LDOPENMP32 $LDTHREAD "
484+
LDFLAGS=" -shared -Wl,-soname,libj.so -m32 -lm $LDOPENMP32 $LDTHREAD -Wl,-z,noexecstack "
481485
OBJS_AESNI=" aes-ni.o "
482486
SRC_ASM="${SRC_ASM_LINUX32}"
483487
GASM_FLAGS="-m32"
@@ -488,7 +492,7 @@ case $jplatform64 in
488492
freebsd/j64arm) # freebsd arm64
489493
TARGET=libj.so
490494
CFLAGS="$common -march=armv8-a+crc -DC_CRC32C=1 " # mno-outline-atomics unavailable on clang-7
491-
LDFLAGS=" -shared -Wl,-soname,libj.so -lm $LDTHREAD $LDOPENMP "
495+
LDFLAGS=" -shared -Wl,-soname,libj.so -lm $LDTHREAD $LDOPENMP -Wl,-z,noexecstack "
492496
OBJS_AESARM=" aes-arm.o "
493497
SRC_ASM="${SRC_ASM_RASPI}"
494498
GASM_FLAGS=""
@@ -499,7 +503,7 @@ case $jplatform64 in
499503
freebsd/j64avx512*) # freebsd intel 64bit avx512
500504
TARGET=libj.so
501505
CFLAGS="$common -DC_AVX2=1 -DC_AVX512=1 "
502-
LDFLAGS=" -shared -Wl,-soname,libj.so -lm $LDTHREAD $LDOPENMP "
506+
LDFLAGS=" -shared -Wl,-soname,libj.so -lm $LDTHREAD $LDOPENMP -Wl,-z,noexecstack "
503507
CFLAGS_SIMD=" -march=skylake-avx512 -mtune=skylake-avx512 -mavx2 -mfma -mbmi -mbmi2 -mlzcnt -mmovbe -mpopcnt -mno-vzeroupper "
504508
OBJS_FMA=" gemm_int-fma.o "
505509
OBJS_AESNI=" aes-ni.o "
@@ -513,7 +517,7 @@ case $jplatform64 in
513517
freebsd/j64avx2*) # freebsd intel 64bit avx2
514518
TARGET=libj.so
515519
CFLAGS="$common -DC_AVX2=1 "
516-
LDFLAGS=" -shared -Wl,-soname,libj.so -lm $LDTHREAD $LDOPENMP "
520+
LDFLAGS=" -shared -Wl,-soname,libj.so -lm $LDTHREAD $LDOPENMP -Wl,-z,noexecstack "
517521
CFLAGS_SIMD=" -march=skylake -mtune=skylake -mavx2 -mfma -mbmi -mbmi2 -mlzcnt -mmovbe -mpopcnt -mno-vzeroupper "
518522
OBJS_FMA=" gemm_int-fma.o "
519523
OBJS_AESNI=" aes-ni.o "
@@ -526,7 +530,7 @@ case $jplatform64 in
526530
freebsd/j64*) # freebsd intel 64bit nonavx
527531
TARGET=libj.so
528532
CFLAGS="$common -msse3 "
529-
LDFLAGS=" -shared -Wl,-soname,libj.so -lm $LDTHREAD $LDOPENMP "
533+
LDFLAGS=" -shared -Wl,-soname,libj.so -lm $LDTHREAD $LDOPENMP -Wl,-z,noexecstack "
530534
OBJS_AESNI=" aes-ni.o "
531535
SRC_ASM="${SRC_ASM_LINUX}"
532536
GASM_FLAGS=""

make2/makefile-jamalgam

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ODIR=../../../../bin/$(jplatform64)
1010

1111
ifneq (bsd,$(findstring bsd,$(jplatform64)))
1212

13+
ifneq (darwin,$(findstring darwin,$(jplatform64)))
14+
1315
BACKTRACE_OBJS := \
1416
atomic.o \
1517
backtrace.o \
@@ -31,6 +33,8 @@ endif
3133

3234
endif
3335

36+
endif
37+
3438
# note: the slowest builds have been placed at the top, to avoid starvation in parallel builds
3539
# (viavx is still longer than everything else combined--should maybe be broken up into multiple tus...)
3640
OBJS= \

make2/makefile-jconsole

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ ODIR=../../../../bin/$(jplatform64)
1515

1616
ifneq (bsd,$(findstring bsd,$(jplatform64)))
1717

18+
ifneq (darwin,$(findstring darwin,$(jplatform64)))
19+
1820
BACKTRACE_OBJS := \
1921
atomic.o \
2022
backtrace.o \
@@ -36,6 +38,8 @@ endif
3638

3739
endif
3840

41+
endif
42+
3943
OBJS= \
4044
jconsole.o \
4145
jeload.o \

0 commit comments

Comments
 (0)