diff --git a/src/duk_api.c b/src/duk_api.c index deb6ff0c75..cb2a5c5e54 100644 --- a/src/duk_api.c +++ b/src/duk_api.c @@ -281,7 +281,7 @@ static int resize_valstack(duk_context *ctx, size_t new_size) { */ new_alloc_size = sizeof(duk_tval) * new_size; - new_valstack = DUK_REALLOC_INDIRECT(thr->heap, (void **) &thr->valstack, new_alloc_size); + new_valstack = (duk_tval *) DUK_REALLOC_INDIRECT(thr->heap, (void **) &thr->valstack, new_alloc_size); if (!new_valstack) { DUK_DPRINT("failed to resize valstack to %d entries (%d bytes)", new_size, new_alloc_size); @@ -445,7 +445,7 @@ static int check_valstack_resize_helper(duk_context *ctx, DUK_DDPRINT("valstack resize failed"); if (throw_flag) { - DUK_ERROR(ctx, DUK_ERR_ALLOC_ERROR, "failed to extend valstack"); + DUK_ERROR(thr, DUK_ERR_ALLOC_ERROR, "failed to extend valstack"); } else { return 0; } @@ -2320,7 +2320,7 @@ const char *duk_push_string_file(duk_context *ctx, const char *path) { if (fseek(f, 0, SEEK_SET) < 0) { goto fail; } - buf = duk_push_fixed_buffer(ctx, sz); + buf = (char *) duk_push_fixed_buffer(ctx, sz); DUK_ASSERT(buf != NULL); if (fread(buf, 1, sz, f) != sz) { goto fail; @@ -2567,7 +2567,7 @@ const char *duk_push_vsprintf(duk_context *ctx, const char *fmt, va_list ap) { } /* FIXME: buffer to string */ - res = duk_push_lstring(ctx, buf, len); /* [buf res] */ + res = duk_push_lstring(ctx, (const char *) buf, (size_t) len); /* [buf res] */ duk_remove(ctx, -2); return res; } diff --git a/src/duk_api_buffer.c b/src/duk_api_buffer.c index b4cd4d7194..0205233ac8 100644 --- a/src/duk_api_buffer.c +++ b/src/duk_api_buffer.c @@ -36,7 +36,7 @@ void duk_to_fixed_buffer(duk_context *ctx, int index) { } size = DUK_HBUFFER_GET_SIZE(h_src); - data = duk_push_fixed_buffer(ctx, size); + data = (char *) duk_push_fixed_buffer(ctx, size); if (size > 0) { DUK_ASSERT(data != NULL); DUK_MEMCPY(data, DUK_HBUFFER_DYNAMIC_GET_CURR_DATA_PTR(h_src), size); diff --git a/src/duk_api_call.c b/src/duk_api_call.c index 2ae43db350..d9d72e58f0 100644 --- a/src/duk_api_call.c +++ b/src/duk_api_call.c @@ -95,7 +95,7 @@ void duk_call(duk_context *ctx, int nargs) { idx_func = duk_get_top(ctx) - nargs - 1; /* must work for nargs <= 0 */ if (idx_func < 0 || nargs < 0) { /* note that we can't reliably pop anything here */ - DUK_ERROR(ctx, DUK_ERR_API_ERROR, "invalid call args"); + DUK_ERROR(thr, DUK_ERR_API_ERROR, "invalid call args"); } /* awkward; we assume there is space for this */ @@ -126,7 +126,7 @@ void duk_call_method(duk_context *ctx, int nargs) { idx_func = duk_get_top(ctx) - nargs - 2; /* must work for nargs <= 0 */ if (idx_func < 0 || nargs < 0) { /* note that we can't reliably pop anything here */ - DUK_ERROR(ctx, DUK_ERR_API_ERROR, "invalid call args"); + DUK_ERROR(thr, DUK_ERR_API_ERROR, "invalid call args"); } errhandler = thr->heap->lj.errhandler; /* use existing one (if any) */ @@ -168,7 +168,7 @@ int duk_pcall(duk_context *ctx, int nargs, int errhandler_index) { idx_func = duk_get_top(ctx) - nargs - 1; /* must work for nargs <= 0 */ if (idx_func < 0 || nargs < 0) { /* note that we can't reliably pop anything here */ - DUK_ERROR(ctx, DUK_ERR_API_ERROR, "invalid call args"); + DUK_ERROR(thr, DUK_ERR_API_ERROR, "invalid call args"); /* FIXME: actually terminate thread? */ return DUK_ERR_EXEC_TERM; } diff --git a/src/duk_api_codec.c b/src/duk_api_codec.c index 98b51d8e90..7e642c9478 100644 --- a/src/duk_api_codec.c +++ b/src/duk_api_codec.c @@ -184,7 +184,7 @@ const char *duk_base64_encode(duk_context *ctx, int index) { goto type_error; } dstlen = (srclen + 2) / 3 * 4; - dst = duk_push_fixed_buffer(ctx, dstlen); + dst = (unsigned char *) duk_push_fixed_buffer(ctx, dstlen); base64_encode_helper((const unsigned char *) src, (const unsigned char *) (src + srclen), (unsigned char *) dst, (unsigned char *) (dst + dstlen)); @@ -223,7 +223,7 @@ void duk_base64_decode(duk_context *ctx, int index) { goto type_error; } dstlen = (srclen + 3) / 4 * 3; /* upper limit */ - dst = duk_push_dynamic_buffer(ctx, dstlen); + dst = (unsigned char *) duk_push_dynamic_buffer(ctx, dstlen); /* Note: for dstlen=0, dst may be NULL */ retval = base64_decode_helper((unsigned char *) src, (unsigned char *) (src + srclen), @@ -252,7 +252,7 @@ const char *duk_hex_encode(duk_context *ctx, int index) { /* FIXME: special case for input string, no need to coerce to buffer */ index = duk_require_normalize_index(ctx, index); - data = duk_to_buffer(ctx, index, &len); + data = (unsigned char *) duk_to_buffer(ctx, index, &len); DUK_ASSERT(data != NULL); buf = (unsigned char *) duk_push_fixed_buffer(ctx, len * 2); diff --git a/src/duk_api_string.c b/src/duk_api_string.c index a742dd5ffd..da0950a5dd 100644 --- a/src/duk_api_string.c +++ b/src/duk_api_string.c @@ -35,7 +35,7 @@ static void concat_and_join_helper(duk_context *ctx, int count, int is_join) { DUK_DDDPRINT("join/concat %d strings, total length %d bytes", count, len); /* use stack allocated buffer to ensure reachability in errors (e.g. intern error) */ - buf = duk_push_fixed_buffer(ctx, len); + buf = (duk_u8 *) duk_push_fixed_buffer(ctx, len); DUK_ASSERT(buf != NULL); /* [... (sep) str1 str2 ... strN buf] */ diff --git a/src/duk_builtin_boolean.c b/src/duk_builtin_boolean.c index 913df83407..1dc71f1833 100644 --- a/src/duk_builtin_boolean.c +++ b/src/duk_builtin_boolean.c @@ -43,18 +43,18 @@ static int tostring_valueof_helper(duk_context *ctx, int coerce_tostring) { } int duk_builtin_boolean_constructor(duk_context *ctx) { - duk_hobject *this; + duk_hobject *h_this; duk_to_boolean(ctx, 0); if (duk_is_constructor_call(ctx)) { /* FIXME: helper; rely on Boolean.prototype as being non-writable, non-configurable */ duk_push_this(ctx); - this = duk_get_hobject(ctx, -1); - DUK_ASSERT(this != NULL); - DUK_ASSERT(this->prototype == ((duk_hthread *) ctx)->builtins[DUK_BIDX_BOOLEAN_PROTOTYPE]); + h_this = duk_get_hobject(ctx, -1); + DUK_ASSERT(h_this != NULL); + DUK_ASSERT(h_this->prototype == ((duk_hthread *) ctx)->builtins[DUK_BIDX_BOOLEAN_PROTOTYPE]); - DUK_HOBJECT_SET_CLASS_NUMBER(this, DUK_HOBJECT_CLASS_BOOLEAN); + DUK_HOBJECT_SET_CLASS_NUMBER(h_this, DUK_HOBJECT_CLASS_BOOLEAN); duk_dup(ctx, 0); /* -> [ val obj val ] */ duk_def_prop_stridx(ctx, -2, DUK_STRIDX_INT_VALUE, DUK_PROPDESC_FLAGS_NONE); /* FIXME: proper flags? */ diff --git a/src/duk_builtin_global.c b/src/duk_builtin_global.c index b44379dcad..1b07d956e3 100644 --- a/src/duk_builtin_global.c +++ b/src/duk_builtin_global.c @@ -638,7 +638,7 @@ static int print_alert_helper(duk_context *ctx, FILE *f_out) { if (nargs == 1 && duk_is_buffer(ctx, 0)) { const char *buf = NULL; size_t sz = 0; - buf = duk_get_buffer(ctx, 0, &sz); + buf = (const char *) duk_get_buffer(ctx, 0, &sz); if (buf && sz > 0) { fwrite(buf, 1, sz, f_out); } diff --git a/src/duk_builtin_json.c b/src/duk_builtin_json.c index 82f9132a8d..ebccb862e2 100644 --- a/src/duk_builtin_json.c +++ b/src/duk_builtin_json.c @@ -28,7 +28,7 @@ static void json_dec_reviver_walk(duk_json_dec_ctx *js_ctx); static void json_emit_1(duk_json_enc_ctx *js_ctx, char ch); static void json_emit_2(duk_json_enc_ctx *js_ctx, int chars); -static void json_emit_esc(duk_json_enc_ctx *js_ctx, duk_u32 cp, char *esc_str, int digits); +static void json_emit_esc(duk_json_enc_ctx *js_ctx, duk_u32 cp, const char *esc_str, int digits); static void json_emit_esc16(duk_json_enc_ctx *js_ctx, duk_u32 cp); static void json_emit_esc32(duk_json_enc_ctx *js_ctx, duk_u32 cp); static void json_emit_xutf8(duk_json_enc_ctx *js_ctx, duk_u32 cp); @@ -630,7 +630,7 @@ static void json_emit_2(duk_json_enc_ctx *js_ctx, int chars) { duk_hbuffer_append_bytes(js_ctx->thr, js_ctx->h_buf, (duk_u8 *) buf, 2); } -static void json_emit_esc(duk_json_enc_ctx *js_ctx, duk_u32 cp, char *esc_str, int digits) { +static void json_emit_esc(duk_json_enc_ctx *js_ctx, duk_u32 cp, const char *esc_str, int digits) { int dig; duk_hbuffer_append_cstring(js_ctx->thr, js_ctx->h_buf, esc_str); diff --git a/src/duk_builtin_string.c b/src/duk_builtin_string.c index d7d807ccbe..82647637e6 100644 --- a/src/duk_builtin_string.c +++ b/src/duk_builtin_string.c @@ -880,7 +880,7 @@ int duk_builtin_string_prototype_split(duk_context *ctx) { if (is_regexp) { duk_dup(ctx, 0); duk_dup(ctx, 2); - duk_regexp_match_force_global(ctx); /* [ ... regexp input ] -> [ res_obj ] */ + duk_regexp_match_force_global(thr); /* [ ... regexp input ] -> [ res_obj ] */ if (!duk_is_object(ctx, -1)) { duk_pop(ctx); break; diff --git a/src/duk_debug.h b/src/duk_debug.h index 13f3906d14..33e05e0af5 100644 --- a/src/duk_debug.h +++ b/src/duk_debug.h @@ -173,7 +173,7 @@ extern void duk_debug_log(char *fmt, ...); void duk_fb_put_bytes(duk_fixedbuffer *fb, duk_u8 *buffer, duk_u32 length); void duk_fb_put_byte(duk_fixedbuffer *fb, duk_u8 x); -void duk_fb_put_cstring(duk_fixedbuffer *fb, char *x); +void duk_fb_put_cstring(duk_fixedbuffer *fb, const char *x); void duk_fb_sprintf(duk_fixedbuffer *fb, const char *fmt, ...); int duk_fb_is_full(duk_fixedbuffer *fb); diff --git a/src/duk_debug_fixedbuffer.c b/src/duk_debug_fixedbuffer.c index 21c5dcea2f..105408f19a 100644 --- a/src/duk_debug_fixedbuffer.c +++ b/src/duk_debug_fixedbuffer.c @@ -25,7 +25,7 @@ void duk_fb_put_byte(duk_fixedbuffer *fb, duk_u8 x) { duk_fb_put_bytes(fb, &x, 1); } -void duk_fb_put_cstring(duk_fixedbuffer *fb, char *x) { +void duk_fb_put_cstring(duk_fixedbuffer *fb, const char *x) { duk_fb_put_bytes(fb, (duk_u8 *) x, (duk_u32) strlen(x)); } diff --git a/src/duk_debug_macros.c b/src/duk_debug_macros.c index db15105ace..2d5147dffc 100644 --- a/src/duk_debug_macros.c +++ b/src/duk_debug_macros.c @@ -124,6 +124,7 @@ int duk_debug_level_stash; void duk_debug_log(char *fmt, ...) { va_list ap; + int level = duk_debug_level_stash; va_start(ap, fmt); diff --git a/src/duk_debug_vsnprintf.c b/src/duk_debug_vsnprintf.c index fad03481e3..bdb31aacd8 100644 --- a/src/duk_debug_vsnprintf.c +++ b/src/duk_debug_vsnprintf.c @@ -611,7 +611,7 @@ static void print_hbuffer(duk_dprint_state *st, duk_hbuffer *h) { if (st->hexdump) { duk_fb_sprintf(fb, "=["); n = DUK_HBUFFER_GET_SIZE(h); - p = DUK_HBUFFER_GET_DATA_PTR(h); + p = (duk_u8 *) DUK_HBUFFER_GET_DATA_PTR(h); for (i = 0; i < n; i++) { duk_fb_sprintf(fb, "%02x", (int) p[i]); } diff --git a/src/duk_features.h b/src/duk_features.h index 3f6baea39d..c8401b3d5f 100644 --- a/src/duk_features.h +++ b/src/duk_features.h @@ -67,14 +67,16 @@ /* XXX: more accurate detection of what gcc versions work; more inline * asm versions for other compilers. */ -#if defined(__GNUC__) && defined(__i386__) +#if defined(__GNUC__) && defined(__i386__) && \ + !defined(__cplusplus) /* unsigned long long not standard */ static __inline__ unsigned long long duk_rdtsc(void) { unsigned long long int x; __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)); return x; } #define DUK_RDTSC_AVAILABLE 1 -#elif defined(__GNUC__) && defined(__x86_64__) +#elif defined(__GNUC__) && defined(__x86_64__) && \ + !defined(__cplusplus) /* unsigned long long not standard */ static __inline__ unsigned long long duk_rdtsc(void) { unsigned hi, lo; __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); @@ -122,10 +124,16 @@ static __inline__ unsigned long long duk_rdtsc(void) { */ #if defined(__linux) +#ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200809L +#endif +#ifndef _GNU_SOURCE #define _GNU_SOURCE /* e.g. getdate_r */ +#endif +#ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE /* e.g. strptime */ #endif +#endif #if defined(__APPLE__) /* Apple OSX */ diff --git a/src/duk_hbuffer_alloc.c b/src/duk_hbuffer_alloc.c index 0c9f176fbb..c188f55442 100644 --- a/src/duk_hbuffer_alloc.c +++ b/src/duk_hbuffer_alloc.c @@ -17,7 +17,7 @@ duk_hbuffer *duk_hbuffer_alloc(duk_heap *heap, size_t size, int dynamic) { alloc_size = sizeof(duk_hbuffer_fixed) + size + 1; /* +1 for a safety nul term */ } - res = DUK_ALLOC(heap, alloc_size); + res = (duk_hbuffer *) DUK_ALLOC(heap, alloc_size); if (!res) { goto error; } diff --git a/src/duk_heap_alloc.c b/src/duk_heap_alloc.c index 1bf231c3f6..28af0f5140 100644 --- a/src/duk_heap_alloc.c +++ b/src/duk_heap_alloc.c @@ -346,7 +346,7 @@ duk_heap *duk_heap_alloc(duk_alloc_function alloc_func, #endif /* use a raw call, all macros expect the heap to be initialized */ - res = alloc_func(alloc_udata, sizeof(duk_heap)); + res = (duk_heap *) alloc_func(alloc_udata, sizeof(duk_heap)); if (!res) { goto error; } diff --git a/src/duk_heap_stringtable.c b/src/duk_heap_stringtable.c index 03a6e5331a..26bb77e21a 100644 --- a/src/duk_heap_stringtable.c +++ b/src/duk_heap_stringtable.c @@ -28,7 +28,7 @@ static duk_hstring *alloc_init_hstring(duk_heap *heap, /* NUL terminate for convenient C access */ alloc_size = sizeof(duk_hstring) + blen + 1; - res = DUK_ALLOC(heap, alloc_size); + res = (duk_hstring *) DUK_ALLOC(heap, alloc_size); if (!res) { goto error; } diff --git a/src/duk_hobject_alloc.c b/src/duk_hobject_alloc.c index 9ea8573c4c..7966b49269 100644 --- a/src/duk_hobject_alloc.c +++ b/src/duk_hobject_alloc.c @@ -48,7 +48,7 @@ duk_hobject *duk_hobject_alloc(duk_heap *heap, int hobject_flags) { DUK_ASSERT((hobject_flags & DUK_HOBJECT_FLAG_NATIVEFUNCTION) == 0); DUK_ASSERT((hobject_flags & DUK_HOBJECT_FLAG_THREAD) == 0); - res = DUK_ALLOC(heap, sizeof(duk_hobject)); + res = (duk_hobject *) DUK_ALLOC(heap, sizeof(duk_hobject)); if (!res) { return NULL; } @@ -62,7 +62,7 @@ duk_hobject *duk_hobject_alloc(duk_heap *heap, int hobject_flags) { duk_hcompiledfunction *duk_hcompiledfunction_alloc(duk_heap *heap, int hobject_flags) { duk_hcompiledfunction *res; - res = DUK_ALLOC(heap, sizeof(duk_hcompiledfunction)); + res = (duk_hcompiledfunction *) DUK_ALLOC(heap, sizeof(duk_hcompiledfunction)); if (!res) { return NULL; } @@ -82,7 +82,7 @@ duk_hcompiledfunction *duk_hcompiledfunction_alloc(duk_heap *heap, int hobject_f duk_hnativefunction *duk_hnativefunction_alloc(duk_heap *heap, int hobject_flags) { duk_hnativefunction *res; - res = DUK_ALLOC(heap, sizeof(duk_hnativefunction)); + res = (duk_hnativefunction *) DUK_ALLOC(heap, sizeof(duk_hnativefunction)); if (!res) { return NULL; } @@ -108,7 +108,7 @@ duk_hnativefunction *duk_hnativefunction_alloc(duk_heap *heap, int hobject_flags duk_hthread *duk_hthread_alloc(duk_heap *heap, int hobject_flags) { duk_hthread *res; - res = DUK_ALLOC(heap, sizeof(duk_hthread)); + res = (duk_hthread *) DUK_ALLOC(heap, sizeof(duk_hthread)); if (!res) { return NULL; } diff --git a/src/duk_hobject_props.c b/src/duk_hobject_props.c index c22d292eaa..fc0fd84304 100644 --- a/src/duk_hobject_props.c +++ b/src/duk_hobject_props.c @@ -376,7 +376,7 @@ static void realloc_props(duk_hthread *thr, * allocation later. */ - new_p = duk_push_dynamic_buffer(ctx, new_alloc_size); /* errors out if out of memory */ + new_p = (duk_u8 *) duk_push_dynamic_buffer(ctx, new_alloc_size); /* errors out if out of memory */ DUK_ASSERT(new_p != NULL); /* since new_alloc_size > 0 */ } diff --git a/src/duk_hthread_alloc.c b/src/duk_hthread_alloc.c index 29791f161f..86ea268382 100644 --- a/src/duk_hthread_alloc.c +++ b/src/duk_hthread_alloc.c @@ -25,7 +25,7 @@ int duk_hthread_init_stacks(duk_heap *heap, duk_hthread *thr) { /* valstack */ alloc_size = sizeof(duk_tval) * DUK_VALSTACK_INITIAL_SIZE; - thr->valstack = DUK_ALLOC(heap, alloc_size); + thr->valstack = (duk_tval *) DUK_ALLOC(heap, alloc_size); if (!thr->valstack) { goto fail; } @@ -40,7 +40,7 @@ int duk_hthread_init_stacks(duk_heap *heap, duk_hthread *thr) { /* callstack */ alloc_size = sizeof(duk_activation) * DUK_CALLSTACK_INITIAL_SIZE; - thr->callstack = DUK_ALLOC(heap, alloc_size); + thr->callstack = (duk_activation *) DUK_ALLOC(heap, alloc_size); if (!thr->callstack) { goto fail; } @@ -50,7 +50,7 @@ int duk_hthread_init_stacks(duk_heap *heap, duk_hthread *thr) { /* catchstack */ alloc_size = sizeof(duk_catcher) * DUK_CATCHSTACK_INITIAL_SIZE; - thr->catchstack = DUK_ALLOC(heap, alloc_size); + thr->catchstack = (duk_catcher *) DUK_ALLOC(heap, alloc_size); if (!thr->catchstack) { goto fail; } diff --git a/src/duk_hthread_stacks.c b/src/duk_hthread_stacks.c index 3a652331a7..78bc4b5deb 100644 --- a/src/duk_hthread_stacks.c +++ b/src/duk_hthread_stacks.c @@ -50,7 +50,7 @@ void duk_hthread_callstack_grow(duk_hthread *thr) { * pointer may be changed by mark-and-sweep. */ - thr->callstack = DUK_REALLOC_INDIRECT_CHECKED(thr, (void **) &thr->callstack, sizeof(duk_activation) * new_size); + thr->callstack = (duk_activation *) DUK_REALLOC_INDIRECT_CHECKED(thr, (void **) &thr->callstack, sizeof(duk_activation) * new_size); thr->callstack_size = new_size; /* note: any entries above the callstack top are garbage and not zeroed */ @@ -269,7 +269,7 @@ void duk_hthread_catchstack_grow(duk_hthread *thr) { * pointer may be changed by mark-and-sweep. */ - thr->catchstack = DUK_REALLOC_INDIRECT_CHECKED(thr, (void **) &thr->catchstack, sizeof(duk_catcher) * new_size); + thr->catchstack = (duk_catcher *) DUK_REALLOC_INDIRECT_CHECKED(thr, (void **) &thr->catchstack, sizeof(duk_catcher) * new_size); thr->catchstack_size = new_size; /* note: any entries above the catchstack top are garbage and not zeroed */ diff --git a/src/duk_js_call.c b/src/duk_js_call.c index 10ed2bcb0f..fd352e7993 100644 --- a/src/duk_js_call.c +++ b/src/duk_js_call.c @@ -817,7 +817,7 @@ int duk_handle_call(duk_hthread *thr, */ if (!duk_is_callable(thr, idx_func)) { - DUK_ERROR(ctx, DUK_ERR_TYPE_ERROR, "call target not callable"); + DUK_ERROR(thr, DUK_ERR_TYPE_ERROR, "call target not callable"); } func = duk_get_hobject(thr, idx_func); DUK_ASSERT(func != NULL); @@ -1732,7 +1732,7 @@ void duk_handle_ecma_call_setup(duk_hthread *thr, */ if (!duk_is_callable(thr, idx_func)) { - DUK_ERROR(ctx, DUK_ERR_TYPE_ERROR, "call target not callable"); + DUK_ERROR(thr, DUK_ERR_TYPE_ERROR, "call target not callable"); } func = duk_get_hobject(thr, idx_func); DUK_ASSERT(func != NULL); diff --git a/src/duk_js_executor.c b/src/duk_js_executor.c index e0ce97ac07..60cfea30d2 100644 --- a/src/duk_js_executor.c +++ b/src/duk_js_executor.c @@ -1231,7 +1231,7 @@ static int handle_longjmp(duk_hthread *thr, return retval; convert_to_internal_error: - DUK_ERROR((duk_context *) thr, DUK_ERR_INTERNAL_ERROR, "internal error in bytecode executor longjmp handler"); + DUK_ERROR(thr, DUK_ERR_INTERNAL_ERROR, "internal error in bytecode executor longjmp handler"); #if 0 /* FIXME: could also handle internally */ thr->heap->lj.type = DUK_LJ_TYPE_THROW; @@ -1769,7 +1769,7 @@ void duk_js_execute_bytecode(duk_hthread *entry_thread) { duk_push_tval(ctx, REGCONSTP(c)); duk_push_tval(ctx, REGCONSTP(b)); /* -> [ ... escaped_source bytecode ] */ - duk_regexp_create_instance(ctx); /* -> [ ... regexp_instance ] */ + duk_regexp_create_instance(thr); /* -> [ ... regexp_instance ] */ DUK_DDDPRINT("regexp instance: %!iT", duk_get_tval(ctx, -1)); duk_replace(ctx, a); #else