< prev index next >

src/hotspot/share/utilities/exceptions.hpp

Print this page

165                               Symbol* signature, JavaCallArguments* args,
166                               Handle cause,
167                               Handle loader);
168 
169   static Handle new_exception(JavaThread* thread, Symbol* name,
170                               Handle cause,
171                               Handle loader,
172                               ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8);
173 
174   static Handle new_exception(JavaThread* thread, Symbol* name,
175                               const char* message, Handle cause,
176                               Handle loader,
177                               ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8);
178 
179   static Handle new_exception(JavaThread* thread, Symbol* name,
180                               const char* message,
181                               ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8);
182 
183   static void throw_stack_overflow_exception(JavaThread* thread, const char* file, int line, const methodHandle& method);
184 


185   static void wrap_dynamic_exception(bool is_indy, JavaThread* thread);
186 
187   // Exception counting of interesting exceptions that may have caused a
188   // problem for the JVM, for reporting in the hs_err file.
189   static void increment_stack_overflow_errors();
190   static bool has_exception_counts();
191   static void count_out_of_memory_exceptions(Handle exception);
192   static void print_exception_counts_on_error(outputStream* st);
193 
194   // for AbortVMOnException flag
195   static void debug_check_abort(Handle exception, const char* message = nullptr);
196   static void debug_check_abort_helper(Handle exception, const char* message = nullptr);
197   static void debug_check_abort(const char *value_string, const char* message = nullptr);
198 
199   // for logging exceptions
200   static void log_exception(Handle exception, const char* message);
201   static void log_exception_stacktrace(Handle exception);
202   static void log_exception_stacktrace(Handle exception, methodHandle method, int bci);
203 };
204 

251 
252 // CAUTION: These macros clears all exceptions except probable async exceptions j.l.InternalError.
253 // So use it with caution.
254 #define CLEAR_PENDING_NONASYNC_EXCEPTION        (((ThreadShadow*)THREAD)->clear_pending_nonasync_exception())
255 #define CHECK_AND_CLEAR_NONASYNC                THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_NONASYNC_EXCEPTION; return; } (void)(0
256 #define CHECK_AND_CLEAR_NONASYNC_(result)       THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_NONASYNC_EXCEPTION; return result; } (void)(0
257 #define CHECK_AND_CLEAR_NONASYNC_0              CHECK_AND_CLEAR_NONASYNC_(0)
258 #define CHECK_AND_CLEAR_NONASYNC_NH             CHECK_AND_CLEAR_NONASYNC_(Handle())
259 #define CHECK_AND_CLEAR_NONASYNC_NULL           CHECK_AND_CLEAR_NONASYNC_(nullptr)
260 #define CHECK_AND_CLEAR_NONASYNC_false          CHECK_AND_CLEAR_NONASYNC_(false)
261 
262 #define CLEAR_PENDING_PREEMPTED_EXCEPTION       (((ThreadShadow*)THREAD)->clear_pending_preempted_exception())
263 #define CHECK_AND_CLEAR_PREEMPTED               THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_PREEMPTED_EXCEPTION; return; } (void)(0
264 
265 
266 // The THROW... macros should be used to throw an exception. They require a THREAD variable to be
267 // visible within the scope containing the THROW. Usually this is achieved by declaring the function
268 // with a TRAPS argument.
269 
270 #define THREAD_AND_LOCATION                      THREAD, __FILE__, __LINE__


271 
272 #define THROW_OOP(e)                                \
273   { Exceptions::_throw_oop(THREAD_AND_LOCATION, e);                             return;  }
274 
275 #define THROW_HANDLE(e)                                \
276   { Exceptions::_throw(THREAD_AND_LOCATION, e);                             return;  }
277 
278 #define THROW(name)                                 \
279   { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, nullptr); return;  }
280 
281 #define THROW_MSG(name, message)                    \
282   { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, message); return;  }
283 
284 #define THROW_CAUSE(name, cause)   \
285   { Exceptions::_throw_cause(THREAD_AND_LOCATION, name, cause); return; }
286 
287 #define THROW_MSG_LOADER(name, message, loader) \
288   { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, message, loader); return;  }
289 
290 #define THROW_ARG(name, signature, args) \

165                               Symbol* signature, JavaCallArguments* args,
166                               Handle cause,
167                               Handle loader);
168 
169   static Handle new_exception(JavaThread* thread, Symbol* name,
170                               Handle cause,
171                               Handle loader,
172                               ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8);
173 
174   static Handle new_exception(JavaThread* thread, Symbol* name,
175                               const char* message, Handle cause,
176                               Handle loader,
177                               ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8);
178 
179   static Handle new_exception(JavaThread* thread, Symbol* name,
180                               const char* message,
181                               ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8);
182 
183   static void throw_stack_overflow_exception(JavaThread* thread, const char* file, int line, const methodHandle& method);
184 
185   static void wrap_exception_in_internal_error(const char* message, JavaThread* thread);
186 
187   static void wrap_dynamic_exception(bool is_indy, JavaThread* thread);
188 
189   // Exception counting of interesting exceptions that may have caused a
190   // problem for the JVM, for reporting in the hs_err file.
191   static void increment_stack_overflow_errors();
192   static bool has_exception_counts();
193   static void count_out_of_memory_exceptions(Handle exception);
194   static void print_exception_counts_on_error(outputStream* st);
195 
196   // for AbortVMOnException flag
197   static void debug_check_abort(Handle exception, const char* message = nullptr);
198   static void debug_check_abort_helper(Handle exception, const char* message = nullptr);
199   static void debug_check_abort(const char *value_string, const char* message = nullptr);
200 
201   // for logging exceptions
202   static void log_exception(Handle exception, const char* message);
203   static void log_exception_stacktrace(Handle exception);
204   static void log_exception_stacktrace(Handle exception, methodHandle method, int bci);
205 };
206 

253 
254 // CAUTION: These macros clears all exceptions except probable async exceptions j.l.InternalError.
255 // So use it with caution.
256 #define CLEAR_PENDING_NONASYNC_EXCEPTION        (((ThreadShadow*)THREAD)->clear_pending_nonasync_exception())
257 #define CHECK_AND_CLEAR_NONASYNC                THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_NONASYNC_EXCEPTION; return; } (void)(0
258 #define CHECK_AND_CLEAR_NONASYNC_(result)       THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_NONASYNC_EXCEPTION; return result; } (void)(0
259 #define CHECK_AND_CLEAR_NONASYNC_0              CHECK_AND_CLEAR_NONASYNC_(0)
260 #define CHECK_AND_CLEAR_NONASYNC_NH             CHECK_AND_CLEAR_NONASYNC_(Handle())
261 #define CHECK_AND_CLEAR_NONASYNC_NULL           CHECK_AND_CLEAR_NONASYNC_(nullptr)
262 #define CHECK_AND_CLEAR_NONASYNC_false          CHECK_AND_CLEAR_NONASYNC_(false)
263 
264 #define CLEAR_PENDING_PREEMPTED_EXCEPTION       (((ThreadShadow*)THREAD)->clear_pending_preempted_exception())
265 #define CHECK_AND_CLEAR_PREEMPTED               THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_PREEMPTED_EXCEPTION; return; } (void)(0
266 
267 
268 // The THROW... macros should be used to throw an exception. They require a THREAD variable to be
269 // visible within the scope containing the THROW. Usually this is achieved by declaring the function
270 // with a TRAPS argument.
271 
272 #define THREAD_AND_LOCATION                      THREAD, __FILE__, __LINE__
273 #define THREAD_AND_LOCATION_DECL                 TRAPS, const char* file, int line
274 #define THREAD_AND_LOCATION_ARGS                 THREAD, file, line
275 
276 #define THROW_OOP(e)                                \
277   { Exceptions::_throw_oop(THREAD_AND_LOCATION, e);                             return;  }
278 
279 #define THROW_HANDLE(e)                                \
280   { Exceptions::_throw(THREAD_AND_LOCATION, e);                             return;  }
281 
282 #define THROW(name)                                 \
283   { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, nullptr); return;  }
284 
285 #define THROW_MSG(name, message)                    \
286   { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, message); return;  }
287 
288 #define THROW_CAUSE(name, cause)   \
289   { Exceptions::_throw_cause(THREAD_AND_LOCATION, name, cause); return; }
290 
291 #define THROW_MSG_LOADER(name, message, loader) \
292   { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, message, loader); return;  }
293 
294 #define THROW_ARG(name, signature, args) \
< prev index next >