Home | History | Annotate | Download | only in src

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
293 // chain the foreign exception, terminate it.
355 This routine can catch foreign or native exceptions. If native, the exception
357 ignorant of whether the native exception is primary or dependent.
359 If the exception is native:
360 * Increment's the exception's handler count.
361 * Push the exception on the stack of currently-caught exceptions if it is not
364 * Returns the adjusted pointer to the exception object, which is stored in
367 If the exception is foreign, this means it did not originate from one of throw
368 routines. The foreign exception does not necessarily have a __cxa_exception
371 * Do not try to increment the exception's handler count, we don't know where
373 * Push the exception on the stack of currently-caught exceptions only if the
374 stack is empty. The foreign exception has no way to link to the current
377 __cxa_exception block in front of the foreign exception. It would be better
382 * If we haven't terminated, assume the exception object is just past the
391 // exception_header is a hackish offset from a foreign exception, but it
404 // place the exception on the top of the stack if it's not already
418 // Else this is a foreign exception
422 // Push the foreign exception on to the stack
432 exception.
433 For a native exception:
434 * Locates the most recently caught exception and decrements its handler count.
435 * Removes the exception from the caught exception stack, if the handler count goes to zero.
436 * If the handler count goes down to zero, and the exception was not re-thrown
437 by throw, it locates the primary exception (which may be the same as the one
439 goes to zero, the function destroys the exception. In any case, if the current
440 exception is a dependent exception, it destroys that.
442 For a foreign exception:
444 * Otherwise delete the exception and pop the catch stack to empty.
461 // If we've rethrown a foreign exception, then globals->caughtExceptions
469 // This is a native exception
472 // The exception has been rethrown by __cxa_rethrow, so don't delete it
480 // that need to be told that this exception is rethrown. Don't
481 // erase this rethrow flag until the exception is recaught.
485 // The native exception has not been rethrown
490 // Destroy this exception, being careful to distinguish
494 // Reset exception_header to primaryException and deallocate the dependent exception
501 // Destroy the primary exception only if its referenceCount goes to 0
509 // The foreign exception has not been rethrown. Pop the stack
511 // to touch a foreign exception in any way, that is undefined
513 // a foreign exception is with catch (...)!
524 // get the current exception
530 return NULL; // No current exception
538 If the exception is native:
539 * marks the exception object on top of the caughtExceptions stack
555 std::terminate(); // throw; called outside of a exception handler
559 // Mark the exception as being rethrown (reverse the effects of __cxa_begin_catch)
562 // __cxa_end_catch will remove this exception from the caughtExceptions stack if necessary
564 else // this is a foreign exception
567 // a foreign exception, so don't delete us, is to pop the stack here
585 // Foreign exception: can't get exception_header->terminateHandler
594 Requires: If thrown_object is not NULL, it is a native exception.
610 deallocate the exception.
612 Requires: If thrown_object is not NULL, it is a native exception.
631 caughtExceptions stack. Atomically increment the exception's referenceCount.
637 the need to allocate the exception-handling globals.
642 // get the current exception
645 return NULL; // If there are no globals, there is no exception
648 return NULL; // No current exception
650 return NULL; // Can't capture a foreign exception (no way to refcount it)
664 primary exception is decremented, destroying the primary if necessary.
665 Finally the dependent exception is destroyed.
681 exception.