summaryrefslogtreecommitdiff
path: root/gcc/eh-common.h
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2000-06-06 16:38:49 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2000-06-06 16:38:49 +0000
commitd3e1375a3557529dff71be71bf0449f94918e27c (patch)
treecd362ecde7373e378f1d9a95a1254c3695dd5541 /gcc/eh-common.h
parent67bb7b2d71cbf6bd6c793aa68fa76b6760bb53a7 (diff)
downloadgcc-d3e1375a3557529dff71be71bf0449f94918e27c.tar.gz
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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34429 138bc75d-0d04-0410-961f-82ee72b054a4
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 20adfd613f0..5303d6db474 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