From owner-freebsd-current@freebsd.org Mon Oct 9 21:54:50 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8124AE3D15D for ; Mon, 9 Oct 2017 21:54:50 +0000 (UTC) (envelope-from davidtgoldblatt@gmail.com) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 15B688175A for ; Mon, 9 Oct 2017 21:54:50 +0000 (UTC) (envelope-from davidtgoldblatt@gmail.com) Received: by mail-wm0-x232.google.com with SMTP id 196so13250707wma.1 for ; Mon, 09 Oct 2017 14:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=ryyFesCu4/nQu5+q+yxPQikzRES96hRxemIIC6GQevA=; b=Ffupr+k2VBSqMm8xbwWzwD8w09Ety2QmwdRcAf4878aOVqI6zrW9Ua8JbfiYhyedT7 oKDjS1USMIgzsaA5YAE0EmekSfv4Fyrig8jQv2tp6VeCF+3kzQYuVNw1hiyuGV3QTpws ov03ip80+e76Mo3g2v8xL4jObiF11Ke4k/MOUUnQpAqoB1Nz3aJ367YDFVP/acC3eHsb +hsfhJXxjrV8uZ3c0S2K+wtH7jtgQUSWl304S2Q39HVzxIo+Js6I3+oXCHebJQNfzdZ8 jcdRcsfmr3uxgMv27+NioehWTSOP4O9mGrHw2LcmQ+kI8Ng6x86nGg2SpBncqU5P62qI C8BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=ryyFesCu4/nQu5+q+yxPQikzRES96hRxemIIC6GQevA=; b=TwDf7hGaOwK8XWmDafWMYKLbsPZMTguaHATJIKLngTffyki40WzWfyDC2XcHjQGHZB +8DF3o7pdan3i5q5r9KNYoYe8lxXiurNSNQ92xQQQujLBkb0dmUB06nNNyf3ZD6R3ZED G7hBN0E/H8J/2LWMobsffZe+nG6LXP8FRALb02ilOxVFamzRzaeF9QlhPrOKytFJeodK Stt5rk7O0g4H3XShnM/2jC5ivIQwVOzsYbll/yzMKcfMgBJDIRNzRu0B2A3AEpUo3b8S jLtfmKi8+yL6AEyB1tKTfkCSxZNkDJNQOy1rMeO53lvoj+a0XvHF0fNVvY+qZYfQPAa0 DRtw== X-Gm-Message-State: AMCzsaXT8S5r52KXH0LcMrFEaScdbDY2zYkxTnL6GmRwgJ+OrOFsa8+R hmMjIXjfWNbGGtCUFQQmAXxQgE5c9G03A2ptZOTZatxV X-Google-Smtp-Source: AOwi7QDHoDBrXlEMtfEt2610nrkMwI69Uc+MY9TGjSdgbLX6ZVv8SwjFh1TMRVngIxxWO+Ks+ad0JWwTBpUtAW6tF3k= X-Received: by 10.223.197.203 with SMTP id v11mr11948249wrg.0.1507586088115; Mon, 09 Oct 2017 14:54:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.21.196 with HTTP; Mon, 9 Oct 2017 14:54:47 -0700 (PDT) In-Reply-To: References: From: David Goldblatt Date: Mon, 9 Oct 2017 14:54:47 -0700 Message-ID: Subject: Re: C++ in jemalloc To: FreeBSD Current Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Oct 2017 21:54:50 -0000 Re: the risk of dependencies on the C++ runtime. (apologies Konstantin, your email got trapped in a spam filter; "It is in violation of Google's recommended email sender guidelines", according to GMail). Avoiding C++ runtime dependencies is fairly straightforward in practice (e.g. a program that doesn't use *use* thread-local objects with destructors won't link against cxa_thread_atexit; similarly, -fno-exceptions and -fno-rtti and their equivalents are widely available). It's impossible of course to guarantee that FreeBSD won't ever want to switch to a (not-yet-written, afaik) compiler + ABI combo that doesn't admit a runtime-less C++, but that seems unlikely (and, if it were to happen, it would take enough years of notice and effort that porting the allocator back to C would be a small relative cost). We also test bootstrapping behavior against the libcs that we care about, so that we get some relatively good signal that everything will integrate correctly on a per-jemalloc-commit basis (we don't try to test against FreeBSD head, but I don't think that's necessarily a feasible strategy). I'm sympathetic to the costs of the added compiler required for those building libc, but weighing it against the ongoing maintenance drag on our end, it seems like a no-brainer (especially when we already come with dependencies outside of just the compiler and base build system). - David On Thu, Oct 5, 2017 at 11:59 AM, David Goldblatt wrote: > Hi all, > > The jemalloc developers have wanted to start using C++ for a while, to > enable some targeted refactorings of code we have trouble maintaining due > to brittleness or complexity (e.g. moving thousand line macro definitions > to templates, changing the build->extract symbols->rebuild mangling scheme > for internal symbols to one using C++ namespaces). We'd been holding off > because we thought that FreeBSD base all had to compile on GCC 4.2, in > order to support some esoteric architectures[1]. > > The other day though, I noticed that there is some C++ shipping with > FreeBSD; /usr/bin/dtc and /sbin/devd (the former claiming in the HACKING > document that C++11 is a minimum for FreeBSD 11). This, combined with the > fact that ports now points to a modern gcc, makes me think we were > incorrect, and can turn on C++ without breaking FreeBSD builds. > > Am I right? Will anything break if jemalloc needs a C++ compiler to build? > We will of course not use exceptions, RTTI, global constructors, the C++ > stdlib, or anything else that might affect C source or link compatibility. > > Thanks, > David (on behalf of the jemalloc developers > > [1] That being said, we don't compile or test on those architectures, and > so probably don't work there in the first place if I'm being honest. But > we'd also like to avoid making that a permanent state of affairs that can't > be changed. >