From patchwork Wed Oct 13 18:06:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 67719 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id CA495B70E6 for ; Thu, 14 Oct 2010 05:07:19 +1100 (EST) Received: (qmail 28245 invoked by alias); 13 Oct 2010 18:07:13 -0000 Received: (qmail 28221 invoked by uid 22791); 13 Oct 2010 18:07:10 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_BJ, TW_JC, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Oct 2010 18:07:03 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9DI6rh7018833 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 13 Oct 2010 14:06:53 -0400 Received: from anchor.twiddle.home (ovpn-113-116.phx2.redhat.com [10.3.113.116]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o9DI6pO9020617; Wed, 13 Oct 2010 14:06:51 -0400 Message-ID: <4CB5F53B.9060105@redhat.com> Date: Wed, 13 Oct 2010 11:06:51 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Thunderbird/3.1.4 MIME-Version: 1.0 To: GCC Patches CC: rguenther@suse.de, joseph@codesourcery.com, jason@redhat.com, java@gcc.gnu.org, ian@airs.com, ebotcazou@libertysurf.fr, mark@codesourcery.com Subject: Re: [RFC] Centralize knowledge of eh personality routines References: <4CB4E841.1090308@redhat.com> In-Reply-To: <4CB4E841.1090308@redhat.com> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Based on the feedback from Mark, I've left the languages passing in a string, shortened to "gxx" etc. That does put off the decision where and when to use the dwarf2 enum. Based on the feedback from the GNAT folk, I've renamed the Ada personality routine to match the other languages. I expect the full testsuite run for x86_64-linux to complete within the next hour. Ok to commit assuming the results look good? r~ gcc/ * expr.c (build_personality_function): Take parameter LANG instead of parameter NAME. Build the name based on the lang prefix and the unwind method in use. * tree.c (lhd_gcc_personality): Update call to build_personality_function. gcc/ada/ * gcc-interface/misc.c (gnat_eh_personality): Update call to build_personality_function. gcc/cp/ * cp-lang.c (cp_eh_personality): Update call to build_personality_function. * except.c (choose_personality_routine): Update function comment. gcc/java/ * lang.c (java_eh_personality): Update call to build_personality_function. gcc/objc/ * objc-act.c (objc_eh_personality): Update call to build_personality_function. gcc/objcp/ * objcp-lang.c (objcxx_eh_personality): Update call to build_personality_function. diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c index 7703e2e..a1b2490 100644 --- a/gcc/ada/gcc-interface/misc.c +++ b/gcc/ada/gcc-interface/misc.c @@ -687,11 +687,7 @@ static tree gnat_eh_personality (void) { if (!gnat_eh_personality_decl) - gnat_eh_personality_decl - = build_personality_function (targetm.except_unwind_info () == UI_SJLJ - ? "__gnat_eh_personality_sj" - : "__gnat_eh_personality"); - + gnat_eh_personality_decl = build_personality_function ("gnat"); return gnat_eh_personality_decl; } diff --git a/gcc/ada/raise-gcc.c b/gcc/ada/raise-gcc.c index 3589bc5..512ff36 100644 --- a/gcc/ada/raise-gcc.c +++ b/gcc/ada/raise-gcc.c @@ -407,7 +407,7 @@ db_phases (int phases) =================================== The major point of this unit is to provide an exception propagation - personality routine for Ada. This is __gnat_eh_personality. + personality routine for Ada. This is __gnat_personality_v0. It is provided with a pointer to the propagated exception, an unwind context describing a location the propagation is going through, and a @@ -440,7 +440,7 @@ db_phases (int phases) | | (Ada frame) | - +--> __gnat_eh_personality (context, exception) + +--> __gnat_personality_v0 (context, exception) | +--> get_region_descriptor_for (context) | @@ -1028,9 +1028,9 @@ extern void __gnat_notify_unhandled_exception (void); GNU-Ada exceptions are met. */ #ifdef __USING_SJLJ_EXCEPTIONS__ -#define PERSONALITY_FUNCTION __gnat_eh_personality_sj +#define PERSONALITY_FUNCTION __gnat_personality_sj0 #else -#define PERSONALITY_FUNCTION __gnat_eh_personality +#define PERSONALITY_FUNCTION __gnat_personality_v0 #endif /* Major tweak for ia64-vms : the CHF propagation phase calls this personality diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 0b70444..a07d7be 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -166,17 +166,8 @@ cp_eh_personality (void) { if (!cp_eh_personality_decl) { - const char *name; - - name = (targetm.except_unwind_info () == UI_SJLJ - ? (pragma_java_exceptions - ? "__gcj_personality_sj0" - : "__gxx_personality_sj0") - : (pragma_java_exceptions - ? "__gcj_personality_v0" - : "__gxx_personality_v0")); - - cp_eh_personality_decl = build_personality_function (name); + const char *lang = (pragma_java_exceptions ? "gcj" : "gxx"); + cp_eh_personality_decl = build_personality_function (lang); } return cp_eh_personality_decl; diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 9d19aa9..b917664 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -295,9 +295,8 @@ decl_is_java_type (tree decl, int err) /* Select the personality routine to be used for exception handling, or issue an error if we need two different ones in the same translation unit. - ??? At present eh_personality_decl is set to - __gxx_personality_(sj|v)0 in init_exception_processing - should it - be done here instead? */ + ??? At present DECL_FUNCTION_PERSONALITY is set via + LANG_HOOKS_EH_PERSONALITY. Should it be done here instead? */ void choose_personality_routine (enum languages lang) { diff --git a/gcc/expr.c b/gcc/expr.c index b0c160f..0050518 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -10255,13 +10255,31 @@ const_vector_from_tree (tree exp) return gen_rtx_CONST_VECTOR (mode, v); } - -/* Build a decl for a EH personality function named NAME. */ +/* Build a decl for a personality function given a language prefix. */ tree -build_personality_function (const char *name) +build_personality_function (const char *lang) { + const char *unwind_and_version; tree decl, type; + char *name; + + switch (targetm.except_unwind_info ()) + { + case UI_NONE: + return NULL; + case UI_SJLJ: + unwind_and_version = "_sj0"; + break; + case UI_DWARF2: + case UI_TARGET: + unwind_and_version = "_v0"; + break; + default: + gcc_unreachable (); + } + + name = ACONCAT (("__", lang, "_personality", unwind_and_version, NULL)); type = build_function_type_list (integer_type_node, integer_type_node, long_long_unsigned_type_node, diff --git a/gcc/java/lang.c b/gcc/java/lang.c index fbe25ad..45722e5 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -911,11 +911,7 @@ static tree java_eh_personality (void) { if (!java_eh_personality_decl) - java_eh_personality_decl - = build_personality_function (targetm.except_unwind_info () == UI_SJLJ - ? "__gcj_personality_sj0" - : "__gcj_personality_v0"); - + java_eh_personality_decl = build_personality_function ("gcj"); return java_eh_personality_decl; } diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 26d490e..edde784 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -3716,13 +3716,8 @@ objc_eh_runtime_type (tree type) tree objc_eh_personality (void) { - if (!flag_objc_sjlj_exceptions - && !objc_eh_personality_decl) - objc_eh_personality_decl - = build_personality_function (targetm.except_unwind_info () == UI_SJLJ - ? "__gnu_objc_personality_sj0" - : "__gnu_objc_personality_v0"); - + if (!flag_objc_sjlj_exceptions && !objc_eh_personality_decl) + objc_eh_personality_decl = build_personality_function ("gnu_objc"); return objc_eh_personality_decl; } #endif diff --git a/gcc/objcp/objcp-lang.c b/gcc/objcp/objcp-lang.c index fdb2976..6a45404 100644 --- a/gcc/objcp/objcp-lang.c +++ b/gcc/objcp/objcp-lang.c @@ -147,11 +147,7 @@ static tree objcxx_eh_personality (void) { if (!objcp_eh_personality_decl) - objcp_eh_personality_decl - = build_personality_function (targetm.except_unwind_info () == UI_SJLJ - ? "__gxx_personality_sj0" - : "__gxx_personality_v0"); - + objcp_eh_personality_decl = build_personality_function ("gxx"); return objcp_eh_personality_decl; } diff --git a/gcc/tree.c b/gcc/tree.c index cf5881a..28cc2d8 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -10874,11 +10874,7 @@ tree lhd_gcc_personality (void) { if (!gcc_eh_personality_decl) - gcc_eh_personality_decl - = build_personality_function (targetm.except_unwind_info () == UI_SJLJ - ? "__gcc_personality_sj0" - : "__gcc_personality_v0"); - + gcc_eh_personality_decl = build_personality_function ("gcc"); return gcc_eh_personality_decl; }