LCOV - code coverage report
Current view: top level - flamenco/runtime/context - fd_exec_slot_ctx.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 16 28 57.1 %
Date: 2025-09-17 04:38:03 Functions: 2 2 100.0 %

          Line data    Source code
       1             : #include "fd_exec_slot_ctx.h"
       2             : #include "../sysvar/fd_sysvar_epoch_schedule.h"
       3             : 
       4             : #include <assert.h>
       5             : #include <time.h>
       6             : 
       7             : void *
       8           3 : fd_exec_slot_ctx_new( void * mem ) {
       9             : 
      10           3 :   if( FD_UNLIKELY( !mem ) ) {
      11           0 :     FD_LOG_WARNING(( "NULL mem" ));
      12           0 :     return NULL;
      13           0 :   }
      14             : 
      15           3 :   if( FD_UNLIKELY( !fd_ulong_is_aligned( (ulong)mem, FD_EXEC_SLOT_CTX_ALIGN ) ) ) {
      16           0 :     FD_LOG_WARNING(( "misaligned mem" ));
      17           0 :     return NULL;
      18           0 :   }
      19             : 
      20           3 :   fd_memset( mem, 0, sizeof(fd_exec_slot_ctx_t) );
      21             : 
      22           3 :   fd_exec_slot_ctx_t * self = (fd_exec_slot_ctx_t *)mem;
      23             : 
      24           3 :   FD_COMPILER_MFENCE();
      25           3 :   self->magic = FD_EXEC_SLOT_CTX_MAGIC;
      26           3 :   FD_COMPILER_MFENCE();
      27             : 
      28           3 :   return mem;
      29           3 : }
      30             : 
      31             : fd_exec_slot_ctx_t *
      32           3 : fd_exec_slot_ctx_join( void * mem ) {
      33           3 :   if( FD_UNLIKELY( !mem ) ) {
      34           0 :     FD_LOG_WARNING(( "NULL block" ));
      35           0 :     return NULL;
      36           0 :   }
      37             : 
      38           3 :   fd_exec_slot_ctx_t * ctx = (fd_exec_slot_ctx_t *) mem;
      39             : 
      40           3 :   if( FD_UNLIKELY( ctx->magic!=FD_EXEC_SLOT_CTX_MAGIC ) ) {
      41           0 :     FD_LOG_WARNING(( "bad magic" ));
      42           0 :     return NULL;
      43           0 :   }
      44             : 
      45           3 :   return ctx;
      46           3 : }

Generated by: LCOV version 1.14