From patchwork Thu Dec 2 00:47:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 48379 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 10AEB3858431 for ; Thu, 2 Dec 2021 00:49:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10AEB3858431 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1638406177; bh=1JX5nO+2vmouOM0TvIshJ1tEkCu9KFfU13gObbI7dFw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Bp25nKjLyhouZkEQFPkYRmH2//ur10lLX/7Cwkwf0GviVzva2G/pEjGhJJNf9Cdwf D1c2emuyl4nueJncI+2lqBLfwUo6l97B+CEbCHB8g16n+axzJCRQuOMEzNeSgNi9sl zEgSel73rrEElxEoKXSXojxjmhIEUky1byJSwQ48= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by sourceware.org (Postfix) with ESMTPS id D260F3857805 for ; Thu, 2 Dec 2021 00:48:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D260F3857805 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4J4HPV0SL5zQjxM; Thu, 2 Dec 2021 01:48:14 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de To: gcc-patches@gcc.gnu.org Subject: [committed] d: Disable the D runtime garbage collector after initializing (PR103520) Date: Thu, 2 Dec 2021 01:47:59 +0100 Message-Id: <20211202004759.426907-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-Spam-Status: No, score=-15.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP 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: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, This patch disables the D runtime garbage collector after initializing. Not all targets that support building libdruntime have a stable garbage collector, so to avoid running into problems where live memory allocated by the D GC is freed, disable all in-flight collections until a time when scanning is more reliably implemented everywhere. Bootstrapped and regression tested on aarch64-linux-gnu, and committed to mainline. Regards, Iain. --- gcc/d/ChangeLog: PR d/103520 * d-frontend.h (gc_disable): Declare. * d-lang.cc (d_init_options): Disable the D runtime garbage collector after initializing. --- gcc/d/d-frontend.h | 2 +- gcc/d/d-lang.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/d/d-frontend.h b/gcc/d/d-frontend.h index 3edf812212a..e7695d5718b 100644 --- a/gcc/d/d-frontend.h +++ b/gcc/d/d-frontend.h @@ -21,7 +21,7 @@ along with GCC; see the file COPYING3. If not see /* These functions are defined in D runtime. */ extern "C" int rt_init (void); extern "C" int rt_term (void); -//extern "C" void gc_disable (void); +extern "C" void gc_disable (void); extern "C" void *gc_malloc (size_t sz, unsigned ba = 0, const void *ti = NULL); extern "C" void gc_free (void *); extern "C" void gc_collect (void); diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc index d20370e5d8a..dbf7a8b60b9 100644 --- a/gcc/d/d-lang.cc +++ b/gcc/d/d-lang.cc @@ -288,7 +288,7 @@ d_init_options (unsigned int, cl_decoded_option *decoded_options) { /* Initialize the D runtime. */ rt_init (); -// gc_disable (); + gc_disable (); /* Set default values. */ global._init ();