From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 214AE385C41E for ; Wed, 11 May 2022 11:51:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 214AE385C41E Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-663-S1dLY7KOMtuibzSm2DXKQw-1; Wed, 11 May 2022 07:51:31 -0400 X-MC-Unique: S1dLY7KOMtuibzSm2DXKQw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 61D89811E7A; Wed, 11 May 2022 11:51:31 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.249]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D73E97AE2; Wed, 11 May 2022 11:51:30 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 24BBpSFp025236 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 11 May 2022 13:51:28 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 24BBpRVB025235; Wed, 11 May 2022 13:51:27 +0200 Resent-From: Jakub Jelinek Resent-Date: Wed, 11 May 2022 13:51:27 +0200 Resent-Message-ID: Resent-To: Xi Ruoyao , GCC Patches , JonY <10walls@gmail.com> Date: Tue, 10 May 2022 16:28:08 +0200 From: Jakub Jelinek To: LIU Hao Cc: Xi Ruoyao , GCC Patches , JonY <10walls@gmail.com> Subject: Re: [PATCH] Remove size limit of PCH Message-ID: Reply-To: Jakub Jelinek References: <832727a2e1f6dbe0564dc57843b4702073563e64.camel@xry111.site> <2eaf9cb8-c215-4595-1dca-4261f88fe4e3@126.com> MIME-Version: 1.0 In-Reply-To: <2eaf9cb8-c215-4595-1dca-4261f88fe4e3@126.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2022 11:51:36 -0000 On Tue, May 10, 2022 at 09:30:03PM +0800, LIU Hao via Gcc-patches wrote: > From 2e314baed84fd80b3b3c4c67787a032b86dd54dc Mon Sep 17 00:00:00 2001 > From: LIU Hao > Date: Tue, 10 May 2022 13:19:07 +0800 > Subject: [PATCH] [PR14940] Remove size limit of PCH > > There shouldn't be such a limit in practice. > > 2022-05-03 LIU Hao > > PR pch/14940 > * config/i386/host-mingw32.cc (pch_VA_max_size): Remove. > (mingw32_gt_pch_get_address): Remove size limit. This looks reasonable, but doesn't contain the most important part. As mentioned in https://gcc.gnu.org/r12-5855 the generic part can now support relocation of PCH, so it is fine if it is mapped at some other address, it is preferrable if it is mapped at the same address as it was written for, but if not, the generic code can relocate it. So, beyond your changes, I'd suggest to change: /* Retry five times, as here might occure a race with multiple gcc's instances at same time. */ for (r = 0; r < 5; r++) { mmap_addr = MapViewOfFileEx (mmap_handle, FILE_MAP_COPY, 0, offset, size, addr); if (mmap_addr == addr) break; if (r != 4) Sleep (500); } if (mmap_addr != addr) { w32_error (__FUNCTION__, __FILE__, __LINE__, "MapViewOfFileEx"); CloseHandle(mmap_handle); return -1; } IMHO you can just drop the loop, sleep of half a second is almost certainly slower than the relocation handling, so I'd just mmap_addr = MapViewOfFileEx (mmap_handle, FILE_MAP_COPY, 0, offset, size, addr); if (mmap_addr == NULL) { w32_error (__FUNCTION__, __FILE__, __LINE__, "MapViewOfFileEx"); CloseHandle(mmap_handle); return -1; } addr = mmap_addr; This, if it mmaps the file at the right address, nice, if not, let the caller know (through updating addr) that it needs to relocate it, but if the mapping failed, fail. Jakub