Browse Source

proper handling of runtime errors

master
CismonX 1 year ago
parent
commit
d92a036663
No known key found for this signature in database GPG Key ID: 315D6652268C5007
  1. 3
      src/runtime.c
  2. 2
      src/vm_stack.c

3
src/runtime.c

@ -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);

2
src/vm_stack.c

@ -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;

Loading…
Cancel
Save