235 #define CHECK_AND_CLEAR_0 CHECK_AND_CLEAR_(0)
236 #define CHECK_AND_CLEAR_NH CHECK_AND_CLEAR_(Handle())
237 #define CHECK_AND_CLEAR_NULL CHECK_AND_CLEAR_(nullptr)
238 #define CHECK_AND_CLEAR_false CHECK_AND_CLEAR_(false)
239
240 // CAUTION: These macros clears all exceptions except probable async exceptions j.l.InternalError.
241 // So use it with caution.
242 #define CLEAR_PENDING_NONASYNC_EXCEPTION (((ThreadShadow*)THREAD)->clear_pending_nonasync_exception())
243 #define CHECK_AND_CLEAR_NONASYNC THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_NONASYNC_EXCEPTION; return; } (void)(0
244 #define CHECK_AND_CLEAR_NONASYNC_(result) THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_NONASYNC_EXCEPTION; return result; } (void)(0
245 #define CHECK_AND_CLEAR_NONASYNC_0 CHECK_AND_CLEAR_NONASYNC_(0)
246 #define CHECK_AND_CLEAR_NONASYNC_NH CHECK_AND_CLEAR_NONASYNC_(Handle())
247 #define CHECK_AND_CLEAR_NONASYNC_NULL CHECK_AND_CLEAR_NONASYNC_(nullptr)
248 #define CHECK_AND_CLEAR_NONASYNC_false CHECK_AND_CLEAR_NONASYNC_(false)
249
250 // The THROW... macros should be used to throw an exception. They require a THREAD variable to be
251 // visible within the scope containing the THROW. Usually this is achieved by declaring the function
252 // with a TRAPS argument.
253
254 #define THREAD_AND_LOCATION THREAD, __FILE__, __LINE__
255
256 #define THROW_OOP(e) \
257 { Exceptions::_throw_oop(THREAD_AND_LOCATION, e); return; }
258
259 #define THROW_HANDLE(e) \
260 { Exceptions::_throw(THREAD_AND_LOCATION, e); return; }
261
262 #define THROW(name) \
263 { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, nullptr); return; }
264
265 #define THROW_MSG(name, message) \
266 { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, message); return; }
267
268 #define THROW_CAUSE(name, cause) \
269 { Exceptions::_throw_cause(THREAD_AND_LOCATION, name, cause); return; }
270
271 #define THROW_MSG_LOADER(name, message, loader, protection_domain) \
272 { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, message, loader, protection_domain); return; }
273
274 #define THROW_ARG(name, signature, args) \
|
235 #define CHECK_AND_CLEAR_0 CHECK_AND_CLEAR_(0)
236 #define CHECK_AND_CLEAR_NH CHECK_AND_CLEAR_(Handle())
237 #define CHECK_AND_CLEAR_NULL CHECK_AND_CLEAR_(nullptr)
238 #define CHECK_AND_CLEAR_false CHECK_AND_CLEAR_(false)
239
240 // CAUTION: These macros clears all exceptions except probable async exceptions j.l.InternalError.
241 // So use it with caution.
242 #define CLEAR_PENDING_NONASYNC_EXCEPTION (((ThreadShadow*)THREAD)->clear_pending_nonasync_exception())
243 #define CHECK_AND_CLEAR_NONASYNC THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_NONASYNC_EXCEPTION; return; } (void)(0
244 #define CHECK_AND_CLEAR_NONASYNC_(result) THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_NONASYNC_EXCEPTION; return result; } (void)(0
245 #define CHECK_AND_CLEAR_NONASYNC_0 CHECK_AND_CLEAR_NONASYNC_(0)
246 #define CHECK_AND_CLEAR_NONASYNC_NH CHECK_AND_CLEAR_NONASYNC_(Handle())
247 #define CHECK_AND_CLEAR_NONASYNC_NULL CHECK_AND_CLEAR_NONASYNC_(nullptr)
248 #define CHECK_AND_CLEAR_NONASYNC_false CHECK_AND_CLEAR_NONASYNC_(false)
249
250 // The THROW... macros should be used to throw an exception. They require a THREAD variable to be
251 // visible within the scope containing the THROW. Usually this is achieved by declaring the function
252 // with a TRAPS argument.
253
254 #define THREAD_AND_LOCATION THREAD, __FILE__, __LINE__
255 #define THREAD_AND_LOCATION_DECL TRAPS, const char* file, int line
256 #define THREAD_AND_LOCATION_ARGS THREAD, file, line
257
258 #define THROW_OOP(e) \
259 { Exceptions::_throw_oop(THREAD_AND_LOCATION, e); return; }
260
261 #define THROW_HANDLE(e) \
262 { Exceptions::_throw(THREAD_AND_LOCATION, e); return; }
263
264 #define THROW(name) \
265 { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, nullptr); return; }
266
267 #define THROW_MSG(name, message) \
268 { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, message); return; }
269
270 #define THROW_CAUSE(name, cause) \
271 { Exceptions::_throw_cause(THREAD_AND_LOCATION, name, cause); return; }
272
273 #define THROW_MSG_LOADER(name, message, loader, protection_domain) \
274 { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, message, loader, protection_domain); return; }
275
276 #define THROW_ARG(name, signature, args) \
|