19#define POLAR_STRING_BANNER_RUNTIME_ERROR "** FATAL ** runtime error ***\n"
23POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
24_polar_runtime_error_assertion_failed_default(
const char *expr_text,
const char *expr_source, intptr_t idx_expr )
26 polar_error_printf( POLAR_STRING_BANNER_DEBUG,
"%s: %D: assertion failed: %s",
27 expr_source, idx_expr, expr_text );
32POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
33_polar_runtime_error_class_missing_default(
const char *name_class_missing )
35 polar_error_printf( POLAR_STRING_BANNER_RUNTIME_ERROR,
"%s: unknown class name",
41POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
42_polar_runtime_error_exception_invalid_throw_default(
const char *name_exception_source, intptr_t idx_exception_source )
44 polar_error_printf( POLAR_STRING_BANNER_RUNTIME_ERROR,
"%s: %D: invalid @throw() statement",
45 name_exception_source, idx_exception_source );
50POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
51_polar_runtime_error_exception_unhandled_default(
id inst_exception_unhandled )
53 polar_error_printf( POLAR_STRING_BANNER_RUNTIME_ERROR,
"%o: unhandled exception",
54 inst_exception_unhandled );
59POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
60_polar_runtime_error_foreach_enum_mutated_default(
id inst_collection_mutated )
62 polar_error_printf( POLAR_STRING_BANNER_RUNTIME_ERROR,
63 "%o: collection instance mutated during fast enumeration",
64 inst_collection_mutated );
69POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
70_polar_runtime_error_memory_exhausted_default(
size_t count_bytes_needed )
72 polar_error_printf( POLAR_STRING_BANNER_RUNTIME_ERROR,
73 "virtual memory exhausted; failed to allocate %z bytes",
79POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
80_polar_runtime_error_message_unrecognized_default(
SEL sel_message,
id id_recipient )
82 polar_error_printf( POLAR_STRING_BANNER_RUNTIME_ERROR,
83 "%m: failed to locate method implementation",
84 id_recipient, sel_message );
89POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
90_polar_runtime_error_module_init_failed_default(
struct objc_module *module_failed )
92 polar_error_printf( POLAR_STRING_BANNER_RUNTIME_ERROR,
"%M: module initialization failed",
98POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
99_polar_runtime_error_module_version_mismatch_default(
struct objc_module *module_failed, ulong version_expected )
101 polar_error_printf( POLAR_STRING_BANNER_RUNTIME_ERROR,
102 "%M: module version mismatch; expected %u, got %u",
103 version_expected, module_failed->version_module );
108POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
109_polar_runtime_error_protocol_version_mismatch_default(
struct objc_protocol_static *protocol_failed,
110 uintptr_t version_expected )
112 polar_error_printf( POLAR_STRING_BANNER_RUNTIME_ERROR,
113 "%P: protocol version mismatch; expected %U, got %U",
114 version_expected, protocol_failed->version_protocol );
119POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
120_polar_runtime_error_subsystem_init_failed_default(
const char *name_subsystem_failed )
122 polar_error_printf( POLAR_STRING_BANNER_RUNTIME_ERROR,
"%s: initialization failed",
123 name_subsystem_failed );
128POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
129_polar_runtime_error_thread_operation_failed_default(
const char *str_description )
131 polar_error_printf( POLAR_STRING_BANNER_RUNTIME_ERROR,
"thread operation failed: %s",
137POLAR_FUNCTION_INTERNAL OBJC_NORETURN
void
138_polar_runtime_error_type_init_failed_default(
const char *name_type_failed )
140 polar_error_printf( POLAR_STRING_BANNER_RUNTIME_ERROR,
"%s: type initialization failed",
148 _polar_runtime_error_assertion_failed_default,
149 _polar_runtime_error_class_missing_default,
150 _polar_runtime_error_exception_invalid_throw_default,
151 _polar_runtime_error_exception_unhandled_default,
152 _polar_runtime_error_foreach_enum_mutated_default,
153 _polar_runtime_error_memory_exhausted_default,
154 _polar_runtime_error_message_unrecognized_default,
155 _polar_runtime_error_module_init_failed_default,
156 _polar_runtime_error_module_version_mismatch_default,
157 _polar_runtime_error_protocol_version_mismatch_default,
158 _polar_runtime_error_subsystem_init_failed_default,
159 _polar_runtime_error_thread_operation_failed_default,
160 _polar_runtime_error_type_init_failed_default
172 if( vmt_handlers_new != NULL )
173 result = objc_atomic_exchange_pointer( (
void **)(&POLAR_RUNTIME_ERROR), vmt_handlers_new );
176 result = objc_atomic_exchange_pointer( (
void **)(&POLAR_RUNTIME_ERROR),&polar_runtime_error_handlers_default );
Definition polar-runtime-error.h:25