< prev index next >

src/hotspot/share/utilities/exceptions.hpp

Print this page




 220 
 221 #define CHECK                                    THREAD); if (HAS_PENDING_EXCEPTION) return       ; (void)(0
 222 #define CHECK_(result)                           THREAD); if (HAS_PENDING_EXCEPTION) return result; (void)(0
 223 #define CHECK_0                                  CHECK_(0)
 224 #define CHECK_NH                                 CHECK_(Handle())
 225 #define CHECK_NULL                               CHECK_(NULL)
 226 #define CHECK_false                              CHECK_(false)
 227 #define CHECK_JNI_ERR                            CHECK_(JNI_ERR)
 228 
 229 #define CHECK_AND_CLEAR                         THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; return;        } (void)(0
 230 #define CHECK_AND_CLEAR_(result)                THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; return result; } (void)(0
 231 #define CHECK_AND_CLEAR_0                       CHECK_AND_CLEAR_(0)
 232 #define CHECK_AND_CLEAR_NH                      CHECK_AND_CLEAR_(Handle())
 233 #define CHECK_AND_CLEAR_NULL                    CHECK_AND_CLEAR_(NULL)
 234 #define CHECK_AND_CLEAR_false                   CHECK_AND_CLEAR_(false)
 235 
 236 // The THROW... macros should be used to throw an exception. They require a THREAD variable to be
 237 // visible within the scope containing the THROW. Usually this is achieved by declaring the function
 238 // with a TRAPS argument.
 239 
 240 #ifdef THIS_FILE
 241 #define THREAD_AND_LOCATION                      THREAD, THIS_FILE, __LINE__
 242 #else
 243 #define THREAD_AND_LOCATION                      THREAD, __FILE__, __LINE__
 244 #endif

 245 
 246 #define THROW_OOP(e)                                \
 247   { Exceptions::_throw_oop(THREAD_AND_LOCATION, e);                             return;  }
 248 
 249 #define THROW_HANDLE(e)                                \
 250   { Exceptions::_throw(THREAD_AND_LOCATION, e);                             return;  }
 251 
 252 #define THROW(name)                                 \
 253   { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, NULL); return;  }
 254 
 255 #define THROW_MSG(name, message)                    \
 256   { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, message); return;  }
 257 
 258 #define THROW_CAUSE(name, cause)   \
 259   { Exceptions::_throw_cause(THREAD_AND_LOCATION, name, cause); return; }
 260 
 261 #define THROW_MSG_LOADER(name, message, loader, protection_domain) \
 262   { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, message, loader, protection_domain); return;  }
 263 
 264 #define THROW_ARG(name, signature, args) \




 220 
 221 #define CHECK                                    THREAD); if (HAS_PENDING_EXCEPTION) return       ; (void)(0
 222 #define CHECK_(result)                           THREAD); if (HAS_PENDING_EXCEPTION) return result; (void)(0
 223 #define CHECK_0                                  CHECK_(0)
 224 #define CHECK_NH                                 CHECK_(Handle())
 225 #define CHECK_NULL                               CHECK_(NULL)
 226 #define CHECK_false                              CHECK_(false)
 227 #define CHECK_JNI_ERR                            CHECK_(JNI_ERR)
 228 
 229 #define CHECK_AND_CLEAR                         THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; return;        } (void)(0
 230 #define CHECK_AND_CLEAR_(result)                THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; return result; } (void)(0
 231 #define CHECK_AND_CLEAR_0                       CHECK_AND_CLEAR_(0)
 232 #define CHECK_AND_CLEAR_NH                      CHECK_AND_CLEAR_(Handle())
 233 #define CHECK_AND_CLEAR_NULL                    CHECK_AND_CLEAR_(NULL)
 234 #define CHECK_AND_CLEAR_false                   CHECK_AND_CLEAR_(false)
 235 
 236 // The THROW... macros should be used to throw an exception. They require a THREAD variable to be
 237 // visible within the scope containing the THROW. Usually this is achieved by declaring the function
 238 // with a TRAPS argument.
 239 
 240 // Extracts just the filename from a file path
 241 inline const char* _simple_basename(const char* s) {
 242   const char* result = strrchr(s, '/');
 243   return (result == NULL) ? s : (result + 1);
 244 }
 245 #define THREAD_AND_LOCATION                      THREAD, _simple_basename(__FILE__), __LINE__
 246 
 247 #define THROW_OOP(e)                                \
 248   { Exceptions::_throw_oop(THREAD_AND_LOCATION, e);                             return;  }
 249 
 250 #define THROW_HANDLE(e)                                \
 251   { Exceptions::_throw(THREAD_AND_LOCATION, e);                             return;  }
 252 
 253 #define THROW(name)                                 \
 254   { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, NULL); return;  }
 255 
 256 #define THROW_MSG(name, message)                    \
 257   { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, message); return;  }
 258 
 259 #define THROW_CAUSE(name, cause)   \
 260   { Exceptions::_throw_cause(THREAD_AND_LOCATION, name, cause); return; }
 261 
 262 #define THROW_MSG_LOADER(name, message, loader, protection_domain) \
 263   { Exceptions::_throw_msg(THREAD_AND_LOCATION, name, message, loader, protection_domain); return;  }
 264 
 265 #define THROW_ARG(name, signature, args) \


< prev index next >