Remove CONFIG_CHECK_JSVALUE build mode (#194)
It doesn't produce a working build and I'm somewhat skeptical that its purported goal of catching reference counting bugs still works.
This commit is contained in:
parent
4c1b9f8c7f
commit
4d57997ee7
1 changed files with 2 additions and 39 deletions
41
quickjs.h
41
quickjs.h
|
@ -86,47 +86,12 @@ typedef struct JSRefCountHeader {
|
||||||
} JSRefCountHeader;
|
} JSRefCountHeader;
|
||||||
|
|
||||||
#define JS_FLOAT64_NAN NAN
|
#define JS_FLOAT64_NAN NAN
|
||||||
|
#define JSValueConst JSValue /* For backwards compatibility. */
|
||||||
|
|
||||||
#ifdef CONFIG_CHECK_JSVALUE
|
#if defined(JS_NAN_BOXING)
|
||||||
/* JSValue consistency : it is not possible to run the code in this
|
|
||||||
mode, but it is useful to detect simple reference counting
|
|
||||||
errors. It would be interesting to modify a static C analyzer to
|
|
||||||
handle specific annotations (clang has such annotations but only
|
|
||||||
for objective C) */
|
|
||||||
typedef struct __JSValue *JSValue;
|
|
||||||
typedef const struct __JSValue *JSValueConst;
|
|
||||||
|
|
||||||
#define JS_VALUE_GET_TAG(v) (int)((uintptr_t)(v) & 0xf)
|
|
||||||
/* same as JS_VALUE_GET_TAG, but return JS_TAG_FLOAT64 with NaN boxing */
|
|
||||||
#define JS_VALUE_GET_NORM_TAG(v) JS_VALUE_GET_TAG(v)
|
|
||||||
#define JS_VALUE_GET_INT(v) (int)((intptr_t)(v) >> 4)
|
|
||||||
#define JS_VALUE_GET_BOOL(v) JS_VALUE_GET_INT(v)
|
|
||||||
#define JS_VALUE_GET_FLOAT64(v) (double)JS_VALUE_GET_INT(v)
|
|
||||||
#define JS_VALUE_GET_PTR(v) (void *)((intptr_t)(v) & ~0xf)
|
|
||||||
|
|
||||||
#define JS_MKVAL(tag, val) (JSValue)(intptr_t)(((val) << 4) | (tag))
|
|
||||||
#define JS_MKPTR(tag, p) (JSValue)((intptr_t)(p) | (tag))
|
|
||||||
|
|
||||||
#define JS_TAG_IS_FLOAT64(tag) ((unsigned)(tag) == JS_TAG_FLOAT64)
|
|
||||||
|
|
||||||
#define JS_NAN JS_MKVAL(JS_TAG_FLOAT64, 1)
|
|
||||||
|
|
||||||
static inline JSValue __JS_NewFloat64(double d)
|
|
||||||
{
|
|
||||||
return JS_MKVAL(JS_TAG_FLOAT64, (int)d);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline JS_BOOL JS_VALUE_IS_NAN(JSValue v)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(JS_NAN_BOXING)
|
|
||||||
|
|
||||||
typedef uint64_t JSValue;
|
typedef uint64_t JSValue;
|
||||||
|
|
||||||
#define JSValueConst JSValue
|
|
||||||
|
|
||||||
#define JS_VALUE_GET_TAG(v) (int)((v) >> 32)
|
#define JS_VALUE_GET_TAG(v) (int)((v) >> 32)
|
||||||
#define JS_VALUE_GET_INT(v) (int)(v)
|
#define JS_VALUE_GET_INT(v) (int)(v)
|
||||||
#define JS_VALUE_GET_BOOL(v) (int)(v)
|
#define JS_VALUE_GET_BOOL(v) (int)(v)
|
||||||
|
@ -199,8 +164,6 @@ typedef struct JSValue {
|
||||||
int64_t tag;
|
int64_t tag;
|
||||||
} JSValue;
|
} JSValue;
|
||||||
|
|
||||||
#define JSValueConst JSValue
|
|
||||||
|
|
||||||
#define JS_VALUE_GET_TAG(v) ((int32_t)(v).tag)
|
#define JS_VALUE_GET_TAG(v) ((int32_t)(v).tag)
|
||||||
/* same as JS_VALUE_GET_TAG, but return JS_TAG_FLOAT64 with NaN boxing */
|
/* same as JS_VALUE_GET_TAG, but return JS_TAG_FLOAT64 with NaN boxing */
|
||||||
#define JS_VALUE_GET_NORM_TAG(v) JS_VALUE_GET_TAG(v)
|
#define JS_VALUE_GET_NORM_TAG(v) JS_VALUE_GET_TAG(v)
|
||||||
|
|
Loading…
Reference in a new issue