From patchwork Tue May 10 11:35:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LIU Hao X-Patchwork-Id: 1629082 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=xSyEOmAe; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KyGFq4sC7z9sGF for ; Tue, 10 May 2022 21:36:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ECE2F3959CB4 for ; Tue, 10 May 2022 11:36:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECE2F3959CB4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652182571; bh=4lrxL/AsRBoKaDUNdgy+w2CBUZiNnO9kLvO4XNwr62E=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=xSyEOmAeqSVZI9Cv0BhnEhHe6EqeQ5U/rZr0VwVrLVJhSMVjEgbZxfo9IOFq0TuUA 5ZD2imnPG9YO+bQnLW3KsnEhN6VxsJsj01TtTwjdkrIj04o5RET2HfKLeIRpDMnvnj kOimQrc8tEw3coLSsdKs2GCNxUd1hs8EkSetgCs4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from m15114.mail.126.com (m15114.mail.126.com [220.181.15.114]) by sourceware.org (Postfix) with ESMTP id 1B78E3959C85 for ; Tue, 10 May 2022 11:35:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1B78E3959C85 Received: from [192.168.1.2] (unknown [101.93.193.108]) by smtp7 (Coremail) with SMTP id DsmowADntfELTnpipXGXBQ--.56467S2; Tue, 10 May 2022 19:35:41 +0800 (CST) Message-ID: Date: Tue, 10 May 2022 19:35:40 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Content-Language: en-US To: GCC Patches , JonY <10walls@gmail.com> Subject: [PATCH] Remove size limit of PCH X-CM-TRANSID: DsmowADntfELTnpipXGXBQ--.56467S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxU3WrWDUUUU X-Originating-IP: [101.93.193.108] X-CM-SenderInfo: 5okbz0xxvhqiyswou0bp/1tbikw38RlpEEFSM6QAAsb X-Spam-Status: No, score=-3134.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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-Patchwork-Original-From: LIU Hao via Gcc-patches From: LIU Hao Reply-To: LIU Hao Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Remove the limit and solve https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14940. I have tested the patch on `x86_64-w64-mingw32` with MSVCRT, by pre-compiling a header of many standard and boost headers to generate a 313-MiB-large .gch file and using it to compile a simple 'hello world' program, and seen no problems so far. After eighteen years this has eventually been settled. (sigh) diff --git a/gcc/config/i386/host-mingw32.cc b/gcc/config/i386/host-mingw32.cc index 3b0d83ffc60..f915b85abd0 100644 --- a/gcc/config/i386/host-mingw32.cc +++ b/gcc/config/i386/host-mingw32.cc @@ -44,9 +44,6 @@ static size_t mingw32_gt_pch_alloc_granularity (void); static inline void w32_error(const char*, const char*, int, const char*); -/* FIXME: Is this big enough? */ -static const size_t pch_VA_max_size = 128 * 1024 * 1024; - /* Granularity for reserving address space. */ static size_t va_granularity = 0x10000; @@ -88,9 +85,6 @@ static void * mingw32_gt_pch_get_address (size_t size, int) { void* res; - size = (size + va_granularity - 1) & ~(va_granularity - 1); - if (size > pch_VA_max_size) - return NULL; /* FIXME: We let system determine base by setting first arg to NULL. Allocating at top of available address space avoids unnecessary @@ -100,7 +94,7 @@ mingw32_gt_pch_get_address (size_t size, int) If we allocate at bottom we need to reserve the address as early as possible and at the same point in each invocation. */ - res = VirtualAlloc (NULL, pch_VA_max_size, + res = VirtualAlloc (NULL, size, MEM_RESERVE | MEM_TOP_DOWN, PAGE_NOACCESS); if (!res) @@ -150,7 +144,7 @@ mingw32_gt_pch_use_address (void *&addr, size_t size, int fd, /* Offset must be also be a multiple of allocation granularity for this to work. We can't change the offset. */ - if ((offset & (va_granularity - 1)) != 0 || size > pch_VA_max_size) + if ((offset & (va_granularity - 1)) != 0) return -1;