157 #endif // #ifdef ASSERT 158 159 // guarantee is like assert except it's always executed -- use it for 160 // cheap tests that catch errors that would otherwise be hard to find. 161 // guarantee is also used for Verify options. 162 #define guarantee(p, msg) \ 163 do { \ 164 if (!(p)) { \ 165 report_vm_error(__FILE__, __LINE__, "guarantee(" #p ") failed", msg); \ 166 BREAKPOINT; \ 167 } \ 168 } while (0) 169 170 #define fatal(msg) \ 171 do { \ 172 report_fatal(__FILE__, __LINE__, msg); \ 173 BREAKPOINT; \ 174 } while (0) 175 176 // out of memory 177 #define vm_exit_out_of_memory(size, msg) \ 178 do { \ 179 report_vm_out_of_memory(__FILE__, __LINE__, size, msg); \ 180 BREAKPOINT; \ 181 } while (0) 182 183 #define ShouldNotCallThis() \ 184 do { \ 185 report_should_not_call(__FILE__, __LINE__); \ 186 BREAKPOINT; \ 187 } while (0) 188 189 #define ShouldNotReachHere() \ 190 do { \ 191 report_should_not_reach_here(__FILE__, __LINE__); \ 192 BREAKPOINT; \ 193 } while (0) 194 195 #define Unimplemented() \ 196 do { \ 197 report_unimplemented(__FILE__, __LINE__); \ 198 BREAKPOINT; \ 199 } while (0) 200 201 #define Untested(msg) \ 202 do { \ 203 report_untested(__FILE__, __LINE__, msg); \ 204 BREAKPOINT; \ 205 } while (0); 206 207 // error reporting helper functions 208 void report_vm_error(const char* file, int line, const char* error_msg, 209 const char* detail_msg = NULL); 210 void report_fatal(const char* file, int line, const char* message); 211 void report_vm_out_of_memory(const char* file, int line, size_t size, 212 const char* message); 213 void report_should_not_call(const char* file, int line); 214 void report_should_not_reach_here(const char* file, int line); 215 void report_unimplemented(const char* file, int line); 216 void report_untested(const char* file, int line, const char* message); 217 218 void warning(const char* format, ...); 219 220 // out of shared space reporting 221 enum SharedSpaceType { 222 SharedPermGen, 223 SharedReadOnly, 224 SharedReadWrite, 225 SharedMiscData 226 }; 227 228 void report_out_of_shared_space(SharedSpaceType space_type); 229 230 // out of memory reporting 231 void report_java_out_of_memory(const char* message); 232 | 157 #endif // #ifdef ASSERT 158 159 // guarantee is like assert except it's always executed -- use it for 160 // cheap tests that catch errors that would otherwise be hard to find. 161 // guarantee is also used for Verify options. 162 #define guarantee(p, msg) \ 163 do { \ 164 if (!(p)) { \ 165 report_vm_error(__FILE__, __LINE__, "guarantee(" #p ") failed", msg); \ 166 BREAKPOINT; \ 167 } \ 168 } while (0) 169 170 #define fatal(msg) \ 171 do { \ 172 report_fatal(__FILE__, __LINE__, msg); \ 173 BREAKPOINT; \ 174 } while (0) 175 176 // out of memory 177 #define vm_exit_out_of_memory(size, vm_err_type, msg) \ 178 do { \ 179 report_vm_out_of_memory(__FILE__, __LINE__, size, vm_err_type, msg); \ 180 BREAKPOINT; \ 181 } while (0) 182 183 #define ShouldNotCallThis() \ 184 do { \ 185 report_should_not_call(__FILE__, __LINE__); \ 186 BREAKPOINT; \ 187 } while (0) 188 189 #define ShouldNotReachHere() \ 190 do { \ 191 report_should_not_reach_here(__FILE__, __LINE__); \ 192 BREAKPOINT; \ 193 } while (0) 194 195 #define Unimplemented() \ 196 do { \ 197 report_unimplemented(__FILE__, __LINE__); \ 198 BREAKPOINT; \ 199 } while (0) 200 201 #define Untested(msg) \ 202 do { \ 203 report_untested(__FILE__, __LINE__, msg); \ 204 BREAKPOINT; \ 205 } while (0); 206 207 208 // types of VM error - originally in vmError.hpp 209 enum VMErrorType { 210 INTERNAL_ERROR = 0xe0000000, 211 OOM_MALLOC_ERROR = 0xe0000001, 212 OOM_MMAP_ERROR = 0xe0000002 213 }; 214 215 // error reporting helper functions 216 void report_vm_error(const char* file, int line, const char* error_msg, 217 const char* detail_msg = NULL); 218 void report_fatal(const char* file, int line, const char* message); 219 void report_vm_out_of_memory(const char* file, int line, size_t size, 220 VMErrorType vm_err_type, const char* message); 221 void report_should_not_call(const char* file, int line); 222 void report_should_not_reach_here(const char* file, int line); 223 void report_unimplemented(const char* file, int line); 224 void report_untested(const char* file, int line, const char* message); 225 226 void warning(const char* format, ...); 227 228 // out of shared space reporting 229 enum SharedSpaceType { 230 SharedPermGen, 231 SharedReadOnly, 232 SharedReadWrite, 233 SharedMiscData 234 }; 235 236 void report_out_of_shared_space(SharedSpaceType space_type); 237 238 // out of memory reporting 239 void report_java_out_of_memory(const char* message); 240 |