Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/gnu/dist/toolchain/gcc Pull up revision 1.2 (requested ...



details:   https://anonhg.NetBSD.org/src/rev/55330cf558e2
branches:  netbsd-1-6
changeset: 529816:55330cf558e2
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Dec 19 00:44:37 2002 +0000

description:
Pull up revision 1.2 (requested by kristerw in ticket #1039):
Place EH labels on the permanent obstack. Fixes PR 18314.
Background:
Originally, the EH labels were placed on the permanent obstack, which
could end up using a lot of memory (for heavy inlining) since inlined
labels also needed to be permanent as a result of this.
This was changed in
   Wed Dec  9 09:12:40 1998  Andrew MacLeod  <amacleod%cygnus.com@localhost>
        * 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.
by using the label numbers instead of the label structures in most cases.
The operative word here is "most" cases. Addresses to the EH RTX was still
used in (at least) flow.c, that now used freed memory. Oops.
For this to happen, the freed address of the RTX representing a EH label
must be reused for a new label that is located in dead code. delete_block()
will then see that this RTX is mentioned in the EH table, and (incorrectly)
remove the exception handler.
This might be seen when, for example, compiling
src/gnu/dist/groff/src/roff/troff/node.cc for m68k.

diffstat:

 gnu/dist/toolchain/gcc/except.c    |  4 ++++
 gnu/dist/toolchain/gcc/integrate.c |  7 ++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diffs (32 lines):

diff -r e35566a00b00 -r 55330cf558e2 gnu/dist/toolchain/gcc/except.c
--- a/gnu/dist/toolchain/gcc/except.c   Thu Dec 19 00:36:27 2002 +0000
+++ b/gnu/dist/toolchain/gcc/except.c   Thu Dec 19 00:44:37 2002 +0000
@@ -617,7 +617,11 @@
 gen_exception_label ()
 {
   rtx lab;
+
+  push_obstacks_nochange ();
+  end_temporary_allocation ();
   lab = gen_label_rtx ();
+  pop_obstacks ();
   return lab;
 }
 
diff -r e35566a00b00 -r 55330cf558e2 gnu/dist/toolchain/gcc/integrate.c
--- a/gnu/dist/toolchain/gcc/integrate.c        Thu Dec 19 00:36:27 2002 +0000
+++ b/gnu/dist/toolchain/gcc/integrate.c        Thu Dec 19 00:44:37 2002 +0000
@@ -110,7 +110,12 @@
   rtx x = map->label_map[i];
 
   if (x == NULL_RTX)
-    x = map->label_map[i] = gen_label_rtx();
+    {
+      push_obstacks_nochange ();
+      end_temporary_allocation ();
+      x = map->label_map[i] = gen_label_rtx();
+      pop_obstacks ();
+    }
 
   return x;
 }



Home | Main Index | Thread Index | Old Index