Skip to content

Commit

Permalink
Moving the fast_float integration code into src/fast_float
Browse files Browse the repository at this point in the history
Signed-off-by: Parth Patel <[email protected]>
  • Loading branch information
parthpatel committed Nov 12, 2024
1 parent ac3af73 commit ad0f785
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 20 deletions.
7 changes: 0 additions & 7 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand All @@ -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)
Expand Down Expand Up @@ -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)))

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include <unistd.h>

#ifdef USE_FAST_FLOAT
#include "../deps/fast_float/fast_float_strtod.h"
#include "fast_float/fast_float_strtod.h"
#endif

#ifdef HAVE_BACKTRACE
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cerrno>

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/resp_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/t_zset.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#include <math.h>

#ifdef USE_FAST_FLOAT
#include "../deps/fast_float/fast_float_strtod.h"
#include "fast_float/fast_float_strtod.h"
#endif

/*-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/valkey-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ad0f785

Please sign in to comment.