From patchwork Wed Sep 5 14:57:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 966439 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-485236-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ECe7KNXr"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rqLtWAuk"; 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 4256Qx3VK5z9s5c for ; Thu, 6 Sep 2018 01:03:37 +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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; q=dns; s=default; b=gf/ AeZcLJHf/v/lISLEyzfJdvA0juepQyUEbpHZxB3k95YNzK2m3gY+lg0Taii2JAqZ snqSLZR4PgtHM8ryh8j8dnSLkGszEEDw3+xZZ3z/JYNN7kcyPTPlcrnHfDpxdn7Q K+gSrprFf6RnGK3jVG6qqSnWeD/6PF5qbO4+brKs= 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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=default; bh=9dLQmxXEc sAKAZvzA5kVIMB//aM=; b=ECe7KNXrH5gEpWz9HiImh3q3e3Ew7HBpiSH5VtvLE WvHBrNDlQLm+MAGx3Kg8+uA09Zcl7yYqISpbtZzi0QILIRXQEAtNXbfyJ0DUW5ct buRX41l0Kj7WbiDZUJImpMIqS3dXWQ64qUBGSgB0gfFHTuhRVzxofwMqXbJsQ0dv Yc= Received: (qmail 70050 invoked by alias); 5 Sep 2018 14:58:07 -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 69094 invoked by uid 89); 5 Sep 2018 14:57:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f47.google.com Received: from mail-wm0-f47.google.com (HELO mail-wm0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Sep 2018 14:57:57 +0000 Received: by mail-wm0-f47.google.com with SMTP id n11-v6so8058312wmc.2; Wed, 05 Sep 2018 07:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Km9qYutJZlw4WSf7dRyyqcwsqJwwWx0VwSC1XKIZAHI=; b=rqLtWAukHdAFnKxo5jKaUg4HmrJT3h4N0W4yIl3/JMs+Lp5fZ4LH8Deo06zrlTwE0P NkHsyCZ13WBZPFM3Q3Cv4wPfWYe8ZG2rvr2xU1P5oy+r9dCNRO/Jx8AJeJbiWuqeb3S3 dCLZYBATYgBiX33E6vbcuJZ/zp/dZ+vX2SJcA6lvZopEBfVzCzQTEJFyH0RYiu0+WXee kSNSjiD/FgR/1V+hdcZE67dmVdbV/WjZzZoXRZyNF/wbbhiBhoUuSqD/BewluCQLS4VI zRLNCbfacY3EgqlemHq+vJCt8gpJX/vkVSuqwNFzaVvIGoqpgzL8A7dgbJakC3lXvGKj gPEA== Received: from s46.loc (91-119-125-11.dsl.dynamic.surfer.at. [91.119.125.11]) by smtp.gmail.com with ESMTPSA id b74-v6sm3706029wma.8.2018.09.05.07.57.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Sep 2018 07:57:51 -0700 (PDT) Received: from cow by s46.loc with local (Exim 4.91) (envelope-from ) id 1fxZFb-00008L-1u; Wed, 05 Sep 2018 14:57:47 +0000 From: Bernhard Reutner-Fischer To: fortran@gcc.gnu.org Cc: Bernhard Reutner-Fischer , gcc-patches@gcc.gnu.org Subject: [PATCH,FORTRAN 23/29] Use stringpool for module binding_label Date: Wed, 5 Sep 2018 14:57:26 +0000 Message-Id: <20180905145732.404-24-rep.dot.nop@gmail.com> In-Reply-To: References: MIME-Version: 1.0 X-IsSubscribed: yes From: Bernhard Reutner-Fischer gcc/fortran/ChangeLog: 2017-11-28 Bernhard Reutner-Fischer * module.c (struct pointer_info): Change binding_label to const pointer. (free_pi_tree): Do not free binding_label. (load_commons): Use stringpool for binding_label. (load_needed): Likewise. (read_module): Likewise. --- gcc/fortran/module.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 24e48c94c76..8f6dc9f2864 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -158,7 +158,8 @@ typedef struct pointer_info struct { gfc_symbol *sym; - char *true_name, *module, *binding_label; + const char *binding_label; + char *true_name, *module; fixup_t *stfixup; gfc_symtree *symtree; enum gfc_rsym_state state; @@ -242,7 +243,6 @@ free_pi_tree (pointer_info *p) { XDELETEVEC (p->u.rsym.true_name); XDELETEVEC (p->u.rsym.module); - XDELETEVEC (p->u.rsym.binding_label); } free (p); @@ -4646,7 +4646,7 @@ load_commons (void) while (peek_atom () != ATOM_RPAREN) { int flags; - char* label; + const char* bind_label; mio_lparen (); mio_pool_string (&name); @@ -4663,10 +4663,9 @@ load_commons (void) /* Get whether this was a bind(c) common or not. */ mio_integer (&p->is_bind_c); /* Get the binding label. */ - label = read_string (); - if (strlen (label)) - p->binding_label = IDENTIFIER_POINTER (get_identifier (label)); - XDELETEVEC (label); + mio_pool_string (&bind_label); + if (bind_label) + p->binding_label = bind_label; mio_rparen (); } @@ -4899,8 +4898,7 @@ load_needed (pointer_info *p) sym->name = gfc_dt_lower_string (p->u.rsym.true_name); sym->module = gfc_get_string ("%s", p->u.rsym.module); if (p->u.rsym.binding_label) - sym->binding_label = IDENTIFIER_POINTER (get_identifier - (p->u.rsym.binding_label)); + sym->binding_label = p->u.rsym.binding_label; associate_integer_pointer (p, sym); } @@ -5052,7 +5050,7 @@ read_module (void) pointer_info *info, *q; gfc_use_rename *u = NULL; gfc_symtree *st; - gfc_symbol *sym; + gfc_symbol *sym = NULL; get_module_locus (&operator_interfaces); /* Skip these for now. */ skip_list (); @@ -5075,7 +5073,7 @@ read_module (void) while (peek_atom () != ATOM_RPAREN) { - char* bind_label; + const char* bind_label; require_atom (ATOM_INTEGER); info = get_integer (atom_int); @@ -5084,11 +5082,9 @@ read_module (void) info->u.rsym.true_name = read_string (); info->u.rsym.module = read_string (); - bind_label = read_string (); - if (strlen (bind_label)) + mio_pool_string (&bind_label); + if (bind_label) info->u.rsym.binding_label = bind_label; - else - XDELETEVEC (bind_label); require_atom (ATOM_INTEGER); info->u.rsym.ns = atom_int; @@ -5265,10 +5261,7 @@ read_module (void) sym->module = gfc_get_string ("%s", info->u.rsym.module); if (info->u.rsym.binding_label) - { - tree id = get_identifier (info->u.rsym.binding_label); - sym->binding_label = IDENTIFIER_POINTER (id); - } + sym->binding_label = info->u.rsym.binding_label; } st->n.sym = sym;