This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
exception handling label patch
- To: egcs-patches at cygnus dot com
- Subject: exception handling label patch
- From: Andrew Macleod <amacleod at cygnus dot com>
- Date: Wed, 9 Dec 1998 06:16:30 -0800
I've just applied this patch to the EGCS sources.
This removes the restriction which required exception handler labels
to be permanent rtl. A ripple effect was that all inlined labels
were forced to be permanent too, and this could end up using a lot
of memory, as Mark pointed out a while ago.
This should solve that problem.
Andrew
* except.h (struct handler_info): Add handler_number field
* except.c (gen_exception_label): EH labels no longer need to be
on the permanent obstack.
(get_new_handler): Set the label number field.
(output_exception_table_entry): Regenerate handler label reference
from the label number field.
(init_eh): Remove a blank line
* integrate.c (get_label_from_map): Labels no longer need to be
on the permanent obstack.
Index: except.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/except.h,v
retrieving revision 1.25
diff -c -p -r1.25 except.h
*** except.h 1998/12/08 14:03:52 1.25
--- except.h 1998/12/08 22:25:45
*************** void set_exception_version_code
*** 172,178 ****
typedef struct handler_info
{
! rtx handler_label;
void *type_info;
struct handler_info *next;
} handler_info;
--- 172,179 ----
typedef struct handler_info
{
! rtx handler_label;
! int handler_number;
void *type_info;
struct handler_info *next;
} handler_info;
Index: except.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/except.c,v
retrieving revision 1.73
diff -c -p -r1.73 except.c
*** except.c 1998/12/08 14:03:53 1.73
--- except.c 1998/12/08 22:25:48
*************** rtx
*** 616,626 ****
gen_exception_label ()
{
rtx lab;
-
- push_obstacks_nochange ();
- end_temporary_allocation ();
lab = gen_label_rtx ();
- pop_obstacks ();
return lab;
}
--- 616,622 ----
*************** get_new_handler (handler, typeinfo)
*** 924,929 ****
--- 920,926 ----
struct handler_info* ptr;
ptr = (struct handler_info *) malloc (sizeof (struct handler_info));
ptr->handler_label = handler;
+ ptr->handler_number = CODE_LABEL_NUMBER (handler);
ptr->type_info = typeinfo;
ptr->next = NULL;
*************** output_exception_table_entry (file, n)
*** 2147,2154 ****
if (handler == NULL)
assemble_integer (GEN_INT (0), POINTER_SIZE / BITS_PER_UNIT, 1);
else
! assemble_integer (handler->handler_label,
! POINTER_SIZE / BITS_PER_UNIT, 1);
if (flag_new_exceptions)
{
--- 2144,2154 ----
if (handler == NULL)
assemble_integer (GEN_INT (0), POINTER_SIZE / BITS_PER_UNIT, 1);
else
! {
! ASM_GENERATE_INTERNAL_LABEL (buf, "L", handler->handler_number);
! sym = gen_rtx_SYMBOL_REF (Pmode, buf);
! assemble_integer (sym, POINTER_SIZE / BITS_PER_UNIT, 1);
! }
if (flag_new_exceptions)
{
*************** check_exception_handler_labels ()
*** 2394,2400 ****
void
init_eh ()
{
-
first_rethrow_symbol = create_rethrow_ref (0);
final_rethrow = gen_exception_label ();
last_rethrow_symbol = create_rethrow_ref (CODE_LABEL_NUMBER (final_rethrow));
--- 2394,2399 ----
Index: integrate.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/integrate.c,v
retrieving revision 1.40
diff -c -p -r1.40 integrate.c
*** integrate.c 1998/12/08 14:03:56 1.40
--- integrate.c 1998/12/08 22:25:52
*************** get_label_from_map (map, i)
*** 99,110 ****
rtx x = map->label_map[i];
if (x == NULL_RTX)
! {
! push_obstacks_nochange ();
! end_temporary_allocation ();
! x = map->label_map[i] = gen_label_rtx();
! pop_obstacks ();
! }
return x;
}
--- 99,105 ----
rtx x = map->label_map[i];
if (x == NULL_RTX)
! x = map->label_map[i] = gen_label_rtx();
return x;
}