aboutsummaryrefslogtreecommitdiff
path: root/gcc/eh-common.h
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2000-06-06 16:38:49 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2000-06-06 16:38:49 +0000
commit103c63aeb9b6bb856ff8a34b7e35d0dc7ab9bf83 (patch)
treecd362ecde7373e378f1d9a95a1254c3695dd5541 /gcc/eh-common.h
parent051ffad528a782b867004c729a01a1db696ec82f (diff)
downloadgcc-103c63aeb9b6bb856ff8a34b7e35d0dc7ab9bf83.zip
gcc-103c63aeb9b6bb856ff8a34b7e35d0dc7ab9bf83.tar.gz
gcc-103c63aeb9b6bb856ff8a34b7e35d0dc7ab9bf83.tar.bz2
eh-common.h (EH_ALLOC_SIZE, [...]): New #defines.
gcc: * eh-common.h (EH_ALLOC_SIZE, EH_ALLOC_ALIGN): New #defines. (eh_context): Add alloc_mask and alloc_buffer emergency fallback space. * libgcc2.c (__eh_alloc): Moved from cp/exception.cc. Fallback on emergency eh_context buffer, if malloc fails. (__eh_free): Moved from cp/exception.cc. Release to emergency eh_context buffer, if appropriate. gcc/cp: * exception.cc: (__eh_alloc, __eh_free): Moved to libgcc2.c From-SVN: r34429
Diffstat (limited to 'gcc/eh-common.h')
-rw-r--r--gcc/eh-common.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/eh-common.h b/gcc/eh-common.h
index 20adfd6..5303d6d 100644
--- a/gcc/eh-common.h
+++ b/gcc/eh-common.h
@@ -39,6 +39,20 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
The routine get_dynamic_handler_chain() also has a dependancy on
the location of 'dynamic_handler_chain'. If its location is changed,
that routine must be modified as well. */
+#ifndef EH_ALLOC_SIZE
+/* 192 bytes means the entire eh_context plus malloc overhead fits in 256
+ bytes (assuming 8 byte pointers). 192 bytes gives an eh_info and object
+ size limit of 96 bytes. This should be sufficient for throwing bad_alloc. */
+#define EH_ALLOC_SIZE 192
+#endif
+#ifndef EH_ALLOC_ALIGN
+/* We can't use BIGGEST_ALIGNMENT, because on some systems, that expands to
+ a check on a compile time switch like
+ 'target_flags & MASK_ALIGN_DOUBLE ? 64 : 32'. There's no macro for
+ 'largest alignment for any code this compiler can build for', which is
+ really what is needed. */
+#define EH_ALLOC_ALIGN 16
+#endif
struct eh_context
{
@@ -48,6 +62,10 @@ struct eh_context
void *info;
/* This is used to remember where we threw for re-throws */
void *table_index; /* address of exception table entry to rethrow from */
+ /* emergency fallback space, if malloc fails during handling */
+ char alloc_buffer[EH_ALLOC_SIZE]
+ __attribute__((__aligned__(EH_ALLOC_ALIGN)));
+ unsigned alloc_mask;
};
#ifndef EH_TABLE_LOOKUP