proper handling of runtime errors

This commit is contained in:
CismonX 2020-06-22 01:05:36 +08:00
parent 87b0135875
commit d92a036663
No known key found for this signature in database
GPG Key ID: 315D6652268C5007
2 changed files with 1 additions and 4 deletions

View File

@ -283,9 +283,6 @@ u6a_runtime_execute(FILE* restrict istream, FILE* restrict ostream) {
VM_JMP(0x03);
case u6a_vf_c:
cont = u6a_vm_stack_save(&stack_ctx);
if (UNLIKELY(cont == NULL)) {
goto runtime_error;
}
STACK_PUSH2(VM_VAR_JMP, vm_var_fn_addref(arg));
ACC_FN_REF(u6a_vf_c1, POOL_ALLOC2_PTR(cont, ins));
VM_JMP(0x03);

View File

@ -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);
if (UNLIKELY(dup_stack == NULL)) {
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));
dup_stack->refcnt = 0;