fix array gc bug; new gc error chasing
This commit is contained in:
@@ -815,12 +815,10 @@ JSValue JS_CallRegisterVM(JSContext *ctx, JSCodeRegister *code,
|
||||
ctx->reg_current_frame = frame_ref.val;
|
||||
ctx->current_register_pc = pc > 0 ? pc - 1 : 0;
|
||||
int op = MACH_GET_OP(instr);
|
||||
/* trace disabled */
|
||||
int a = MACH_GET_A(instr);
|
||||
int b = MACH_GET_B(instr);
|
||||
int c = MACH_GET_C(instr);
|
||||
|
||||
|
||||
switch (op) {
|
||||
case MACH_NOP:
|
||||
break;
|
||||
@@ -1139,7 +1137,19 @@ JSValue JS_CallRegisterVM(JSContext *ctx, JSCodeRegister *code,
|
||||
env = fn->u.reg.env_record;
|
||||
pc = ret_info >> 16;
|
||||
int ret_slot = ret_info & 0xFFFF;
|
||||
if (ret_slot != 0xFFFF) frame->slots[ret_slot] = result;
|
||||
if (ret_slot != 0xFFFF) {
|
||||
#ifdef VALIDATE_GC
|
||||
if (JS_IsPtr(result)) {
|
||||
void *rp = JS_VALUE_GET_PTR(result);
|
||||
if ((uint8_t *)rp < ctx->heap_base || (uint8_t *)rp >= ctx->heap_free) {
|
||||
if (!is_ct_ptr(ctx, rp))
|
||||
fprintf(stderr, "VALIDATE_GC: stale RETURN into slot %d, ptr=%p heap=[%p,%p) fn_slots=%d pc=%u\n",
|
||||
ret_slot, rp, (void*)ctx->heap_base, (void*)ctx->heap_free, code->nr_slots, pc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
frame->slots[ret_slot] = result;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1603,6 +1613,16 @@ JSValue JS_CallRegisterVM(JSContext *ctx, JSCodeRegister *code,
|
||||
frame = (JSFrameRegister *)JS_VALUE_GET_PTR(frame_ref.val);
|
||||
ctx->reg_current_frame = JS_NULL;
|
||||
if (JS_IsException(ret)) goto disrupt;
|
||||
#ifdef VALIDATE_GC
|
||||
if (JS_IsPtr(ret)) {
|
||||
void *rp = JS_VALUE_GET_PTR(ret);
|
||||
if ((uint8_t *)rp < ctx->heap_base || (uint8_t *)rp >= ctx->heap_free) {
|
||||
if (!is_ct_ptr(ctx, rp))
|
||||
fprintf(stderr, "VALIDATE_GC: stale INVOKE result into slot %d, ptr=%p heap=[%p,%p) fn_slots=%d pc=%u kind=%d\n",
|
||||
b, rp, (void*)ctx->heap_base, (void*)ctx->heap_free, code->nr_slots, pc - 1, fn->kind);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
frame->slots[b] = ret;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user