Skip to content

Commit

Permalink
util, spad: spad compile time debug variant overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
ravyu-jump committed Jan 8, 2025
1 parent 73c70a2 commit c59a682
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/extra/with-handholding.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ CPPFLAGS+=-DFD_EQVOC_USE_HANDHOLDING=1
CPPFLAGS+=-DFD_FORKS_USE_HANDHOLDING=1
CPPFLAGS+=-DFD_GHOST_USE_HANDHOLDING=1
CPPFLAGS+=-DFD_SCRATCH_USE_HANDHOLDING=1
CPPFLAGS+=-DFD_SPAD_USE_HANDHOLDING=1
CPPFLAGS+=-DFD_TOWER_USE_HANDHOLDING=1
# CPPFLAGS+=-DFD_TXN_HANDHOLDING=1 # DOES NOT WORK

# CPPFLAGS+=-DFD_TXN_HANDHOLDING=1 # DOES NOT WORK
14 changes: 14 additions & 0 deletions src/util/spad/fd_spad.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#include "fd_spad.h"
#include "../log/fd_log.h"

/* FIXME: better ways to avoid macro definition conflicts? */
#ifdef FD_SPAD_USE_HANDHOLDING
#undef fd_spad_alloc_max
#undef fd_spad_frame_lo
#undef fd_spad_frame_hi
#undef fd_spad_push
#undef fd_spad_pop
#undef fd_spad_alloc
#undef fd_spad_trim
#undef fd_spad_prepare
#undef fd_spad_cancel
#undef fd_spad_publish
#endif

int
fd_spad_verify( fd_spad_t const * spad ) {

Expand Down
22 changes: 22 additions & 0 deletions src/util/spad/fd_spad.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,28 @@ fd_spad_private_frame_end_debug( fd_spad_t ** _spad ) {

#define FD_SPAD_FRAME_END_DEBUG while(0); } while(0)

#ifdef FD_SPAD_USE_HANDHOLDING

#define fd_spad_alloc_max fd_spad_alloc_max_debug
#define fd_spad_frame_lo fd_spad_frame_lo_debug
#define fd_spad_frame_hi fd_spad_frame_hi_debug
#define fd_spad_push fd_spad_push_debug
#define fd_spad_pop fd_spad_pop_debug
#define fd_spad_alloc fd_spad_alloc_debug
#define fd_spad_trim fd_spad_trim_debug
#define fd_spad_prepare fd_spad_prepare_debug
#define fd_spad_cancel fd_spad_cancel_debug
#define fd_spad_publish fd_spad_publish_debug

#undef FD_SPAD_FRAME_BEGIN
#undef FD_SPAD_FRAME_END

#define FD_SPAD_FRAME_BEGIN FD_SPAD_FRAME_BEGIN_DEBUG
#define FD_SPAD_FRAME_END FD_SPAD_FRAME_END_DEBUG

#endif /* FD_SPAD_USE_HANDHOLDING */


/* fd_valloc virtual function table for spad */
extern const fd_valloc_vtable_t fd_spad_vtable;

Expand Down

0 comments on commit c59a682

Please sign in to comment.