mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-26 22:50:48 +00:00
Update to the latest quickjs-ng, so we dont need to ship custom patches ##r2js
This commit is contained in:
parent
4bfc474729
commit
eeebe83420
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -499,7 +499,7 @@ jobs:
|
||||
# cmd '/c call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" "x86_64"'
|
||||
bash sys/source_bat.bash 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat' "x86_64"
|
||||
# meson_options: --default-library=shared|static -Dstatic_runtime=true --backend vs2019
|
||||
meson --buildtype=release --prefix=$PWD\radare2-${{ steps.r2v.outputs.branch }}-w64 build
|
||||
meson --buildtype=release --prefix=$PWD\radare2-${{ steps.r2v.outputs.branch }}-w64 -Dc_std=c11 build
|
||||
ninja -C build -j 1
|
||||
ninja -C build install
|
||||
- name: Create zip artifact
|
||||
|
@ -1,7 +1,7 @@
|
||||
@echo off
|
||||
REM call preconfigure.bat
|
||||
|
||||
set MESON_FLAGS=-Dsdb_cgen=false
|
||||
set MESON_FLAGS=-Dsdb_cgen=false -Dc_std=c11
|
||||
|
||||
if "%*" == "asan" (
|
||||
set MESON_FLAGS=%MESON_FLAGS% -Dwasan=true
|
||||
|
@ -1,5 +1,6 @@
|
||||
include deps.mk
|
||||
|
||||
QJS_BRANCH?=quickjs-ng
|
||||
USE_MINIFY=0
|
||||
USE_UGLIFY=0
|
||||
|
||||
|
@ -44,6 +44,10 @@ endif
|
||||
|
||||
all: $(QJS)
|
||||
|
||||
fuzz:
|
||||
clang -g -O1 -fsanitize=address,undefined,fuzzer -o fuzz fuzz.c
|
||||
./fuzz
|
||||
|
||||
$(BUILD_DIR):
|
||||
cmake -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
|
||||
|
||||
@ -80,15 +84,7 @@ stats: $(QJS)
|
||||
$(QJS) -qd
|
||||
|
||||
test: $(QJS)
|
||||
$(QJS) tests/test_bigint.js
|
||||
$(QJS) tests/test_closure.js
|
||||
$(QJS) tests/test_language.js
|
||||
$(QJS) tests/test_builtin.js
|
||||
$(QJS) tests/test_loop.js
|
||||
$(QJS) tests/test_std.js
|
||||
$(QJS) tests/test_worker.js
|
||||
$(QJS) tests/test_queue_microtask.js
|
||||
$(QJS) tests/test_module_detect.js
|
||||
$(RUN262) -c tests.conf
|
||||
|
||||
testconv: $(BUILD_DIR)/test_conv
|
||||
$(BUILD_DIR)/test_conv
|
||||
@ -100,7 +96,7 @@ test262-fast: $(QJS)
|
||||
$(RUN262) -m -c test262.conf -c test262-fast.conf -a
|
||||
|
||||
test262-update: $(QJS)
|
||||
$(RUN262) -u -c test262.conf -a
|
||||
$(RUN262) -u -c test262.conf -a -t 1
|
||||
|
||||
test262-check: $(QJS)
|
||||
$(RUN262) -m -c test262.conf -E -a
|
||||
@ -114,4 +110,4 @@ unicode_gen: $(BUILD_DIR)
|
||||
libunicode-table.h: unicode_gen
|
||||
$(BUILD_DIR)/unicode_gen unicode $@
|
||||
|
||||
.PHONY: all debug install clean codegen distclean stats test test262 test262-update test262-check microbench unicode_gen $(QJS) $(QJSC)
|
||||
.PHONY: all debug fuzz install clean codegen distclean stats test test262 test262-update test262-check microbench unicode_gen $(QJS) $(QJSC)
|
||||
|
@ -246,7 +246,7 @@ size_t utf8_encode_len(uint32_t c)
|
||||
No null byte is stored after the encoded bytes.
|
||||
Return value is in range 1..4
|
||||
*/
|
||||
size_t utf8_encode(uint8_t *buf, uint32_t c)
|
||||
size_t utf8_encode(uint8_t buf[minimum_length(UTF8_CHAR_LEN_MAX)], uint32_t c)
|
||||
{
|
||||
if (c < 0x80) {
|
||||
buf[0] = c;
|
||||
@ -1129,7 +1129,7 @@ void rqsort(void *base, size_t nmemb, size_t size, cmp_f cmp, void *opaque)
|
||||
|
||||
/*---- Portable time functions ----*/
|
||||
|
||||
#if __MINGW32__ || defined(_MSC_VER)
|
||||
#ifdef _WIN32
|
||||
// From: https://stackoverflow.com/a/26085827
|
||||
static int gettimeofday_msvc(struct timeval *tp, struct timezone *tzp)
|
||||
{
|
||||
@ -1184,7 +1184,7 @@ uint64_t js__hrtime_ns(void) {
|
||||
|
||||
int64_t js__gettimeofday_us(void) {
|
||||
struct timeval tv;
|
||||
#if defined(_MSC_VER)
|
||||
#ifdef _WIN32
|
||||
gettimeofday_msvc(&tv, NULL);
|
||||
#else
|
||||
gettimeofday(&tv, NULL);
|
||||
|
@ -96,11 +96,6 @@ static void *__builtin_frame_address(unsigned int level) {
|
||||
#define NEG_INF (-1.0/0.0)
|
||||
#endif
|
||||
|
||||
#define xglue(x, y) x ## y
|
||||
#define glue(x, y) xglue(x, y)
|
||||
#define stringify(s) tostring(s)
|
||||
#define tostring(s) #s
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(type, field) ((size_t) &((type *)0)->field)
|
||||
#endif
|
||||
@ -115,10 +110,10 @@ static void *__builtin_frame_address(unsigned int level) {
|
||||
#define container_of(ptr, type, member) ((type *)((uint8_t *)(ptr) - offsetof(type, member)))
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#define minimum_length(n) static n
|
||||
#if defined(_MSC_VER)
|
||||
#define minimum_length(n) n
|
||||
#else
|
||||
#define minimum_length(n) n
|
||||
#define minimum_length(n) static n
|
||||
#endif
|
||||
|
||||
typedef int BOOL;
|
||||
@ -486,7 +481,7 @@ enum {
|
||||
};
|
||||
int utf8_scan(const char *buf, size_t len, size_t *plen);
|
||||
size_t utf8_encode_len(uint32_t c);
|
||||
size_t utf8_encode(uint8_t *buf, uint32_t c);
|
||||
size_t utf8_encode(uint8_t buf[minimum_length(UTF8_CHAR_LEN_MAX)], uint32_t c);
|
||||
uint32_t utf8_decode_len(const uint8_t *p, size_t max_len, const uint8_t **pp);
|
||||
uint32_t utf8_decode(const uint8_t *p, const uint8_t **pp);
|
||||
size_t utf8_decode_buf8(uint8_t *dest, size_t dest_len, const char *src, size_t src_len);
|
||||
|
@ -1710,6 +1710,13 @@ static int __bf_div(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec,
|
||||
slimb_t d;
|
||||
|
||||
na = n + nb;
|
||||
|
||||
#if LIMB_LOG2_BITS == 6
|
||||
if (na >= (SIZE_MAX / sizeof(limb_t)) - 1) {
|
||||
return BF_ST_MEM_ERROR; /* Return memory error status */
|
||||
}
|
||||
#endif
|
||||
|
||||
taba = bf_malloc(s, (na + 1) * sizeof(limb_t));
|
||||
if (!taba)
|
||||
goto fail;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -87,10 +87,6 @@ enum {
|
||||
/* any larger tag is FLOAT64 if JS_NAN_BOXING */
|
||||
};
|
||||
|
||||
typedef struct JSRefCountHeader {
|
||||
int ref_count;
|
||||
} JSRefCountHeader;
|
||||
|
||||
#define JS_FLOAT64_NAN NAN
|
||||
#define JSValueConst JSValue /* For backwards compatibility. */
|
||||
|
||||
@ -291,6 +287,11 @@ typedef struct JSMallocFunctions {
|
||||
size_t (*js_malloc_usable_size)(const void *ptr);
|
||||
} JSMallocFunctions;
|
||||
|
||||
// Finalizers run in LIFO order at the very end of JS_FreeRuntime.
|
||||
// Intended for cleanup of associated resources; the runtime itself
|
||||
// is no longer usable.
|
||||
typedef void JSRuntimeFinalizer(JSRuntime *rt, void *arg);
|
||||
|
||||
typedef struct JSGCObjectHeader JSGCObjectHeader;
|
||||
|
||||
JS_EXTERN JSRuntime *JS_NewRuntime(void);
|
||||
@ -310,6 +311,8 @@ JS_EXTERN JSRuntime *JS_NewRuntime2(const JSMallocFunctions *mf, void *opaque);
|
||||
JS_EXTERN void JS_FreeRuntime(JSRuntime *rt);
|
||||
JS_EXTERN void *JS_GetRuntimeOpaque(JSRuntime *rt);
|
||||
JS_EXTERN void JS_SetRuntimeOpaque(JSRuntime *rt, void *opaque);
|
||||
JS_EXTERN int JS_AddRuntimeFinalizer(JSRuntime *rt,
|
||||
JSRuntimeFinalizer *finalizer, void *arg);
|
||||
typedef void JS_MarkFunc(JSRuntime *rt, JSGCObjectHeader *gp);
|
||||
JS_EXTERN void JS_MarkValue(JSRuntime *rt, JSValue val, JS_MarkFunc *mark_func);
|
||||
JS_EXTERN void JS_RunGC(JSRuntime *rt);
|
||||
@ -323,6 +326,7 @@ JS_EXTERN void JS_SetContextOpaque(JSContext *ctx, void *opaque);
|
||||
JS_EXTERN JSRuntime *JS_GetRuntime(JSContext *ctx);
|
||||
JS_EXTERN void JS_SetClassProto(JSContext *ctx, JSClassID class_id, JSValue obj);
|
||||
JS_EXTERN JSValue JS_GetClassProto(JSContext *ctx, JSClassID class_id);
|
||||
JS_EXTERN JSValue JS_GetFunctionProto(JSContext *ctx);
|
||||
|
||||
/* the following functions are used to select the intrinsic object to
|
||||
save memory */
|
||||
@ -589,46 +593,10 @@ JS_EXTERN JSValue __js_printf_like(2, 3) JS_ThrowReferenceError(JSContext *ctx,
|
||||
JS_EXTERN JSValue __js_printf_like(2, 3) JS_ThrowRangeError(JSContext *ctx, const char *fmt, ...);
|
||||
JS_EXTERN JSValue __js_printf_like(2, 3) JS_ThrowInternalError(JSContext *ctx, const char *fmt, ...);
|
||||
JS_EXTERN JSValue JS_ThrowOutOfMemory(JSContext *ctx);
|
||||
|
||||
JS_EXTERN void __JS_FreeValue(JSContext *ctx, JSValue v);
|
||||
static inline void JS_FreeValue(JSContext *ctx, JSValue v)
|
||||
{
|
||||
if (JS_VALUE_HAS_REF_COUNT(v)) {
|
||||
JSRefCountHeader *p = (JSRefCountHeader *)JS_VALUE_GET_PTR(v);
|
||||
if (--p->ref_count <= 0) {
|
||||
__JS_FreeValue(ctx, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
JS_EXTERN void __JS_FreeValueRT(JSRuntime *rt, JSValue v);
|
||||
static inline void JS_FreeValueRT(JSRuntime *rt, JSValue v)
|
||||
{
|
||||
if (JS_VALUE_HAS_REF_COUNT(v)) {
|
||||
JSRefCountHeader *p = (JSRefCountHeader *)JS_VALUE_GET_PTR(v);
|
||||
if (--p->ref_count <= 0) {
|
||||
__JS_FreeValueRT(rt, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline JSValue JS_DupValue(JSContext *ctx, JSValue v)
|
||||
{
|
||||
if (JS_VALUE_HAS_REF_COUNT(v)) {
|
||||
JSRefCountHeader *p = (JSRefCountHeader *)JS_VALUE_GET_PTR(v);
|
||||
p->ref_count++;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline JSValue JS_DupValueRT(JSRuntime *rt, JSValue v)
|
||||
{
|
||||
if (JS_VALUE_HAS_REF_COUNT(v)) {
|
||||
JSRefCountHeader *p = (JSRefCountHeader *)JS_VALUE_GET_PTR(v);
|
||||
p->ref_count++;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
JS_EXTERN void JS_FreeValue(JSContext *ctx, JSValue v);
|
||||
JS_EXTERN void JS_FreeValueRT(JSRuntime *rt, JSValue v);
|
||||
JS_EXTERN JSValue JS_DupValue(JSContext *ctx, JSValue v);
|
||||
JS_EXTERN JSValue JS_DupValueRT(JSRuntime *rt, JSValue v);
|
||||
JS_EXTERN int JS_ToBool(JSContext *ctx, JSValue val); /* return -1 for JS_EXCEPTION */
|
||||
JS_EXTERN int JS_ToInt32(JSContext *ctx, int32_t *pres, JSValue val);
|
||||
static inline int JS_ToUint32(JSContext *ctx, uint32_t *pres, JSValue val)
|
||||
@ -725,6 +693,12 @@ JS_EXTERN JSValue JS_CallConstructor(JSContext *ctx, JSValue func_obj,
|
||||
JS_EXTERN JSValue JS_CallConstructor2(JSContext *ctx, JSValue func_obj,
|
||||
JSValue new_target,
|
||||
int argc, JSValue *argv);
|
||||
/* Try to detect if the input is a module. Returns TRUE if parsing the input
|
||||
* as a module produces no syntax errors. It's a naive approach that is not
|
||||
* wholly infallible: non-strict classic scripts may _parse_ okay as a module
|
||||
* but not _execute_ as one (different runtime semantics.) Use with caution.
|
||||
* |input| can be either ASCII or UTF-8 encoded source code.
|
||||
*/
|
||||
JS_EXTERN JS_BOOL JS_DetectModule(const char *input, size_t input_len);
|
||||
/* 'input' must be zero terminated i.e. input[input_len] = '\0'. */
|
||||
JS_EXTERN JSValue JS_Eval(JSContext *ctx, const char *input, size_t input_len,
|
||||
|
Loading…
Reference in New Issue
Block a user