220 40320 <CAMD6iD_1Xqqa7Qjv35FaCH1Q39Jitr8Okwds-_2i0wWxz6EEYA@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ren Industries <renindustries@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Runtime code generation and self modifying code
Date: Thu, 4 Oct 2018 20:57:47 -0400
Lines: 100
Approved: news@gmane.org
Message-ID: <CAMD6iD_1Xqqa7Qjv35FaCH1Q39Jitr8Okwds-_2i0wWxz6EEYA@mail.gmail.com>
References: <4489f889-977c-45f2-8a2f-186ee3b06bff@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="000000000000ce3d65057770c21c"
X-Trace: blaine.gmane.org 1538700957 1158 195.159.176.226 (5 Oct 2018 00:55:57 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 5 Oct 2018 00:55:57 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDILF3OBTACRBGPO3LOQKGQEQBRF23Y@isocpp.org Fri Oct 05 02:55:53 2018
Return-path: <std-proposals+bncBDILF3OBTACRBGPO3LOQKGQEQBRF23Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it1-f199.google.com ([209.85.166.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDILF3OBTACRBGPO3LOQKGQEQBRF23Y@isocpp.org>)
	id 1g8EPI-0000Bt-Gf
	for gclcip-std-proposals@m.gmane.org; Fri, 05 Oct 2018 02:55:52 +0200
Original-Received: by mail-it1-f199.google.com with SMTP id e197-v6sf464573ita.9
        for <gclcip-std-proposals@m.gmane.org>; Thu, 04 Oct 2018 17:58:03 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1538701082; cv=pass;
        d=google.com; s=arc-20160816;
        b=JtL2NBJuf2+Ti3CHviVigYLTMafw1L0k9dxssA6NKMQTeHb4Q+gfVyTQCuku1Oxa+t
         CsCjYn4bHR7DH4QHR+bK1uphhnaDf+qcqS5QG22X/lzYHpgSMyKCcJW6kzv1JwAoJeru
         Cd2tshr2EGQP8LhM9io4tJfJsjnoLLutIxS6WRF6ytni0AX7xMqbofNRPE2a4pSuD5l7
         0sFBDud6WgQkQHolmjXqqcW05ifiglTu3u0iVvfhr/YfRCC55JJI0Fbe2OX1h44ooQy6
         QCvAhwfooksE91g55QJqAow9X4e9ak647DMg4mLt6YWXvOZ6ie9k/nJBITDNyGd3k6iG
         Q+EA==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:in-reply-to:references:mime-version:dkim-signature;
        bh=wFdTX4/vezcPOFvz/d3Mn2MRlz+yfUFIJKjyQ5JS0yI=;
        b=vFzwQouExUfx5anaGqjiWJpHD9ct8Bz/LUSApCNUm6lq40wbIO9ttnTqgd4FivHfrH
         2p4rx+yvl5lLFqTqNQBxkVUiHC+NNLT7IPF0fZYK1mVntpB8DI12sVLcXteGm/r5i5tw
         ezszTUM8nd2K5ms/ehmka7AmzD7Dh0YypafXO70wWVvNKJQiLKDcSxRxzS+9zEC5FdsP
         hh3ilDGqDH/qGuB7Ee//RVqpTUbFQ6ELK3pnK+Zza61LTU+aRXEGPHhyfaAyLFLxAkZk
         ikDQV1jHsD21ErimJf9MoHQj5bhr7W2BlP67bSYD5vViOgqb7vUM0pg81rAxyrIfsHVC
         V4nw==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=FDeyJwpY;
       spf=pass (google.com: domain of renindustries@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=renindustries@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:references:in-reply-to:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=wFdTX4/vezcPOFvz/d3Mn2MRlz+yfUFIJKjyQ5JS0yI=;
        b=YbS4KqgEALhaxezp1ynjkogw45rrKanaFDKgoE/QlJwxigvW26dhpFxPGizIhRW4v8
         jl9iVpIiIAm+V3cIyDFa0U40mGhFR4a3pv3Msjk3yK3/gTqOMCPKDtaMsZFDQah+nSyV
         0O66eIMMSJ03UWMzIJk0EehJsw5fCnwIAZMcdY1Wn2WVNT8MX2BTQPjPih8rJ1AldrJn
         d9hwdg2ersKQwi2xLNRUKNpwDav4ix4eoHum5agSxjbPezLFKWW12TyHXjUi4KDh6l6o
         pHoX58bGYCcfg57FfEezG6bTwjllpqlRqOGKkcu85Gjwu+h5/bpMfXpnvK4nsMEvEAb8
         tXJg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=wFdTX4/vezcPOFvz/d3Mn2MRlz+yfUFIJKjyQ5JS0yI=;
        b=UPRqzF6qBGYUY/JptMYl0DrZTWq6GmWfMJGdCbPDG1p8aW9CoEnM9TYPehy1DAPjJQ
         +cAQPnwP3evLeNJaV45v/6SBf640UNdY5fOkIX/9GRpc2uT3+kBUBeOsJEmmFW3KNoTx
         iuKBBW7U0mw8RhqZ6K1ctVA5tkT5oqsesC/1U1IThfpLzHP5I7sWplL0Dyo/Lwpiqw/u
         d7um8nBJhz0CDIN3+nA/sLSNZhU7VnNBMRygwcZ8v8M7vonPP4V4Lmtlb5a5+M2cnDRx
         DMIa+O580wfYOBHN6LoHokl27Wh5SSelTo30PE+uyvDbnD7h4ufhGEVOZJ+4wDca225U
         ci1A==
X-Gm-Message-State: ABuFfoiy5WjvBaPONUaJOoVtnArOuNOrrX3UMTvxv5AKu8hTrTSBiIFJ
	+8UKcU+dFqMPOCJWVE52NtdZ5Q==
X-Google-Smtp-Source: ACcGV62udhQWJ43YstFV7PRQjqURxqTKRaMghoHe14OIn/R2BgvK9fuP79CJT+mKFHbUJcisL35unA==
X-Received: by 2002:a24:7c48:: with SMTP id a69-v6mr6786193itd.15.1538701082389;
        Thu, 04 Oct 2018 17:58:02 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a24:2c91:: with SMTP id i139-v6ls93481iti.4.canary-gmail;
 Thu, 04 Oct 2018 17:58:01 -0700 (PDT)
X-Received: by 2002:a24:255:: with SMTP id 82-v6mr6853985itu.144.1538701073459;
        Thu, 04 Oct 2018 17:57:53 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1538701072; cv=none;
        d=google.com; s=arc-20160816;
        b=SDngqQ4CnUeS47lHnAPreVY2FYaZjHuslx3vkKu7zYYPu865vcsO7gtlQncIn22DaT
         kEy0MHHT+qxlSEHxhJHVl9yiAmvpuRmEi+F3b3+MvhcZ/DaK0HDkEyT/ZaMWTzQE9MaY
         Ncw6DfAm/rWchbegGSpMIOc39QMb7I5din7bVIf1uCyjeO0cQFzuscNPccoTHnMRXyxg
         uJlDPZkM1nYXOXsfoJCBcaUMUyArimj1Thyv7+zCoZd0QZYkjOx7LZh5Q86Q0Jb06akS
         ltQpaS9mWbG24wF8UV5k8GsfUJig8xEEdtnPnN61KP/0rv2V8/7RTu8pjlRUrLXGZVLW
         CLoA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:in-reply-to:references:mime-version
         :dkim-signature;
        bh=+r8Avugdv4ezbqkMVT49xtJcnAhnPc2i512bOh9+NZI=;
        b=A9yO/BqIQElhyiQvnywN0KWmYmrOzLd+DUyI4JFeU8s7EpJxih8sXtIWuE1IBvZNlG
         QuZY56Jbr8OW6zXi/4irrDExLB4dUs5MVk9j9qIVD8wmDqS70TJtjcydjwF9tH3fzQok
         FrB223VAFRLjZO41D9/hNrKt+UC7K4Hk7VFDuBXAe+kgw3MgPPPUbcUSBVHCneXe7tYG
         QJafAp/t0ugd9gknPf8rbws3IK26UE6+I+h8bTD5VUxJ9AFJgFFVfi5/nuAe0qqXoC9P
         R4uNKek++0/z203ky97Th3xqapdMI3paKyQq3AMx92nSUkR1qvMaQpgtINsUQ/v/l7xH
         ilaQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=FDeyJwpY;
       spf=pass (google.com: domain of renindustries@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=renindustries@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id d193-v6sor2934273ioe.130.2018.10.04.17.57.52
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Thu, 04 Oct 2018 17:57:52 -0700 (PDT)
Received-SPF: pass (google.com: domain of renindustries@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:a6b:610a:: with SMTP id v10-v6mr6611035iob.107.1538701071889;
 Thu, 04 Oct 2018 17:57:51 -0700 (PDT)
In-Reply-To: <4489f889-977c-45f2-8a2f-186ee3b06bff@isocpp.org>
X-Original-Sender: RenIndustries@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=FDeyJwpY;       spf=pass
 (google.com: domain of renindustries@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=renindustries@gmail.com;       dmarc=pass
 (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:40320
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40320>

--000000000000ce3d65057770c21c
Content-Type: text/plain; charset="UTF-8"

Couldn't a compiler just output that code for this idiom?
Sounds like a QOI issue.

On Thu, Oct 4, 2018 at 8:35 PM Matthew Fioravante <fmatthew5876@gmail.com>
wrote:

> One big area where dynamic languages are way ahead of C++ is runtime
> dynamic code generation or self modifying code.
>
>
> One tiny example is singleton initialization. The only safe way in C++ to
> do non-constexpr singletons is by lazy init.
>
> The problem with lazy init is that you have to pay for a branch on every
> access, and that usually involves an atomic check.
>
> What if you instead you atomically overwrote the check with NOPS. Then the
> branch is gone and accessing the object is as efficient as if it weren't
> lazy.
>
> Has anyone considered writing proposals for improving runtime code gen
> with C++?
>
> --
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/4489f889-977c-45f2-8a2f-186ee3b06bff%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/4489f889-977c-45f2-8a2f-186ee3b06bff%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAMD6iD_1Xqqa7Qjv35FaCH1Q39Jitr8Okwds-_2i0wWxz6EEYA%40mail.gmail.com.

--000000000000ce3d65057770c21c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Couldn&#39;t a compiler just output that code for this idi=
om?<div>Sounds like a QOI issue.</div></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr">On Thu, Oct 4, 2018 at 8:35 PM Matthew Fioravante &lt;<a h=
ref=3D"mailto:fmatthew5876@gmail.com">fmatthew5876@gmail.com</a>&gt; wrote:=
<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord=
er-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>One big area=
 where dynamic languages are way ahead of C++ is runtime dynamic code gener=
ation or self modifying code.<br></div><div><br></div><div><br></div><div>O=
ne tiny example is singleton initialization. The only safe way in C++ to do=
 non-constexpr singletons is by lazy init. <br></div><div><br></div><div>Th=
e problem with lazy init is that you have to pay for a branch on every acce=
ss, and that usually involves an atomic check.</div><div><br></div><div>Wha=
t if you instead you atomically overwrote the check with NOPS. Then the bra=
nch is gone and accessing the object is as efficient as if it weren&#39;t l=
azy.<br></div><div><br></div><div>Has anyone considered writing proposals f=
or improving runtime code gen with C++?<br></div></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/4489f889-977c-45f2-8a2f-186ee3b06bff%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/4489f889-977c-=
45f2-8a2f-186ee3b06bff%40isocpp.org</a>.<br>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAMD6iD_1Xqqa7Qjv35FaCH1Q39Jitr8Okwds=
-_2i0wWxz6EEYA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAMD6iD_1Xqqa7Qjv=
35FaCH1Q39Jitr8Okwds-_2i0wWxz6EEYA%40mail.gmail.com</a>.<br />

--000000000000ce3d65057770c21c--

.
