pub unsafe extern "C" fn jit_exception_builtin(exception_type: c_int)Expand description
This function is called to report a builtin exception. The JIT will automatically embed calls to this function wherever a builtin exception needs to be reported.
When a builtin exception occurs, the current thread’s exception handler is called to construct an appropriate object, which is then thrown.
If there is no exception handler set, or the handler returns NULL, then libjit will print an error message to stderr and cause the program to exit with a status of 1. You normally don’t want this behavior and you should override it if possible.
The following builtin exception types are currently supported:
| Type | Description |
|---|---|
| JIT_RESULT_OK | The operation was performed successfully (value is 1). |
| JIT_RESULT_OVERFLOW | The operation resulted in an overflow exception (value is 0). |
| JIT_RESULT_ARITHMETIC | The operation resulted in an arithmetic exception. i.e. an attempt was made to divide the minimum integer value by -1 (value is -1). |
| JIT_RESULT_DIVISION_BY_ZERO | The operation resulted in a division by zero exception (value is -2). |
| JIT_RESULT_COMPILE_ERROR | An error occurred when attempting to dynamically compile a function (value is -3). |
| JIT_RESULT_OUT_OF_MEMORY | The system ran out of memory while performing an operation (value is -4). |
| JIT_RESULT_NULL_REFERENCE | An attempt was made to dereference a NULL pointer (value is -5). |
| JIT_RESULT_NULL_FUNCTION | An attempt was made to call a function with a NULL function pointer (value is -6). |
| JIT_RESULT_CALLED_NESTED | An attempt was made to call a nested function from a non-nested context (value is -7). |
| JIT_RESULT_OUT_OF_BOUNDS | The operation resulted in an out of bounds array access (value is -8). |
| JIT_RESULT_UNDEFINED_LABEL | A branch operation used a label that was not defined anywhere in the function (value is -9). |