don't call pic_panic on internal logic flaw

This commit is contained in:
Yuichi Nishiwaki 2016-02-21 19:02:23 +09:00
parent 54301ce98c
commit f8b05efa7f
4 changed files with 7 additions and 33 deletions

View File

@ -219,11 +219,7 @@ pic_socket_socket_recv(pic_state *pic)
ensure_socket_is_open(pic, sock);
buf = pic_blob(pic, pic_blob_value(pic, NULL, size), NULL);
if (buf == NULL && size > 0) {
/* XXX: Is it really OK? */
pic_panic(pic, "memory exhausted");
}
buf = pic_alloca(pic, size);
errno = 0;
do {

View File

@ -403,16 +403,8 @@ gc_mark_object(pic_state *pic, struct pic_object *obj)
}
break;
}
case PIC_TYPE_NIL:
case PIC_TYPE_TRUE:
case PIC_TYPE_FALSE:
case PIC_TYPE_FLOAT:
case PIC_TYPE_INT:
case PIC_TYPE_CHAR:
case PIC_TYPE_EOF:
case PIC_TYPE_UNDEF:
case PIC_TYPE_INVALID:
pic_panic(pic, "logic flaw");
default:
PIC_UNREACHABLE();
}
}
@ -574,16 +566,8 @@ gc_finalize_object(pic_state *pic, struct pic_object *obj)
case PIC_TYPE_CP:
break;
case PIC_TYPE_NIL:
case PIC_TYPE_TRUE:
case PIC_TYPE_FALSE:
case PIC_TYPE_FLOAT:
case PIC_TYPE_INT:
case PIC_TYPE_CHAR:
case PIC_TYPE_EOF:
case PIC_TYPE_UNDEF:
case PIC_TYPE_INVALID:
pic_panic(pic, "logic flaw");
default:
PIC_UNREACHABLE();
}
}

View File

@ -178,13 +178,7 @@ pic_init_core(pic_state *pic)
pic_defun(pic, "features", pic_features);
pic_try {
pic_load_cstr(pic, &pic_boot[0][0]);
}
pic_catch {
pic_print_backtrace(pic, xstdout);
pic_panic(pic, "");
}
pic_load_cstr(pic, &pic_boot[0][0]);
}
pic_state *

View File

@ -17,7 +17,7 @@ var_get(pic_state *pic, pic_value var)
return pic_weak_ref(pic, weak, var);
}
}
pic_panic(pic, "logic flaw");
PIC_UNREACHABLE();
}
static pic_value