From ad0f7858f857afcb383067ac89e8a93ede3cc1f5 Mon Sep 17 00:00:00 2001 From: Parth Patel <661497+parthpatel@users.noreply.github.com> Date: Tue, 12 Nov 2024 01:28:11 +0000 Subject: [PATCH] Moving the fast_float integration code into src/fast_float Signed-off-by: Parth Patel <661497+parthpatel@users.noreply.github.com> --- deps/Makefile | 7 ------- src/Makefile | 13 +++++++------ src/debug.c | 2 +- {deps => src}/fast_float/Makefile | 0 {deps => src}/fast_float/fast_float_strtod.cpp | 2 +- {deps => src}/fast_float/fast_float_strtod.h | 0 {deps => src}/fast_float/test_fast_float.c | 0 src/resp_parser.c | 2 +- src/sort.c | 2 +- src/t_zset.c | 2 +- src/util.c | 2 +- src/valkey-cli.c | 2 +- 12 files changed, 14 insertions(+), 20 deletions(-) rename {deps => src}/fast_float/Makefile (100%) rename {deps => src}/fast_float/fast_float_strtod.cpp (97%) rename {deps => src}/fast_float/fast_float_strtod.h (100%) rename {deps => src}/fast_float/test_fast_float.c (100%) diff --git a/deps/Makefile b/deps/Makefile index 880ada0fc4..f1e4bd6ce2 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -42,7 +42,6 @@ distclean: -(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true -(cd hdr_histogram && $(MAKE) clean) > /dev/null || true -(cd fpconv && $(MAKE) clean) > /dev/null || true - -(cd fast_float && $(MAKE) clean) > /dev/null || true -(rm -f .make-*) .PHONY: distclean @@ -75,12 +74,6 @@ fpconv: .make-prerequisites .PHONY: fpconv -fast_float: .make-prerequisites - @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) - cd fast_float && $(MAKE) CFLAGS=" $(CFLAGS) " LDFLAGS=" $(LDFLAGS) " - -.PHONY: fast_float - ifeq ($(uname_S),SunOS) # Make isinf() available LUA_CFLAGS= -D__C99FEATURES__=1 diff --git a/src/Makefile b/src/Makefile index 7bb8dec242..f44c766f21 100644 --- a/src/Makefile +++ b/src/Makefile @@ -383,12 +383,13 @@ else MAYBE_UNINSTALL_REDIS_SYMLINK= endif +fast_float/fast_float_strtod.o: + cd fast_float && $(MAKE) CFLAGS=" $(CFLAGS) " LDFLAGS=" $(LDFLAGS) " + # Determine whether to use fast_float as a library or not. USE_FAST_FLOAT?=no ifeq ($(USE_FAST_FLOAT),yes) - DEPENDENCY_TARGETS+= fast_float FINAL_CFLAGS += -D USE_FAST_FLOAT - FINAL_LIBS += ../deps/fast_float/fast_float_strtod.o # Clang uses libc++ for standard c++ library vs libstdc++ used by gcc. ifeq (clang,$(CLANG)) FINAL_LIBS+= -lc++ @@ -397,7 +398,6 @@ ifeq ($(USE_FAST_FLOAT),yes) endif endif - SERVER_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS) SERVER_AR=$(QUIET_AR)$(AR) SERVER_LD=$(QUIET_LINK)$(CC) $(FINAL_LDFLAGS) @@ -429,16 +429,16 @@ endif ENGINE_NAME=valkey SERVER_NAME=$(ENGINE_NAME)-server$(PROG_SUFFIX) ENGINE_SENTINEL_NAME=$(ENGINE_NAME)-sentinel$(PROG_SUFFIX) -ENGINE_SERVER_OBJ=threads_mngr.o adlist.o quicklist.o ae.o anet.o dict.o kvstore.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o memory_prefetch.o io_threads.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o cluster_legacy.o cluster_slot_stats.o crc16.o endianconv.o slowlog.o eval.o bio.o rio.o rand.o memtest.o syscheck.o crcspeed.o crccombine.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o valkey-check-rdb.o valkey-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o acl.o tracking.o socket.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o resp_parser.o call_reply.o script_lua.o script.o functions.o function_lua.o commands.o strl.o connection.o unix.o logreqres.o +ENGINE_SERVER_OBJ=threads_mngr.o adlist.o quicklist.o ae.o anet.o dict.o kvstore.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o memory_prefetch.o io_threads.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o cluster_legacy.o cluster_slot_stats.o crc16.o endianconv.o slowlog.o eval.o bio.o rio.o rand.o memtest.o syscheck.o crcspeed.o crccombine.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o valkey-check-rdb.o valkey-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o acl.o tracking.o socket.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o resp_parser.o call_reply.o script_lua.o script.o functions.o function_lua.o commands.o strl.o connection.o unix.o logreqres.o fast_float/fast_float_strtod.o ENGINE_CLI_NAME=$(ENGINE_NAME)-cli$(PROG_SUFFIX) -ENGINE_CLI_OBJ=anet.o adlist.o dict.o valkey-cli.o zmalloc.o release.o ae.o serverassert.o crcspeed.o crccombine.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o strl.o cli_commands.o +ENGINE_CLI_OBJ=anet.o adlist.o dict.o valkey-cli.o zmalloc.o release.o ae.o serverassert.o crcspeed.o crccombine.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o strl.o cli_commands.o fast_float/fast_float_strtod.o ENGINE_BENCHMARK_NAME=$(ENGINE_NAME)-benchmark$(PROG_SUFFIX) ENGINE_BENCHMARK_OBJ=ae.o anet.o valkey-benchmark.o adlist.o dict.o zmalloc.o serverassert.o release.o crcspeed.o crccombine.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o strl.o ENGINE_CHECK_RDB_NAME=$(ENGINE_NAME)-check-rdb$(PROG_SUFFIX) ENGINE_CHECK_AOF_NAME=$(ENGINE_NAME)-check-aof$(PROG_SUFFIX) ENGINE_LIB_NAME=lib$(ENGINE_NAME).a ENGINE_TEST_FILES:=$(wildcard unit/*.c) -ENGINE_TEST_OBJ:=$(sort $(patsubst unit/%.c,unit/%.o,$(ENGINE_TEST_FILES))) +ENGINE_TEST_OBJ:=$(sort $(patsubst unit/%.c,unit/%.o,$(ENGINE_TEST_FILES))) fast_float/fast_float_strtod.o ENGINE_UNIT_TESTS:=$(ENGINE_NAME)-unit-tests$(PROG_SUFFIX) ALL_SOURCES=$(sort $(patsubst %.o,%.c,$(ENGINE_SERVER_OBJ) $(ENGINE_CLI_OBJ) $(ENGINE_BENCHMARK_OBJ))) @@ -564,6 +564,7 @@ commands.c: $(COMMANDS_DEF_FILENAME).def clean: rm -rf $(SERVER_NAME) $(ENGINE_SENTINEL_NAME) $(ENGINE_CLI_NAME) $(ENGINE_BENCHMARK_NAME) $(ENGINE_CHECK_RDB_NAME) $(ENGINE_CHECK_AOF_NAME) $(ENGINE_UNIT_TESTS) $(ENGINE_LIB_NAME) unit/*.o unit/*.d *.o *.gcda *.gcno *.gcov valkey.info lcov-html Makefile.dep *.so rm -f $(DEP) + cd fast_float && $(MAKE) clean .PHONY: clean diff --git a/src/debug.c b/src/debug.c index f557bc678d..158fc8e326 100644 --- a/src/debug.c +++ b/src/debug.c @@ -47,7 +47,7 @@ #include #ifdef USE_FAST_FLOAT -#include "../deps/fast_float/fast_float_strtod.h" +#include "fast_float/fast_float_strtod.h" #endif #ifdef HAVE_BACKTRACE diff --git a/deps/fast_float/Makefile b/src/fast_float/Makefile similarity index 100% rename from deps/fast_float/Makefile rename to src/fast_float/Makefile diff --git a/deps/fast_float/fast_float_strtod.cpp b/src/fast_float/fast_float_strtod.cpp similarity index 97% rename from deps/fast_float/fast_float_strtod.cpp rename to src/fast_float/fast_float_strtod.cpp index 0088fc759d..b4f438dd62 100644 --- a/deps/fast_float/fast_float_strtod.cpp +++ b/src/fast_float/fast_float_strtod.cpp @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "fast_float.h" +#include "../../deps/fast_float/fast_float.h" #include "fast_float_strtod.h" #include diff --git a/deps/fast_float/fast_float_strtod.h b/src/fast_float/fast_float_strtod.h similarity index 100% rename from deps/fast_float/fast_float_strtod.h rename to src/fast_float/fast_float_strtod.h diff --git a/deps/fast_float/test_fast_float.c b/src/fast_float/test_fast_float.c similarity index 100% rename from deps/fast_float/test_fast_float.c rename to src/fast_float/test_fast_float.c diff --git a/src/resp_parser.c b/src/resp_parser.c index 3507e89975..5850ccb6db 100644 --- a/src/resp_parser.c +++ b/src/resp_parser.c @@ -59,7 +59,7 @@ #include "server.h" #ifdef USE_FAST_FLOAT -#include "../deps/fast_float/fast_float_strtod.h" +#include "fast_float/fast_float_strtod.h" #endif static int parseBulk(ReplyParser *parser, void *p_ctx) { diff --git a/src/sort.c b/src/sort.c index 4b93f116be..2c1fd24257 100644 --- a/src/sort.c +++ b/src/sort.c @@ -35,7 +35,7 @@ #include "cluster.h" #ifdef USE_FAST_FLOAT -#include "../deps/fast_float/fast_float_strtod.h" +#include "fast_float/fast_float_strtod.h" #endif zskiplistNode *zslGetElementByRank(zskiplist *zsl, unsigned long rank); diff --git a/src/t_zset.c b/src/t_zset.c index 1e07ba42f3..6469550880 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -61,7 +61,7 @@ #include #ifdef USE_FAST_FLOAT -#include "../deps/fast_float/fast_float_strtod.h" +#include "fast_float/fast_float_strtod.h" #endif /*----------------------------------------------------------------------------- diff --git a/src/util.c b/src/util.c index a8b96c8a2e..97a2d64d8d 100644 --- a/src/util.c +++ b/src/util.c @@ -52,7 +52,7 @@ #include "config.h" #ifdef USE_FAST_FLOAT -#include "../deps/fast_float/fast_float_strtod.h" +#include "fast_float/fast_float_strtod.h" #endif #define UNUSED(x) ((void)(x)) diff --git a/src/valkey-cli.c b/src/valkey-cli.c index 41a8f6abb4..21dcbc5906 100644 --- a/src/valkey-cli.c +++ b/src/valkey-cli.c @@ -66,7 +66,7 @@ #include "cli_commands.h" #ifdef USE_FAST_FLOAT -#include "../deps/fast_float/fast_float_strtod.h" +#include "fast_float/fast_float_strtod.h" #endif #define UNUSED(V) ((void)V)