[{"id":1804284,"web_url":"http://patchwork.ozlabs.org/comment/1804284/","msgid":"<CAFiYyc3rZDSEp+X7-jtLaq8DbyULJyEnTNdBAPpuZWdYK3c2Kw@mail.gmail.com>","list_archive_url":null,"date":"2017-11-14T12:32:33","subject":"Re: RFA (hash-map): PATCH to support GTY((cache)) with hash_map","submitter":{"id":1765,"url":"http://patchwork.ozlabs.org/api/people/1765/","name":"Richard Biener","email":"richard.guenther@gmail.com"},"content":"On Fri, Sep 15, 2017 at 11:45 PM, Jason Merrill <jason@redhat.com> wrote:\n> The hash_map interface is a lot more convenient than that of\n> hash_table for cases where it makes sense, but there hasn't been a way\n> to get the ggc_cache_remove behavior with a hash_map.  In other words,\n> not marking elements during the initial ggc marking phase, but maybe\n> marking them during the clear_caches phase based on keep_cache_entry.\n>\n> This patch implements that by:\n>\n> Adding a ggc_maybe_mx member function to ggc_remove, and overriding\n> that instead of ggc_mx in ggc_cache_remove.\n> Calling H::ggc_maybe_mx instead of H::ggc_mx in gt_ggc_mx (hash_table *).\n> Calling H::ggc_mx in gt_cleare_caches (hash_table *) rather than\n> relying on an extern declaration of a plain function that cannot be\n> declared for hash_map::hash_entry.\n> Adding ggc_maybe_mx and keep_cache_entry to hash_map::hash_entry.\n> Adding gt_cleare_cache for hash_map.\n> Adding a boolean constant to the hash-map traits indicating whether we\n> want the cache behavior above.\n>\n> I then define a typedef tree_cache_map to use this functionality, and\n> use it in a few places in the C++ front end.\n>\n> Tested x86_64-pc-linux-gnu, OK for trunk?\n\nOk.\n\nRichard.","headers":{"Return-Path":"<gcc-patches-return-466727-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-466727-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"pRB1toJf\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3ybn3418Cmz9s82\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 14 Nov 2017 23:32:47 +1100 (AEDT)","(qmail 128729 invoked by alias); 14 Nov 2017 12:32:38 -0000","(qmail 127873 invoked by uid 89); 14 Nov 2017 12:32:36 -0000","from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com)\n\t(74.125.82.65) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tTue, 14 Nov 2017 12:32:35 +0000","by mail-wm0-f65.google.com with SMTP id r68so17834155wmr.0 for\n\t<gcc-patches@gcc.gnu.org>; Tue, 14 Nov 2017 04:32:35 -0800 (PST)","by 10.80.143.34 with HTTP; Tue, 14 Nov 2017 04:32:33 -0800 (PST)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type; q=dns; s=default; b=pMArmve7otdft1o\n\to/H5VMpmj5dOH/wARS7Cn6SAiR7eEFY7HrzmYvHFHzpwhBDTkt4kJtSoXNGGo6pR\n\tLPJvYSgeaHTgM9lWlr5i4p0WzbZlhPhciLF1hVy9GzoAqmtiGDlXGCCewtn44mNY\n\tseHJ1Wmo2dFtXIAQiRH46QaxMdf4=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type; s=default; bh=2ODR6AE8k5P4sSfXf47fT\n\thgB1uw=; b=pRB1toJfFhbSo8LBRTHQNEkEfV0PmUO3/FTqtyo4lQgi7Y1Pu3d0n\n\toiUxbwqvyD55xMwpOdMfm54X+43M6bqC1WVsx0SpmO/tULyc84lSCa5dokcxLeQ0\n\tb40R4pfUkMVpr8/QLlDtbHyZkZXip5G9Ksd/XGSfrlsb3cP2l31hDE=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-1.5 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=no version=3.3.2 spammy=","X-HELO":"mail-wm0-f65.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=B9+Nwt/RvnD4Hr9Nd1J9XJhmB+3Ra2d2jhDbpejtQqc=;\n\tb=JKnjuC0eQ2C3Y/LvH4k2C5VejaUha8bThkBfYShgvAJCUP1jUvSIPXYz7TFNmVjXi9\n\t9lmXxqcuylOLkzgDi/f9tBrcjnn6cW3srmMPdrHbVcsWseX/U5hC+NRqa3D/BaBu00eI\n\tPetSygr/tHjgUAkXJqwn9+uUAMX8IoK5vjXVKPv6AuYa+p0dTcSrDv5rDtzOhIA46xDL\n\tbPEc3EwG/40vvAiIUTHRs6fW8sVSFDS/E4WuQza7jE1669JRNxctO3AzlNUPAcMIQR/K\n\tdkCGzWzgJi8YWai3Ba5WN1sFFINiolcJ8E6H2xLfJTHzUQoRs+cpUlnBU6dlahCnRmc5\n\tcCiA==","X-Gm-Message-State":"AJaThX5TrG2yR4/TB1gc/RFY8GoU+R2CujrgfA66JUW559ENUzZtXqZW\tQ9munwUJ2N1WCOK6rZGOHSEjAFEBSubGfSd7rYH9Ag==","X-Google-Smtp-Source":"AGs4zMaXCr5ms9ltLYxH1lhTMCBC4Qwt0hN3d/5qDEcYOKP9nNZFw7SAi1HmaF8ze417niitrlgtdIYg66oeMFu9qr8=","X-Received":"by 10.80.217.15 with SMTP id t15mr17542506edj.217.1510662753752;\n\tTue, 14 Nov 2017 04:32:33 -0800 (PST)","MIME-Version":"1.0","In-Reply-To":"<CADzB+2n4mtiYNocfZYCE7xKwEf6aZW+QX9FdR05zf2a-9Qi4TQ@mail.gmail.com>","References":"<CADzB+2n4mtiYNocfZYCE7xKwEf6aZW+QX9FdR05zf2a-9Qi4TQ@mail.gmail.com>","From":"Richard Biener <richard.guenther@gmail.com>","Date":"Tue, 14 Nov 2017 13:32:33 +0100","Message-ID":"<CAFiYyc3rZDSEp+X7-jtLaq8DbyULJyEnTNdBAPpuZWdYK3c2Kw@mail.gmail.com>","Subject":"Re: RFA (hash-map): PATCH to support GTY((cache)) with hash_map","To":"Jason Merrill <jason@redhat.com>","Cc":"gcc-patches List <gcc-patches@gcc.gnu.org>","Content-Type":"text/plain; charset=\"UTF-8\"","X-IsSubscribed":"yes"}},{"id":1810084,"web_url":"http://patchwork.ozlabs.org/comment/1810084/","msgid":"<20171125194217.GA367@x4>","list_archive_url":null,"date":"2017-11-25T19:42:17","subject":"Re: RFA (hash-map): PATCH to support GTY((cache)) with hash_map","submitter":{"id":1014,"url":"http://patchwork.ozlabs.org/api/people/1014/","name":"Markus Trippelsdorf","email":"markus@trippelsdorf.de"},"content":"On 2017.11.14 at 13:32 +0100, Richard Biener wrote:\n> On Fri, Sep 15, 2017 at 11:45 PM, Jason Merrill <jason@redhat.com> wrote:\n> > The hash_map interface is a lot more convenient than that of\n> > hash_table for cases where it makes sense, but there hasn't been a way\n> > to get the ggc_cache_remove behavior with a hash_map.  In other words,\n> > not marking elements during the initial ggc marking phase, but maybe\n> > marking them during the clear_caches phase based on keep_cache_entry.\n> >\n> > This patch implements that by:\n> >\n> > Adding a ggc_maybe_mx member function to ggc_remove, and overriding\n> > that instead of ggc_mx in ggc_cache_remove.\n> > Calling H::ggc_maybe_mx instead of H::ggc_mx in gt_ggc_mx (hash_table *).\n> > Calling H::ggc_mx in gt_cleare_caches (hash_table *) rather than\n> > relying on an extern declaration of a plain function that cannot be\n> > declared for hash_map::hash_entry.\n> > Adding ggc_maybe_mx and keep_cache_entry to hash_map::hash_entry.\n> > Adding gt_cleare_cache for hash_map.\n> > Adding a boolean constant to the hash-map traits indicating whether we\n> > want the cache behavior above.\n> >\n> > I then define a typedef tree_cache_map to use this functionality, and\n> > use it in a few places in the C++ front end.\n> >\n> > Tested x86_64-pc-linux-gnu, OK for trunk?\n> \n> Ok.\n\nThe patch causes UB in some cases:\n \n gcc/hash-map.h:277:19: runtime error: member access within null pointer of type 'struct hash_map'","headers":{"Return-Path":"<gcc-patches-return-467901-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-467901-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"XoFf1Ufu\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3ykk3y6RvKz9s4s\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 26 Nov 2017 06:42:35 +1100 (AEDT)","(qmail 17548 invoked by alias); 25 Nov 2017 19:42:28 -0000","(qmail 17534 invoked by uid 89); 25 Nov 2017 19:42:27 -0000","from ud10.udmedia.de (HELO mail.ud10.udmedia.de) (194.117.254.50)\n\tby sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with\n\tESMTP; Sat, 25 Nov 2017 19:42:23 +0000","(qmail 14730 invoked from network); 25 Nov 2017 20:42:17 +0100","from ip5b405f48.dynamic.kabel-deutschland.de (HELO x4)\n\t(ud10?360p3@91.64.95.72) by mail.ud10.udmedia.de with ESMTPSA\n\t(ECDHE-RSA-AES256-SHA encrypted, authenticated);\n\t25 Nov 2017 20:42:17 +0100"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:references:mime-version\n\t:content-type:in-reply-to; q=dns; s=default; b=SwGsg9SiNo3NRTEyl\n\tdO3ux5cVuuqtMbTod41KVcT6s/AIlBri1DGVM8ZTCBzc4FoU7JXfw1jfl5k4wN5k\n\tT6LyOa5mlsuexlKnAZ5HetN6Jmpf2NTkUs5JZWDa0aEJ4wFTpxqNiC9xrxdljXxd\n\tHYdtQhN8mELcF6qDGi+s3thNfA=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:references:mime-version\n\t:content-type:in-reply-to; s=default; bh=mxzCGk52RJi5X8hQUYQef/R\n\tgMHQ=; b=XoFf1UfuUd43W3292miQqSWqOuSb4KY/LDz81kGM90Qd9rWB9a5wGyv\n\t+zo5+wpKy151ARPsqCwRyVi7fg9eV9LgmdfX9ZGi3kKglQzPQsSj9f4pOyCFYtDn\n\ti+la1ioHEjnbcYydpVY47VeeI/UfqouoPbWJY09peAfcdGRSeBts=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-3.2 required=5.0 tests=AWL, BAYES_00,\n\tKB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_LOW,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=traits,\n\thash_map","X-HELO":"mail.ud10.udmedia.de","Date":"Sat, 25 Nov 2017 20:42:17 +0100","From":"Markus Trippelsdorf <markus@trippelsdorf.de>","To":"Richard Biener <richard.guenther@gmail.com>","Cc":"Jason Merrill <jason@redhat.com>,\n\tgcc-patches List <gcc-patches@gcc.gnu.org>","Subject":"Re: RFA (hash-map): PATCH to support GTY((cache)) with hash_map","Message-ID":"<20171125194217.GA367@x4>","References":"<CADzB+2n4mtiYNocfZYCE7xKwEf6aZW+QX9FdR05zf2a-9Qi4TQ@mail.gmail.com>\n\t<CAFiYyc3rZDSEp+X7-jtLaq8DbyULJyEnTNdBAPpuZWdYK3c2Kw@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<CAFiYyc3rZDSEp+X7-jtLaq8DbyULJyEnTNdBAPpuZWdYK3c2Kw@mail.gmail.com>"}}]