Skip to content

Commit b7ac43f

Browse files
authored
Merge PR-10986 from sverker/erts/ryu-alternative
Add alternative to ryu OTP-20013
2 parents caf81eb + d1eafda commit b7ac43f

10 files changed

Lines changed: 319 additions & 81 deletions

File tree

HOWTO/INSTALL.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ Some of the available `configure` options are:
372372
* `--with-javac=JAVAC` - Specify Java compiler to use
373373
* `--{with,without}-javac` - Java compiler (without implies that the
374374
`jinterface` application won't be built)
375-
* `--{enable,disable}-builtin-zlib` - Use the built-in source for zlib.
376375
* `--{enable,disable}-dynamic-ssl-lib` - Enable or disable dynamic OpenSSL
377376
libraries when linking the crypto NIF. By default dynamic linking is
378377
done unless it does not work or is if it is a Windows system.
@@ -455,6 +454,22 @@ Some of the available `configure` options are:
455454
flags when compiling Erlang/OTP. This can be useful in some scenarios
456455
when the flags either causes Erlang/OTP not to build, or unacceptable
457456
performance degradations.
457+
* `--enable-use-embedded-3pp-alternatives` - Use all available alternatives
458+
instead of embedded 3pps. Implies all `--disable-builtin-*` options. Can
459+
be overridden by individual `--enable-builtin-*` options.
460+
* `--disable-use-embedded-3pp-alternatives` - Do not use any alternatives
461+
to embedded 3pps. Implies all `--enable-builtin-*` options. Can be overridden
462+
by individual `--disable-builtin-*` options.
463+
* `--enable-builtin-ryu` - Use our own built-in ryu for float to short string.
464+
* `--disable-builtin-ryu` - Use C++17 as an alternative for built-in ryu. May
465+
cause slightly different results when converting floating point values to
466+
strings using `float_to_list(F,[short])`, `float_to_binary(F,[short])` or
467+
`io:format` with control sequences `~p` or `~w`.
468+
* `--enable-builtin-zstd` - Force use of our own built-in zstd.
469+
* `--disable-builtin-zstd` - Find a static libzstd on the system to use.
470+
* `--enable-builtin-zlib` - Force use of our own built-in zlib.
471+
* `--disable-builtin-zlib` - Find a zlib on the system to use.
472+
458473

459474
If you or your system has special requirements please read the `Makefile` for
460475
additional configuration information.

erts/config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@
7878
64-bit alignment will be forced. */
7979
#undef ERTS_STRUCTURE_ALIGNED_ALLOC
8080

81+
/* Define if builtin ryu should be used */
82+
#undef ERTS_USE_BUILTIN_RYU
83+
8184
/* Define if builtin zlib should be used */
8285
#undef ERTS_USE_BUILTIN_ZLIB
8386

erts/configure

Lines changed: 85 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ PRIMARY_FLAVOR
663663
JIT_ARCH
664664
JIT_ENABLED
665665
EMU_LDFLAGS
666+
ERTS_USE_BUILTIN_RYU
666667
M4
667668
LIBRT
668669
BITS64
@@ -853,6 +854,7 @@ with_with_sparc_memory_order
853854
enable_ppc_lwsync_instruction
854855
with_threadnames
855856
enable_use_embedded_3pp_alternatives
857+
enable_builtin_ryu
856858
enable_builtin_zstd
857859
enable_builtin_zlib
858860
enable_esock
@@ -1601,13 +1603,22 @@ Optional Features:
16011603
disable use of powerpc lwsync instruction
16021604
--enable-use-embedded-3pp-alternatives
16031605
use all available alternatives instead of embedded
1604-
3pps
1606+
3pps. Implies all --disable-builtin-* options. Can
1607+
be overridden by individual --enable-builtin-*
1608+
options.
16051609
--disable-use-embedded-3pp-alternatives
1606-
do not use any alternatives to embedded 3pps
1610+
do not use any alternatives to embedded 3pps.
1611+
Implies all --enable-builtin-* options. Can be
1612+
overridden by individual --disable-builtin-*
1613+
options.
1614+
--enable-builtin-ryu use our own built-in ryu for float to short string
1615+
(default)
1616+
--disable-builtin-ryu use C++17 as an alternative for built-in ryu
16071617
--enable-builtin-zstd force use of our own built-in zstd
16081618
--disable-builtin-zstd try to find a static libzstd on the system to use
1619+
(default)
16091620
--enable-builtin-zlib force use of our own built-in zlib
1610-
--disable-builtin-zlib try to find a zlib on the system to use
1621+
--disable-builtin-zlib try to find a zlib on the system to use (default)
16111622
--enable-esock enable builtin socket (as a nif) support (default)
16121623
--disable-esock disable builtin socket (as a nif) support
16131624
--enable-esock-rcvsndtimeo
@@ -16670,21 +16681,28 @@ if test ${enable_use_embedded_3pp_alternatives+y}
1667016681
then :
1667116682
enableval=$enable_use_embedded_3pp_alternatives; case "$enableval" in
1667216683
no)
16684+
builtin_ryu=yes
1667316685
builtin_zstd=yes
1667416686
builtin_zlib=yes
1667516687
;;
1667616688
*)
16689+
builtin_ryu=no
1667716690
builtin_zstd=no
1667816691
builtin_zlib=no
1667916692
;;
1668016693
esac
1668116694

16682-
else case e in #(
16683-
e)
16684-
builtin_zstd=no
16685-
builtin_zlib=no
16686-
;;
16687-
esac
16695+
fi
16696+
16697+
16698+
16699+
# Check whether --enable-builtin-ryu was given.
16700+
if test ${enable_builtin_ryu+y}
16701+
then :
16702+
enableval=$enable_builtin_ryu; case "$enableval" in
16703+
no) builtin_ryu=no ;;
16704+
*) builtin_ryu=yes ;;
16705+
esac
1668816706
fi
1668916707

1669016708

@@ -16701,7 +16719,7 @@ fi
1670116719

1670216720
LIBZSTD=
1670316721

16704-
if test "$builtin_zstd" = "no"
16722+
if test "$builtin_zstd" != "yes"
1670516723
then :
1670616724

1670716725
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for static libzstd of version 1.5.6 or higher" >&5
@@ -16740,8 +16758,14 @@ printf "%s\n" "yes" >&6; }
1674016758

1674116759
else case e in #(
1674216760
e)
16743-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using builtin zstd instead" >&5
16744-
printf "%s\n" "no, using builtin zstd instead" >&6; }
16761+
if test "$builtin_zstd" = "no"
16762+
then :
16763+
as_fn_error $? "libzstd not found" "$LINENO" 5
16764+
else case e in #(
16765+
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using builtin zstd instead" >&5
16766+
printf "%s\n" "no, using builtin zstd instead" >&6; } ;;
16767+
esac
16768+
fi
1674516769
;;
1674616770
esac
1674716771
fi
@@ -16777,17 +16801,9 @@ fi
1677716801

1677816802
Z_LIB=
1677916803

16780-
if test "x$builtin_zlib" = "xyes"
16804+
if test "$builtin_zlib" != "yes"
1678116805
then :
1678216806

16783-
16784-
printf "%s\n" "#define HAVE_ZLIB_INFLATEGETDICTIONARY 1" >>confdefs.h
16785-
16786-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: Using our own built-in zlib source" >&5
16787-
printf "%s\n" "$as_me: Using our own built-in zlib source" >&6;}
16788-
16789-
else case e in #(
16790-
e)
1679116807
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib 1.2.5 or higher" >&5
1679216808
printf %s "checking for zlib 1.2.5 or higher... " >&6; }
1679316809
zlib_save_LIBS=$LIBS
@@ -16826,8 +16842,14 @@ printf "%s\n" "yes" >&6; }
1682616842

1682716843
else case e in #(
1682816844
e)
16829-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
16830-
printf "%s\n" "no" >&6; }
16845+
if test "$builtin_zlib" = "no"
16846+
then :
16847+
as_fn_error $? "zlib not found" "$LINENO" 5
16848+
else case e in #(
16849+
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using builtin zlib instead" >&5
16850+
printf "%s\n" "no, using builtin zlib instead" >&6; } ;;
16851+
esac
16852+
fi
1683116853
;;
1683216854
esac
1683316855
fi
@@ -16911,17 +16933,21 @@ fi
1691116933

1691216934
LIBS=$zlib_save_LIBS
1691316935

16914-
;;
16915-
esac
16936+
1691616937
fi
1691716938

1691816939
if test "$Z_LIB" = ""
1691916940
then :
1692016941

16942+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: Using our own built-in zlib source" >&5
16943+
printf "%s\n" "$as_me: Using our own built-in zlib source" >&6;}
1692116944

1692216945
printf "%s\n" "#define ERTS_USE_BUILTIN_ZLIB 1" >>confdefs.h
1692316946

1692416947

16948+
printf "%s\n" "#define HAVE_ZLIB_INFLATEGETDICTIONARY 1" >>confdefs.h
16949+
16950+
1692516951
fi
1692616952

1692716953

@@ -26278,7 +26304,6 @@ fi
2627826304

2627926305

2628026306
JIT_ARCH=
26281-
2628226307
if test ${enable_jit} != no
2628326308
then :
2628426309

@@ -26345,7 +26370,10 @@ printf "%s\n" "$as_me: WARNING: JIT disabled due to lack to support on $ARCH-$OP
2634526370
;;
2634626371
esac
2634726372

26348-
if test ${enable_jit} != no
26373+
fi
26374+
26375+
26376+
if test ${enable_jit} != no -o "$builtin_ryu" = "no"
2634926377
then :
2635026378

2635126379
if test "$CXX" != false
@@ -26384,6 +26412,7 @@ else case e in #(
2638426412
printf %s "checking for C++17 support... " >&6; }
2638526413
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
2638626414
printf "%s\n" "no" >&6; }
26415+
CXXFLAGS=$old_CXXFLAGS
2638726416
HAVE_CXX17=false ;;
2638826417
esac
2638926418
fi
@@ -26397,27 +26426,50 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
2639726426

2639826427
fi
2639926428
if test "$CXX" = false -o "$HAVE_CXX17" = false; then
26429+
# C++17 not found
26430+
if test "$builtin_ryu" = "no"; then
26431+
as_fn_error $? "Alternative to builtin ryu needs C++17 support" "$LINENO" 5
26432+
else
26433+
builtin_ryu=yes
26434+
fi
2640026435
if test ${enable_jit} = yes; then
2640126436
as_fn_error $? "JIT needs a C++ compiler with C++17 support" "$LINENO" 5
26402-
else
26437+
fi
26438+
if test ${enable_jit} != no; then
2640326439
enable_jit=no
2640426440
cat >> $ERL_TOP/erts/CONF_INFO <<EOF
2640526441

2640626442
JIT disabled due to lack of compiler with C++17 support
2640726443
EOF
2640826444
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: JIT disable due to lack of C++ compiler with C++17 support" >&5
2640926445
printf "%s\n" "$as_me: WARNING: JIT disable due to lack of C++ compiler with C++17 support" >&2;}
26410-
fi
26411-
fi
26446+
fi
26447+
else
26448+
# C++17 found
26449+
if test ${enable_jit} != no; then
26450+
enable_jit=yes
26451+
fi
26452+
fi
2641226453

2641326454
fi
2641426455

26415-
if test ${enable_jit} != no; then
26416-
enable_jit=yes
26417-
fi
26456+
if test "$builtin_ryu" = "no"
26457+
then :
2641826458

26459+
ERTS_USE_BUILTIN_RYU=no
26460+
26461+
else case e in #(
26462+
e)
26463+
26464+
printf "%s\n" "#define ERTS_USE_BUILTIN_RYU 1" >>confdefs.h
26465+
26466+
ERTS_USE_BUILTIN_RYU=yes
26467+
;;
26468+
esac
2641926469
fi
2642026470

26471+
26472+
2642126473
if test ${enable_jit} != no
2642226474
then :
2642326475

0 commit comments

Comments
 (0)