| parrotcode: Exceptions | |
| Contents | C |

src/exceptions.c - Exceptions

Define the internal interpreter exceptions.
enum_class of the Exception isn't fixed.
PARROT_API PARROT_DOES_NOT_RETURN void internal_exception(int exitcode, NOTNULL(const char *format), ...)Parrot_exit to invoke exit handlers and exit the process with the given exitcode.
No error handlers are used,
so it is not possible for Parrot bytecode to intercept a fatal error (cf.
real_exception).
Furthermore,
no stack unwinding is done,
so the exit handlers run in the current dynamic environment.PARROT_DOES_NOT_RETURN void do_panic(NULLOK_INTERP, NULLOK(const char *message), NULLOK(const char *file), unsigned int line)PARROT_API void push_exception(PARROT_INTERP, NOTNULL(PMC *handler))static void run_cleanup_action(PARROT_INTERP, NOTNULL(Stack_Entry_t *e))PARROT_API void Parrot_push_action(PARROT_INTERP, PMC *sub)PARROT_API void Parrot_push_mark(PARROT_INTERP, INTVAL mark)PARROT_API void Parrot_pop_mark(PARROT_INTERP, INTVAL mark)PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL static PMC *find_exception_handler(PARROT_INTERP, NOTNULL(PMC *exception))exception.PARROT_WARN_UNUSED_RESULT INTVAL count_exception_handlers(PARROT_INTERP)PARROT_WARN_UNUSED_RESULT PMC *get_exception_handler(PARROT_INTERP, INTVAL target_depth)PARROT_WARN_UNUSED_RESULT PMC *get_all_exception_handlers(PARROT_INTERP)PARROT_API void pop_exception(PARROT_INTERP)PARROT_API PARROT_WARN_UNUSED_RESULT PMC *new_c_exception_handler(PARROT_INTERP, Parrot_exception *jb)PARROT_API void push_new_c_exception_handler(PARROT_INTERP, Parrot_exception *jb)PARROT_API PARROT_CAN_RETURN_NULL opcode_t *throw_exception(PARROT_INTERP, PMC *exception, SHIM(void *dest))PARROT_API PARROT_WARN_UNUSED_RESULT opcode_t *rethrow_exception(PARROT_INTERP, NOTNULL(PMC *exception))PARROT_DOES_NOT_RETURN void rethrow_c_exception(PARROT_INTERP)new_c_exception.PARROT_WARN_UNUSED_RESULT static size_t dest2offset(PARROT_INTERP, NOTNULL(const opcode_t *dest))PARROT_WARN_UNUSED_RESULT static opcode_t *create_exception(PARROT_INTERP)PARROT_API size_t handle_exception(PARROT_INTERP)PARROT_API void new_internal_exception(PARROT_INTERP)PARROT_API void free_internal_exception(PARROT_INTERP)void destroy_exception_list(PARROT_INTERP)void really_destroy_exception_list(NULLOK(Parrot_exception *e))PARROT_API PARROT_DOES_NOT_RETURN void do_exception(PARROT_INTERP, INTVAL severity, long error)longjmp in front of the runloop,
which calls handle_exception(),
returning the handler address where execution then resumes. the_exception->error = error;
the_exception->severity = severity;
the_exception->msg = NULL;
the_exception->resume = NULL;
longjmp(the_exception->destination, 1);
}
PARROT_API PARROT_DOES_NOT_RETURN void real_exception(PARROT_INTERP, NULLOK(void *ret_addr), int exitcode, NOTNULL(const char *format), ...)ret_addr is the address from which to resume, if some handler decides that is appropriate, or zero to make the error non-resumable. exitcode is a exception_type_enum value.internal_exception(), which signals fatal errors, and throw_exception, which calls the handler.void Parrot_init_exceptions(PARROT_INTERP)PARROT_API PARROT_DOES_NOT_RETURN void Parrot_confess(NOTNULL(const char *cond), NOTNULL(const char *file), unsigned int line)void Parrot_print_backtrace(void)
include/parrot/exceptions.h.
|
|
|