From: Jason Merrill Date: Fri, 5 Dec 1997 03:06:17 +0000 (+0000) Subject: except.c (get_dynamic_handler_chain): Only make the call once per function. X-Git-Tag: releases/libf2c-0.5.21~443 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d07daca1e5d1cef8c5249be10ba0ed6809c38330;p=thirdparty%2Fgcc.git except.c (get_dynamic_handler_chain): Only make the call once per function. * except.c (get_dynamic_handler_chain): Only make the call once per function. From-SVN: r16955 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bccce410e2a8..da734b73915a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ Thu Dec 4 11:51:00 1997 Jason Merrill + * except.c (get_dynamic_handler_chain): Only make the call once per + function. + * except.c (expand_end_all_catch): Fix for sjlj exceptions. Thu Dec 4 12:30:40 1997 J"orn Rennecke diff --git a/gcc/except.c b/gcc/except.c index 9a2f6a0e3dd4..0e9e8142ce51 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -728,31 +728,20 @@ add_partial_entry (handler) This routine is here to facilitate the porting of this code to systems with threads. One can either replace the routine we emit a call for here in libgcc2.c, or one can modify this routine to work - with their thread system. */ + with their thread system. + + Ideally, we really only want one per real function, not one + per inlined function. */ rtx get_dynamic_handler_chain () { -#if 0 - /* Do this once we figure out how to get this to the front of the - function, and we really only want one per real function, not one - per inlined function. */ - if (current_function_dhc == 0) - { - rtx dhc, insns; - start_sequence (); - - /* ... */ - insns = get_insns (); - end_sequence (); - emit_insns_before (insns, get_first_nonparm_insn ()); - } - /* We don't want a copy of the dhc, but rather, the single dhc. */ - return gen_rtx (MEM, Pmode, current_function_dhc); -#endif - static tree fn; tree expr; + rtx insns; + + if (current_function_dhc) + return current_function_dhc; if (fn == NULL_TREE) { @@ -779,7 +768,13 @@ get_dynamic_handler_chain () TREE_SIDE_EFFECTS (expr) = 1; expr = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (expr)), expr); - return expand_expr (expr, NULL_RTX, VOIDmode, 0); + start_sequence (); + current_function_dhc = expand_expr (expr, NULL_RTX, VOIDmode, 0); + insns = get_insns (); + end_sequence (); + emit_insns_before (insns, get_first_nonparm_insn ()); + + return current_function_dhc; } /* Get a reference to the dynamic cleanup chain. It points to the