proper handling of runtime errors
This commit is contained in:
parent
87b0135875
commit
d92a036663
|
@ -283,9 +283,6 @@ u6a_runtime_execute(FILE* restrict istream, FILE* restrict ostream) {
|
||||||
VM_JMP(0x03);
|
VM_JMP(0x03);
|
||||||
case u6a_vf_c:
|
case u6a_vf_c:
|
||||||
cont = u6a_vm_stack_save(&stack_ctx);
|
cont = u6a_vm_stack_save(&stack_ctx);
|
||||||
if (UNLIKELY(cont == NULL)) {
|
|
||||||
goto runtime_error;
|
|
||||||
}
|
|
||||||
STACK_PUSH2(VM_VAR_JMP, vm_var_fn_addref(arg));
|
STACK_PUSH2(VM_VAR_JMP, vm_var_fn_addref(arg));
|
||||||
ACC_FN_REF(u6a_vf_c1, POOL_ALLOC2_PTR(cont, ins));
|
ACC_FN_REF(u6a_vf_c1, POOL_ALLOC2_PTR(cont, ins));
|
||||||
VM_JMP(0x03);
|
VM_JMP(0x03);
|
||||||
|
|
|
@ -45,7 +45,7 @@ vm_stack_dup(struct u6a_vm_stack_ctx* ctx, struct u6a_vm_stack* vs) {
|
||||||
struct u6a_vm_stack* dup_stack = malloc(size);
|
struct u6a_vm_stack* dup_stack = malloc(size);
|
||||||
if (UNLIKELY(dup_stack == NULL)) {
|
if (UNLIKELY(dup_stack == NULL)) {
|
||||||
u6a_err_bad_alloc(ctx->err_stage, size);
|
u6a_err_bad_alloc(ctx->err_stage, size);
|
||||||
return NULL;
|
U6A_VM_ERR(ctx);
|
||||||
}
|
}
|
||||||
memcpy(dup_stack, vs, sizeof(struct u6a_vm_stack) + (vs->top + 1) * sizeof(struct u6a_vm_var_fn));
|
memcpy(dup_stack, vs, sizeof(struct u6a_vm_stack) + (vs->top + 1) * sizeof(struct u6a_vm_var_fn));
|
||||||
dup_stack->refcnt = 0;
|
dup_stack->refcnt = 0;
|
||||||
|
|
Loading…
Reference in New Issue