From patchwork Fri Sep 6 11:21:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1158951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-508474-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="q9MEvDm8"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gMRJ8dXp"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46Pw9p43B4z9s7T for ; Fri, 6 Sep 2019 21:21:32 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=KJv3Ao5Cavd/LKGWQjUUZK9aX0UwRcqHYHFB6icVhEjpf2w3jY gxD1zx8edJ9fIlDqqoxWHzljgWWQ4HeLnu8Kk4vFJZhbz8tzYV6V4YrFMXGexUxX PzeIzjg1IkL4ujF7sb2HMM0Der3KYRbGGHgwwViPNMUcWRG9VzpcDSc3U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=XlPFSNYRnkTIljQIynUXsRPTgNU=; b=q9MEvDm8sLb4FojFe1ZS 2hPO/vhxBWKgQey0TI3CEVWfyQztFolZQrOaCxIG4cp8KKcaGRBsJTfaLzWb9EZ6 r58jg2U5qOFQqe4/dMN6GOfRlzQSqrlJ6fQC0ppNiKFEmc2v/VCj+QFUz0bxP2g5 1lXDIc8Xpp7PM6A7XjfJ1zE= Received: (qmail 57893 invoked by alias); 6 Sep 2019 11:21:24 -0000 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 Received: (qmail 57880 invoked by uid 89); 6 Sep 2019 11:21:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=ground, HX-Gm-Message-State:APjAAAX, sk:constru, involve X-HELO: mail-qk1-f175.google.com Received: from mail-qk1-f175.google.com (HELO mail-qk1-f175.google.com) (209.85.222.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Sep 2019 11:21:22 +0000 Received: by mail-qk1-f175.google.com with SMTP id d26so5271971qkk.2 for ; Fri, 06 Sep 2019 04:21:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=3LwH6z+VWq+8faEqO/CDN9XDuvzHNdIfYmVKIWiKspQ=; b=gMRJ8dXpSenTP7ZXrNFcXf31q9M081huxjKr+ukhHCiIFow5YHlyovLv58rJ/2vcZ4 /WUNBuSMypAU/cWnjZfpV9185uQauHuAuRQg7JHztLczJceE2yXvWsNjcHLt/ARPcEwN /x97kMvgMDVW8z+5+iNB9O4r9LgvLuVSHggpKTnW4K7XKUGAJEZjaPq3iLbb8LDKIdAr ASoCIR8P8l99cSnmSwjFUy0gxgLi09jVOV5hj8rtMSzNycug1fjdJj4b2DEIKL+Z2VMJ KvfvPaIZ/c/g94F/LThE0Tepf4SG9lznOBKkwxgZ/jR6vqOh5cA0mGnc+ZEyNFwEcNpo ogmg== Received: from ?IPv6:2620:10d:c0a3:1407:c041:8be9:ac8d:b8c6? ([2620:10d:c091:500::3:5252]) by smtp.googlemail.com with ESMTPSA id v26sm3030017qta.88.2019.09.06.04.21.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Sep 2019 04:21:20 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: [C++ PATCH] Reserve a decl_lang bit Message-ID: <89c07380-5f84-e324-8f5b-e580f921bbbb@acm.org> Date: Fri, 6 Sep 2019 07:21:19 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 This patch 1) deletes DECL_CONSTRUCTION_VTABLE_P. It is checked in exactly one place, but that place is unreachable. When we set D_C_V_P, we also set the visibility to internal. When we check it, we've already bailed out if the visibility was set. 2) Move DECL_NON_TRIVIALLY_INITIALIZED_P to the now unused bit 6 for VAR_DECLS. 3) Reserves the now vacant bit 3 for DECL_* nodes, for use with C++ modules. Hands off! I am not merging modules at this point, but preparing the ground. part #1 of this patch is good in its own right and #2 is neutral. I expect to begin merging proper later this year, and that'll of course involve other maintainers' reviews. nathan 2019-09-06 Nathan Sidwell Reserve TREE_LANG_FLAG_3 for modules. gcc/cp/ * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete. (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6. * class.c (build_ctor_vtbl_group): Don't set DECL_CONSTRUCTION_VTABLE_P. * decl2.c (determine_visibility_from_class): Don't check DECL_CONSTRUCTION_VTABLE_P anymore. Index: gcc/cp/class.c =================================================================== --- gcc/cp/class.c (revision 275454) +++ gcc/cp/class.c (working copy) @@ -9176,5 +9176,5 @@ build_ctor_vtbl_group (tree binfo, tree construction vtable group. */ vtbl = build_vtable (t, id, ptr_type_node); - DECL_CONSTRUCTION_VTABLE_P (vtbl) = 1; + /* Don't export construction vtables from shared libraries. Even on targets that don't support hidden visibility, this tells Index: gcc/cp/cp-tree.h =================================================================== --- gcc/cp/cp-tree.h (revision 275454) +++ gcc/cp/cp-tree.h (working copy) @@ -449,5 +449,4 @@ extern GTY(()) tree cp_global_trees[CPTI FN_TRY_BLOCK_P (in TRY_BLOCK) BIND_EXPR_BODY_BLOCK (in BIND_EXPR) - DECL_NONTRIVIALLY_INITIALIZED_P (in VAR_DECL) CALL_EXPR_ORDERED_ARGS (in CALL_EXPR, AGGR_INIT_EXPR) DECLTYPE_FOR_REF_CAPTURE (in DECLTYPE_TYPE) @@ -455,4 +454,5 @@ extern GTY(()) tree cp_global_trees[CPTI OVL_NESTED_P (in OVERLOAD) LAMBDA_EXPR_INSTANTIATED (in LAMBDA_EXPR) + Reserved for DECL_MODULE_EXPORT (in DECL_) 4: IDENTIFIER_MARKED (IDENTIFIER_NODEs) TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR, @@ -467,6 +467,6 @@ extern GTY(()) tree cp_global_trees[CPTI CONSTRUCTOR_PLACEHOLDER_BOUNDARY (in CONSTRUCTOR) 6: IDENTIFIER_REPO_CHOSEN (in IDENTIFIER_NODE) - DECL_CONSTRUCTION_VTABLE_P (in VAR_DECL) TYPE_MARKED_P (in _TYPE) + DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL) RANGE_FOR_IVDEP (in RANGE_FOR_STMT) CALL_EXPR_OPERATOR_SYNTAX (in CALL_EXPR, AGGR_INIT_EXPR) @@ -3002,5 +3002,5 @@ struct GTY(()) lang_decl { or a non-trivial constructor is called. */ #define DECL_NONTRIVIALLY_INITIALIZED_P(NODE) \ - (TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE))) + (TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE))) /* Nonzero for a VAR_DECL that was initialized with a @@ -3271,10 +3271,4 @@ struct GTY(()) lang_decl { TREE_LANG_FLAG_5 (FUNC_OR_METHOD_CHECK (NODE)) -/* Returns 1 iff VAR_DECL is a construction virtual table. - DECL_VTABLE_OR_VTT_P will be true in this case and must be checked - before using this macro. */ -#define DECL_CONSTRUCTION_VTABLE_P(NODE) \ - TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE)) - /* 1 iff NODE is function-local, but for types. */ #define LOCAL_CLASS_P(NODE) \ Index: gcc/cp/decl2.c =================================================================== --- gcc/cp/decl2.c (revision 275454) +++ gcc/cp/decl2.c (working copy) @@ -2714,11 +2714,6 @@ determine_visibility_from_class (tree de with DECL. */ if (VAR_P (decl) - && (DECL_TINFO_P (decl) - || (DECL_VTABLE_OR_VTT_P (decl) - /* Construction virtual tables are not exported because - they cannot be referred to from other object files; - their name is not standardized by the ABI. */ - && !DECL_CONSTRUCTION_VTABLE_P (decl))) && TREE_PUBLIC (decl) + && (DECL_TINFO_P (decl) || DECL_VTABLE_OR_VTT_P (decl)) && !DECL_REALLY_EXTERN (decl) && !CLASSTYPE_VISIBILITY_SPECIFIED (class_type))