Lines Matching refs:exception
9 // This file implements the "Exception Handling APIs"
17 #include <exception> // for std::terminate
60 // Get the exception object from the unwind pointer.
62 // front of the user's exception object
98 static inline int incrementHandlerCount(__cxa_exception *exception) {
99 return ++exception->handlerCount;
103 static inline int decrementHandlerCount(__cxa_exception *exception) {
104 return --exception->handlerCount;
124 exc is called, and then the memory for the exception is deallocated.
135 // Just in case there exists a dependent exception that is pointing to this,
142 // * For purposes of this ABI, several things are considered exception handlers:
155 // Reserve "thrown_size" bytes on the end for the user's exception
158 // user's exception object.
189 // It does not affect the reference count of the primary exception.
195 // 2.4.3 Throwing the Exception Object
197 After constructing the exception object with the throw argument value,
203 * Obtain the __cxa_exception header from the thrown exception object address,
214 pointer to the thrown exception, which __cxa_throw itself received as an argument.
219 exception.
233 exception_header->referenceCount = 1; // This is a newly allocated exception, no need for thread safety.
248 // 2.5.3 Exception Handlers
251 and saved in the exception header (either __cxa_exception or
254 Requires: exception is native
295 // chain the foreign exception, terminate it.
357 This routine can catch foreign or native exceptions. If native, the exception
359 ignorant of whether the native exception is primary or dependent.
361 If the exception is native:
362 * Increment's the exception's handler count.
363 * Push the exception on the stack of currently-caught exceptions if it is not
366 * Returns the adjusted pointer to the exception object, which is stored in
369 If the exception is foreign, this means it did not originate from one of throw
370 routines. The foreign exception does not necessarily have a __cxa_exception
373 * Do not try to increment the exception's handler count, we don't know where
375 * Push the exception on the stack of currently-caught exceptions only if the
376 stack is empty. The foreign exception has no way to link to the current
379 __cxa_exception block in front of the foreign exception. It would be better
384 * If we haven't terminated, assume the exception object is just past the
393 // exception_header is a hackish offset from a foreign exception, but it
406 // place the exception on the top of the stack if it's not already
420 // Else this is a foreign exception
424 // Push the foreign exception on to the stack
434 This routine can be called for either a native or foreign exception.
435 For a native exception:
436 * Locates the most recently caught exception and decrements its handler count.
437 * Removes the exception from the caught exception stack, if the handler count goes to zero.
438 * If the handler count goes down to zero, and the exception was not re-thrown
439 by throw, it locates the primary exception (which may be the same as the one
441 goes to zero, the function destroys the exception. In any case, if the current
442 exception is a dependent exception, it destroys that.
444 For a foreign exception:
446 * Otherwise delete the exception and pop the catch stack to empty.
463 // If we've rethrown a foreign exception, then globals->caughtExceptions
471 // This is a native exception
474 // The exception has been rethrown by __cxa_rethrow, so don't delete it
482 // that need to be told that this exception is rethrown. Don't
483 // erase this rethrow flag until the exception is recaught.
487 // The native exception has not been rethrown
492 // Destroy this exception, being careful to distinguish
496 // Reset exception_header to primaryException and deallocate the dependent exception
503 // Destroy the primary exception only if its referenceCount goes to 0
511 // The foreign exception has not been rethrown. Pop the stack
513 // to touch a foreign exception in any way, that is undefined
515 // a foreign exception is with catch (...)!
526 // get the current exception
532 return NULL; // No current exception
540 If the exception is native:
541 * marks the exception object on top of the caughtExceptions stack
557 std::terminate(); // throw; called outside of a exception handler
561 // Mark the exception as being rethrown (reverse the effects of __cxa_begin_catch)
564 // __cxa_end_catch will remove this exception from the caughtExceptions stack if necessary
566 else // this is a foreign exception
569 // a foreign exception, so don't delete us, is to pop the stack here
587 // Foreign exception: can't get exception_header->terminateHandler
596 Requires: If thrown_object is not NULL, it is a native exception.
612 deallocate the exception.
614 Requires: If thrown_object is not NULL, it is a native exception.
633 caughtExceptions stack. Atomically increment the exception's referenceCount.
639 the need to allocate the exception-handling globals.
644 // get the current exception
647 return NULL; // If there are no globals, there is no exception
650 return NULL; // No current exception
652 return NULL; // Can't capture a foreign exception (no way to refcount it)
666 primary exception is decremented, destroying the primary if necessary.
667 Finally the dependent exception is destroyed.
683 exception.