From ec3552a155a7b7c5c4143a1d874cb290aa684ccc Mon Sep 17 00:00:00 2001 From: CPunch Date: Mon, 4 Jan 2021 16:20:05 -0600 Subject: [PATCH] organized flags --- src/cmem.h | 2 +- src/cosmo.h | 7 +++++++ src/cvalue.h | 8 ++++---- src/cvm.h | 7 ------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/cmem.h b/src/cmem.h index 616f7fb..7e65b94 100644 --- a/src/cmem.h +++ b/src/cmem.h @@ -26,7 +26,7 @@ cosmoM_reallocate(state, x, sizeof(type), 0) #define cosmoM_isFrozen(state) \ - state->freezeGC > 0 + (state->freezeGC > 0) // if debugging, print the locations of when the state is frozen/unfrozen #ifdef GC_DEBUG diff --git a/src/cosmo.h b/src/cosmo.h index f07f510..4b7db1e 100644 --- a/src/cosmo.h +++ b/src/cosmo.h @@ -9,6 +9,13 @@ #include +/* + SAFE_STACK: + if undefined, the stack will not be checked for stack overflows. This may improve performance, however + this will produce undefined behavior as you reach the stack limit (and may cause a seg fault!). It is recommended to keep this enabled. +*/ +#define SAFE_STACK + //#define NAN_BOXXED #define COSMOASSERT(x) assert(x) diff --git a/src/cvalue.h b/src/cvalue.h index 9d8d001..8ccd4f1 100644 --- a/src/cvalue.h +++ b/src/cvalue.h @@ -45,10 +45,10 @@ typedef union CValue { #define GET_TYPE(x) \ ((((x).data & MASK_QUIETNAN) == MASK_QUIETNAN) ? (((x).data & MASK_TYPE) >> 48) : COSMO_TNUMBER) -static const uint64_t SIG_MASK = (MASK_QUIETNAN | MASK_TYPE); -static const uint64_t BOOL_SIG = (MASK_QUIETNAN | ((uint64_t)(COSMO_TBOOLEAN) << 48)); -static const uint64_t OBJ_SIG = (MASK_QUIETNAN | ((uint64_t)(COSMO_TOBJ) << 48)); -static const uint64_t NIL_SIG = (MASK_QUIETNAN | ((uint64_t)(COSMO_TNIL) << 48)); +#define SIG_MASK (MASK_QUIETNAN | MASK_TYPE) +#define BOOL_SIG (MASK_QUIETNAN | ((uint64_t)(COSMO_TBOOLEAN) << 48)) +#define OBJ_SIG (MASK_QUIETNAN | ((uint64_t)(COSMO_TOBJ) << 48)) +#define NIL_SIG (MASK_QUIETNAN | ((uint64_t)(COSMO_TNIL) << 48)) #define cosmoV_newNumber(x) ((CValue){.num = x}) #define cosmoV_newBoolean(x) ((CValue){.data = MAKE_PAYLOAD(x) | BOOL_SIG}) diff --git a/src/cvm.h b/src/cvm.h index fadd70b..2720922 100644 --- a/src/cvm.h +++ b/src/cvm.h @@ -6,13 +6,6 @@ #include "cosmo.h" #include "cstate.h" -/* - SAFE_STACK: - if undefined, the stack will not be checked for stack overflows. This may improve performance, however - this will produce undefined behavior as you reach the stack limit (and may cause a seg fault!). It is recommended to keep this enabled. -*/ -#define SAFE_STACK - typedef enum { COSMOVM_OK, COSMOVM_RUNTIME_ERR,