Commit 531073e7 by Richard Henderson Committed by Richard Henderson

Make -fsjlj-exceptions a configure option.

From-SVN: r40905
parent 979988f3
......@@ -7,6 +7,16 @@
* gthr-single.h (UNUSED): New. Distinguish between how C
and C++ mark unused function arguments. Use throughout.
* Makefile.in (cs-tconfig.h): Copy USING_SJLJ_EXCEPTIONS
value to target configuration header.
* configure.in (CONFIG_SJLJ_EXCEPTIONS): New.
* config.in, configure: Rebuild.
* except.h (USING_SJLJ_EXCEPTIONS): New. Define based on
configuration and target defines.
(exceptions_via_longjmp): Remove.
* dwarf2out.c, except.c, final.c, toplev.c, config/ia64/ia64.c:
Use USING_SJLJ_EXCEPTIONS instead of exceptions_via_longjmp.
2001-03-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* configure.in: Don't check for bcopy.
......
......@@ -887,10 +887,19 @@ cs-hconfig.h: Makefile
TARGET_CPU_DEFAULT="$(target_cpu_default)" \
$(SHELL) $(srcdir)/mkconfig.sh hconfig.h
cs-tconfig.h: Makefile
cs-tconfig.h: Makefile $(GCONFIG_H) insn-flags.h except.h
HEADERS="$(xm_file)" DEFINES="$(xm_defines)" \
TARGET_CPU_DEFAULT="" \
$(SHELL) $(srcdir)/mkconfig.sh tconfig.h
# ??? Need extra help to get this definition copied to where libgcc can
# see it. It shouldn't matter which compiler we use to get there.
echo '#include "config.h"' > conftest.c
echo '#include "except.h"' >> conftest.c
echo 'xyzzy USING_SJLJ_EXCEPTIONS' >> conftest.c
$(HOST_CC) -E conftest.c $(HOST_CFLAGS) $(INCLUDES) > conftest.out
sed -e 's/xyzzy/#define USING_SJLJ_EXCEPTIONS/' -e '/#define/p' \
-e d conftest.out >> tconfig.h
rm conftest.*
cs-tm_p.h: Makefile
HEADERS="$(tm_p_file)" DEFINES="" TARGET_CPU_DEFAULT="" \
......
......@@ -467,6 +467,9 @@
/* Define to 1 if you want to enable namespaces (-fhonor-std) by default. */
#undef ENABLE_STD_NAMESPACE
/* Define 0/1 to force the choice for exception handling model. */
#undef CONFIG_SJLJ_EXCEPTIONS
/* Bison unconditionally undefines `const' if neither `__STDC__' nor
__cplusplus are defined. That's a problem since we use `const' in
......
......@@ -2470,7 +2470,7 @@ ia64_function_prologue (file, size)
current_frame_info.n_output_regs,
current_frame_info.n_rotate_regs);
if (!flag_unwind_tables && (!flag_exceptions || exceptions_via_longjmp))
if (!flag_unwind_tables && (!flag_exceptions || USING_SJLJ_EXCEPTIONS))
return;
/* Emit the .prologue directive. */
......@@ -2529,7 +2529,7 @@ void
ia64_output_end_prologue (file)
FILE *file;
{
if (!flag_unwind_tables && (!flag_exceptions || exceptions_via_longjmp))
if (!flag_unwind_tables && (!flag_exceptions || USING_SJLJ_EXCEPTIONS))
return;
fputs ("\t.body\n", file);
......@@ -6587,7 +6587,7 @@ process_for_unwind_directive (asm_out_file, insn)
rtx insn;
{
if (flag_unwind_tables
|| (flag_exceptions && !exceptions_via_longjmp))
|| (flag_exceptions && !USING_SJLJ_EXCEPTIONS))
{
rtx pat;
......
......@@ -1666,6 +1666,13 @@ else
fi
AC_SUBST(MAINT)dnl
# With Setjmp/Longjmp based exception handling.
AC_ARG_ENABLE(sjlj-exceptions,
[ --enable-sjlj-exceptions arrange to use setjmp/longjmp exception handling.],
[sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi`
AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
[Define 0/1 to force the choice for exception handling model.])])
# Make empty files to contain the specs and options for each language.
# Then add #include lines to for a compiler that has specs and/or options.
......
2001-03-27 Richard Henderson <rth@redhat.com>
* except.c: Use USING_SJLJ_EXCEPTIONS instead of
exceptions_via_longjmp.
2001-03-27 Phil Edwards <pme@sources.redhat.com>
* pt.c (check_default_tmpl_args): Make error messages clearer.
......
......@@ -788,13 +788,13 @@ expand_exception_blocks ()
/* We cannot protect n regions this way if we must flow into the
EH region through the top of the region, as we have to with
the setjmp/longjmp approach. */
if (exceptions_via_longjmp == 0)
if (USING_SJLJ_EXCEPTIONS == 0)
expand_eh_region_start ();
emit_insns (catch_clauses);
catch_clauses = catch_clauses_last = NULL_RTX;
if (exceptions_via_longjmp == 0)
if (USING_SJLJ_EXCEPTIONS == 0)
expand_eh_region_end (build_terminate_handler ());
emit_insns (catch_clauses);
......@@ -852,7 +852,7 @@ expand_throw (exp)
/* A Java `throw' statement. */
tree args = tree_cons (NULL_TREE, exp, NULL);
fn = get_identifier (exceptions_via_longjmp
fn = get_identifier (USING_SJLJ_EXCEPTIONS
? "_Jv_Sjlj_Throw"
: "_Jv_Throw");
if (IDENTIFIER_GLOBAL_VALUE (fn))
......
......@@ -86,7 +86,7 @@ dwarf2out_do_frame ()
#endif
#ifdef DWARF2_UNWIND_INFO
|| flag_unwind_tables
|| (flag_exceptions && ! exceptions_via_longjmp)
|| (flag_exceptions && ! USING_SJLJ_EXCEPTIONS)
#endif
);
}
......@@ -1936,11 +1936,11 @@ dwarf2out_frame_finish ()
#ifdef MIPS_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG)
output_call_frame_info (0);
if (flag_unwind_tables || (flag_exceptions && ! exceptions_via_longjmp))
if (flag_unwind_tables || (flag_exceptions && ! USING_SJLJ_EXCEPTIONS))
output_call_frame_info (1);
#else
if (write_symbols == DWARF2_DEBUG
|| flag_unwind_tables || (flag_exceptions && ! exceptions_via_longjmp))
|| flag_unwind_tables || (flag_exceptions && ! USING_SJLJ_EXCEPTIONS))
output_call_frame_info (1);
#endif
}
......
......@@ -409,11 +409,6 @@ Boston, MA 02111-1307, USA. */
#include "ggc.h"
#include "tm_p.h"
/* One to use setjmp/longjmp method of generating code for exception
handling. */
int exceptions_via_longjmp = 2;
/* One to enable asynchronous exception support. */
int flag_non_call_exceptions = 0;
......@@ -671,7 +666,7 @@ receive_exception_label (handler_label)
{
rtx around_label = NULL_RTX;
if (! flag_new_exceptions || exceptions_via_longjmp)
if (! flag_new_exceptions || USING_SJLJ_EXCEPTIONS)
{
around_label = gen_label_rtx ();
emit_jump (around_label);
......@@ -680,7 +675,7 @@ receive_exception_label (handler_label)
emit_label (handler_label);
if (! exceptions_via_longjmp)
if (! USING_SJLJ_EXCEPTIONS)
{
#ifdef HAVE_exception_receiver
if (HAVE_exception_receiver)
......@@ -1413,7 +1408,7 @@ expand_eh_region_start_tree (decl, cleanup)
/* The optimization only applies to actions protected with
terminate, and only applies if we are using the setjmp/longjmp
codegen method. */
if (exceptions_via_longjmp
if (USING_SJLJ_EXCEPTIONS
&& protect_cleanup_actions_with_terminate)
{
tree func, arg;
......@@ -1481,7 +1476,7 @@ expand_eh_region_start_for_decl (decl)
automatically. */
mark_block_as_eh_region ();
if (exceptions_via_longjmp)
if (USING_SJLJ_EXCEPTIONS)
{
/* Arrange for returns and gotos to pop the entry we make on the
dynamic handler stack. */
......@@ -1492,7 +1487,7 @@ expand_eh_region_start_for_decl (decl)
note = emit_note (NULL_PTR, NOTE_INSN_EH_REGION_BEG);
NOTE_EH_HANDLER (note)
= CODE_LABEL_NUMBER (ehstack.top->entry->exception_handler_label);
if (exceptions_via_longjmp)
if (USING_SJLJ_EXCEPTIONS)
start_dynamic_handler ();
}
......@@ -1532,7 +1527,7 @@ expand_eh_region_end (handler)
note = emit_note (NULL_PTR, NOTE_INSN_EH_REGION_END);
ret = NOTE_EH_HANDLER (note)
= CODE_LABEL_NUMBER (entry->exception_handler_label);
if (exceptions_via_longjmp == 0 && ! flag_new_exceptions
if (USING_SJLJ_EXCEPTIONS == 0 && ! flag_new_exceptions
/* We share outer_context between regions; only emit it once. */
&& INSN_UID (entry->outer_context) == 0)
{
......@@ -1592,7 +1587,7 @@ expand_eh_region_end (handler)
void
expand_fixup_region_start ()
{
if (! doing_eh (0) || exceptions_via_longjmp)
if (! doing_eh (0) || USING_SJLJ_EXCEPTIONS)
return;
expand_eh_region_start ();
......@@ -1611,7 +1606,7 @@ expand_fixup_region_end (cleanup)
struct eh_node *node;
int dont_issue;
if (! doing_eh (0) || exceptions_via_longjmp)
if (! doing_eh (0) || USING_SJLJ_EXCEPTIONS)
return;
for (node = ehstack.top; node && node->entry->finalization != cleanup; )
......@@ -1658,7 +1653,7 @@ expand_fixup_region_end (cleanup)
void
emit_throw ()
{
if (exceptions_via_longjmp)
if (USING_SJLJ_EXCEPTIONS)
{
emit_library_call (sjthrow_libfunc, 0, VOIDmode, 0);
}
......@@ -1739,7 +1734,7 @@ start_catch_handler (rtime)
add_new_handler (eh_region_entry, get_new_handler (handler_label, rtime));
if (flag_new_exceptions && ! exceptions_via_longjmp)
if (flag_new_exceptions && ! USING_SJLJ_EXCEPTIONS)
return;
/* Under the old mechanism, as well as setjmp/longjmp, we need to
......@@ -1787,7 +1782,7 @@ end_catch_handler ()
if (! doing_eh (1))
return;
if (flag_new_exceptions && ! exceptions_via_longjmp)
if (flag_new_exceptions && ! USING_SJLJ_EXCEPTIONS)
{
emit_barrier ();
return;
......@@ -1936,7 +1931,7 @@ expand_start_all_catch ()
out of line, we arrange to rethrow in the outer context. We need to
do this because we are not physically within the region, if any, that
logically contains this catch block. */
if (! exceptions_via_longjmp)
if (! USING_SJLJ_EXCEPTIONS)
{
expand_eh_region_start ();
ehstack.top->entry->outer_context = outer_context;
......@@ -1963,7 +1958,7 @@ expand_end_all_catch ()
entry = pop_eh_entry (&catchstack);
free (entry);
if (! exceptions_via_longjmp)
if (! USING_SJLJ_EXCEPTIONS)
{
rtx outer_context = ehstack.top->entry->outer_context;
......@@ -2010,7 +2005,7 @@ static void
expand_rethrow (label)
rtx label;
{
if (exceptions_via_longjmp)
if (USING_SJLJ_EXCEPTIONS)
emit_throw ();
else
if (flag_new_exceptions)
......@@ -2085,7 +2080,7 @@ protect_with_terminate (e)
/* We only need to do this when using setjmp/longjmp EH and the
language requires it, as otherwise we protect all of the handlers
at once, if we need to. */
if (exceptions_via_longjmp && protect_cleanup_actions_with_terminate)
if (USING_SJLJ_EXCEPTIONS && protect_cleanup_actions_with_terminate)
{
tree handler, result;
......@@ -2389,7 +2384,7 @@ output_function_exception_table ()
Inlined functions may use it too, and thus we'll have to be able
to change them too.
This is done only if using exceptions_via_longjmp. */
This is done only if using USING_SJLJ_EXCEPTIONS. */
void
emit_eh_context ()
......
......@@ -472,10 +472,6 @@ extern void push_ehqueue PARAMS ((void));
/* Restore a previously pushed ehqueue. */
extern void pop_ehqueue PARAMS ((void));
/* One to use setjmp/longjmp method of generating code. */
extern int exceptions_via_longjmp;
/* One to enable asynchronous exception support. */
extern int flag_non_call_exceptions;
......@@ -516,3 +512,27 @@ void init_insn_eh_region PARAMS ((rtx, int));
#ifdef rtx
#undef rtx
#endif
/* Just because the user configured --with-sjlj-exceptions=no doesn't
mean that we can use call frame exceptions. Detect that the target
has appropriate support. */
#ifdef CONFIG_SJLJ_EXCEPTIONS
# if CONFIG_SJLJ_EXCEPTIONS == 1
# define USING_SJLJ_EXCEPTIONS 1
# endif
# if CONFIG_SJLJ_EXCEPTIONS == 0
# define USING_SJLJ_EXCEPTIONS 0
# if !defined(DWARF2_UNWIND_INFO) && !defined(IA64_UNWIND_INFO)
#error "{DWARF2,IA64}_UNWIND_INFO required"
# endif
# endif
#else
# ifdef IA64_UNWIND_INFO
# define USING_SJLJ_EXCEPTIONS (!IA64_UNWIND_INFO)
# else
# ifdef DWARF2_UNWIND_INFO
# define USING_SJLJ_EXCEPTIONS (!DWARF2_UNWIND_INFO)
# endif
# endif
#endif
......@@ -2126,7 +2126,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
break;
case NOTE_INSN_EH_REGION_BEG:
if (! exceptions_via_longjmp)
if (! USING_SJLJ_EXCEPTIONS)
{
ASM_OUTPUT_INTERNAL_LABEL (file, "LEHB", NOTE_EH_HANDLER (insn));
if (! flag_new_exceptions)
......@@ -2138,7 +2138,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
break;
case NOTE_INSN_EH_REGION_END:
if (! exceptions_via_longjmp)
if (! USING_SJLJ_EXCEPTIONS)
{
ASM_OUTPUT_INTERNAL_LABEL (file, "LEHE", NOTE_EH_HANDLER (insn));
if (flag_new_exceptions)
......
2001-03-27 Richard Henderson <rth@redhat.com>
* expr.c, parse.h: Use USING_SJLJ_EXCEPTIONS instead of
exceptions_via_longjmp.
2001-03-27 Richard Henderson <rth@redhat.com>
* decl.c (end_java_method): Rename asynchronous_exceptions to
flag_non_call_exceptions.
* parse.y (source_end_java_method): Likewise.
......
......@@ -600,7 +600,7 @@ build_java_athrow (node)
call = build (CALL_EXPR,
void_type_node,
build_address_of (throw_node[exceptions_via_longjmp ? 1 : 0]),
build_address_of (throw_node[USING_SJLJ_EXCEPTIONS ? 1 : 0]),
build_tree_list (NULL_TREE, node),
NULL_TREE);
TREE_SIDE_EFFECTS (call) = 1;
......
......@@ -673,7 +673,7 @@ typedef struct _jdeplist {
{ \
(WHERE) = \
build (CALL_EXPR, void_type_node, \
build_address_of (throw_node[exceptions_via_longjmp ? 1 : 0]), \
build_address_of (throw_node[USING_SJLJ_EXCEPTIONS ? 1 : 0]), \
build_tree_list (NULL_TREE, (WHAT)), NULL_TREE); \
TREE_SIDE_EFFECTS ((WHERE)) = 1; \
}
......
2001-03-27 Richard Henderson <rth@redhat.com>
* g++.old-deja/g++.eh/crash3.C: Don't use -fsjlj-exceptions.
* g++.old-deja/g++.eh/vbase3.C: Likewise.
2001-03-27 Alan Modra <alan@linuxcare.com.au>
* gcc.c-torture/compile/20010327-1.c: New test.
......
// Build don't link:
// Origin: Marc Espie <Marc.Espie@liafa.jussieu.fr>
// Special g++ Options: -fsjlj-exceptions
// Used to use -fsjlj-exceptions, but that isn't an option anymore.
extern double f(double a);
......
// Build don't link:
// Special g++ Options: -fsjlj-exceptions
// Used to use -fsjlj-exceptions, but that isn't an option anymore.
// Origin: Donn Terry <donn@interix.com>
struct ios {
......
......@@ -1081,8 +1081,6 @@ lang_independent_options f_options[] =
"Use the new model for exception handling" },
{"unwind-tables", &flag_unwind_tables, 1,
"Just generate unwind tables for exception handling" },
{"sjlj-exceptions", &exceptions_via_longjmp, 1,
"Use setjmp/longjmp to handle exceptions" },
{"non-call-exceptions", &flag_non_call_exceptions, 1,
"Support synchronous non-call exceptions" },
{"profile-arcs", &profile_arc_flag, 1,
......@@ -4877,19 +4875,6 @@ toplev_main (argc, argv)
OVERRIDE_OPTIONS;
#endif
if (exceptions_via_longjmp == 2)
{
#ifdef DWARF2_UNWIND_INFO
exceptions_via_longjmp = ! DWARF2_UNWIND_INFO;
#else
#ifdef IA64_UNWIND_INFO
exceptions_via_longjmp = ! IA64_UNWIND_INFO;
#else
exceptions_via_longjmp = 1;
#endif
#endif
}
/* Since each function gets its own handler data, we can't support the
new model currently, since it depend on a specific rethrow label
which is declared at the front of the table, and we can only
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment