parrotcode: Exceptions | |
Contents | C |
src/exceptions.c - Exceptions
Define the internal interpreter exceptions.
enum_class
of the Exception isn't fixed.void internal_exception
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.void do_panic
void push_exception
static void run_cleanup_action
void Parrot_push_action
void Parrot_push_mark
void Parrot_pop_mark
static PMC *find_exception_handler
exception
.INTVAL count_exception_handlers
PMC *get_exception_handler
PMC *get_all_exception_handlers
void pop_exception
PMC *new_c_exception_handler
void push_new_c_exception_handler
opcode_t *throw_exception
opcode_t *rethrow_exception
void rethrow_c_exception
new_c_exception
.static size_t dest2offset
static opcode_t *create_exception
size_t handle_exception
void new_internal_exception
void free_internal_exception
void destroy_exception_list
void really_destroy_exception_list
void do_exception
longjmp
in front of the runloop,
which calls handle_exception()
,
returning the handler address where execution then resumes.void do_str_exception
void do_pmc_exception
the_exception->error = E_RuntimeError;
the_exception->severity = EXCEPT_error;
the_exception->msg = msg;
the_exception->resume = NULL;
longjmp(the_exception->destination, 1);
}
the_exception->error = E_RuntimeError;
the_exception->severity = EXCEPT_error;
the_exception->msg = VTABLE_get_string(interp, msg);;
the_exception->resume = NULL;
longjmp(the_exception->destination, 1);
}
the_exception->error = error;
the_exception->severity = severity;
the_exception->msg = NULL;
the_exception->resume = NULL;
longjmp(the_exception->destination, 1);
}
void real_exception
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
void Parrot_confess
void Parrot_print_backtrace
include/parrot/exceptions.h.
|