220 40339 <CAFdMc-1qjWOE-7xWG+X01x9hO0jy-97qoeP89z+jf0+zuxxY-Q@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Daniel Gutson <danielgutson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Runtime code generation and self modifying code
Date: Fri, 5 Oct 2018 12:50:18 -0300
Lines: 196
Approved: news@gmane.org
Message-ID: <CAFdMc-1qjWOE-7xWG+X01x9hO0jy-97qoeP89z+jf0+zuxxY-Q@mail.gmail.com>
References: <4489f889-977c-45f2-8a2f-186ee3b06bff@isocpp.org> <CAHEh_GiUrVM=a7QK+iNuXqFwxXCLyMA7WiRfWmHo_qmceV9JSw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="0000000000001df48005777d3b1f"
X-Trace: blaine.gmane.org 1538754512 19773 195.159.176.226 (5 Oct 2018 15:48:32 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 5 Oct 2018 15:48:32 +0000 (UTC)
To: std-proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDE3NBMV6UFBBR4Q33OQKGQE45VXIRY@isocpp.org Fri Oct 05 17:48:28 2018
Return-path: <std-proposals+bncBDE3NBMV6UFBBR4Q33OQKGQE45VXIRY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf1-f71.google.com ([209.85.167.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDE3NBMV6UFBBR4Q33OQKGQE45VXIRY@isocpp.org>)
	id 1g8SL0-0004vv-7d
	for gclcip-std-proposals@m.gmane.org; Fri, 05 Oct 2018 17:48:22 +0200
Original-Received: by mail-lf1-f71.google.com with SMTP id a25-v6sf787360lfi.9
        for <gclcip-std-proposals@m.gmane.org>; Fri, 05 Oct 2018 08:50:33 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1538754632; cv=pass;
        d=google.com; s=arc-20160816;
        b=EfEYaJ9YFDMct9q4BP1PV7ZMywJlKYZW+1wcExS1ED6Ij1qBnXoc7D/aTJLKzuLb8J
         qNnwbGcFKysRoUKyeFt2Sww7B+mvkYLLF0dmz06XbAfbY3AVYMezp3gbxemLi7/m4yiw
         u6pn8+RasAtrqc8ciTBdQ230x7af8GHi6vL5ItwqTFY1XyuAWrgaKxhUjPuIojvIlhtN
         u2gSIIdMNhcDTT3ZNcvXwfhEXVKO4FWiHZ0A34pXGg3YgV8NZ2lzx5PfOK1az2LFOOcz
         gSuiL2CtjAIqUOJgczBoZoLd8AhnhxV57LzVnUMvCt7JupFhFPWZKBfDeu8zONUSpHfp
         349g==
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=FPV5yiroFoJAJHSXEqShgErmmdpd/XY1IkD6/v4Usd8=;
        b=f28AVW+TBbBTyoZj1FuNv8pmFKf0GAZbvDzYh/2gYzqJ2nQvtzrDovH7FTMfuhry1U
         v+fDBjs+b5boCUj/TzOEBXPMUnyuvmhlqVun0t2RIVlBINm8sy6hSlboUXtI5/BMP2PH
         jTSel6lm5WhK/4ZvNRvEb+gtW8LgyyX352/lkUX1SOOtoudHZ/pm6VMkMbi65RJyP6qL
         OMdqBr38X+GQARonVpNZH1RdPEetGYOZRxLuSDscdWrmgfj+1bu0hIfhk/5MOYeXX5BK
         Ogp+U8qfAQprZNEQUAb7iFqgUfnwGiLhVUt1AQBJVT6ULeFzxN9JGkzIY4dSsQNN7VT3
         MOaw==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=XJD0qscA;
       spf=pass (google.com: domain of danielgutson@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=danielgutson@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=FPV5yiroFoJAJHSXEqShgErmmdpd/XY1IkD6/v4Usd8=;
        b=nzB0h+FX+0F703h6ALBHvfBTiY4FPNBeUOZWblwzXZF9sZnZF0gUHQ5MlZiRmsunCE
         /6OVmXRkGlSRL9LMKi89bf0gnA+iNCPE3H0klIE4S0f/WaoStzXivx++sMU7ZpNdb6hU
         e7Lf8jeh4keh8HRhZbVgeF0Aa0pqFsxOHCfNSEJl0ONKKIkuXSHkguBPnE6JCKjrKg4E
         nA9WMn51+IRRlcJHqSkfCJD+yfFpCvAS9sSOaLmAbMvzHiJxeDNElKm4i2kNv3LWh+ps
         HoZFZSeRrtPeid7xOpmflHz72mXy97QabBRuLqiMK2uArczNpEhHDS9mcKqRQSLAerlZ
         x0bA==
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=FPV5yiroFoJAJHSXEqShgErmmdpd/XY1IkD6/v4Usd8=;
        b=Dip6936fAq6atJnQD85hjT9y3L5rNW+Vnrm73ia5EKN43z6fBNdAnJfsxKM7kINZbz
         gUyRtaYerOGjQsS6yN+pzyk5RHSYpnw12n485S0m7Eg0urSKTAJArCF+ZrXtYWm+iD27
         aHSy6D6lWtj6YbD7TbpUU6xGdMqkRtXY6OWl9QcpIeNO1hejILbt2+vmQHgfwmnrLJx6
         wXp6waEv4rj2DlOnk3PLbprgfg0SdDja90K6VW6nsi52IhrdQT6r64fngfaLX+o4wU5X
         qjBLjv0s+bHMafJM9OaPZ5RrtGvuvIQRvxGZJ9CZHfSdc7wVuyHwOs4ZakDH/+bPKzlJ
         GTgg==
X-Gm-Message-State: ABuFfoilEILb15jn+pTE3xlED1t3grjUqU2fqIbUk6xIaZYElWy2FK2L
	egM+AbCZFHDj+llxwa1Yt6uCqQ==
X-Google-Smtp-Source: ACcGV62qMd4XFls5lifkjDurMd4nJIDbfgSBjGlQfbh+PeiCB6Q8eCa6ljurweviCH+MEklaKZ2aDw==
X-Received: by 2002:a19:1a8d:: with SMTP id a135-v6mr351422lfa.0.1538754632819;
        Fri, 05 Oct 2018 08:50:32 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a2e:5988:: with SMTP id g8-v6ls152916ljf.10.gmail; Fri, 05
 Oct 2018 08:50:31 -0700 (PDT)
X-Received: by 2002:a2e:8514:: with SMTP id j20-v6mr6395887lji.111.1538754631012;
        Fri, 05 Oct 2018 08:50:31 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1538754630; cv=none;
        d=google.com; s=arc-20160816;
        b=IIGamM9XBCgeEYqdwN5dYBOVvCcCmIypQxgWiyqPV4DZBshxvc8Nfj+yLi48FgItL6
         TQ7ZTvkgnR3Bpu7x/4xjF8zRch6Fpi0LdoeKEtl5Kut/tIJE5BgeqTgjLC4kPSxeskcb
         ms4rbsJNLLvFIJ00z7fk4s+pF/TKfHkgy40b2Agb6pnQZSO0Y8wMb4QBIpU/k7rmWGtj
         nO+7HCKP1DiVWBsdDSmRE8QNPloJyajmqgiinCZZcC2WDrxBRIl+CSkCeTi6i62bilRF
         pnSejGbIzTClFamnj+KO+R6goqNygAqPWV5P/MV9aVJQdzKVGA5JmeV0d1pJoobsCy3m
         7wxQ==
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=mXK5R9RNhbyaWO+hMfPfwBDTxCTd94xSfrRb4b8JWKM=;
        b=sivDZCv/sm+unEpfLa7DLCSZxf5cxqvuxENWm+MdwNeC3mbxIAfOOyDGdfZ4wU954Y
         dMd7fcfcT8Wu7AXlBYGhSjAKZ2HKC2J+lSAZdc6o+2yrYD3wQvWRgVzkIkvYK872GJoB
         CtWNYvje1VtpqDEk+I78LCImBaEtxFpvlV0xv5iXnfClIITlsM0Pgv3MgiIhbxHv/mm3
         YIHMNwG9D26Px17x+g5OeRbWGxkS1HLs3/4reV1wDHQIs5guXwg3Nieq8fTg0guxnMK1
         2bLLTeBLAJxFztNE8mkW14ToaAPs5HEQTvdbd/agF0BXa/Y6i/RPg0tW3BBc+RFVyO0g
         YxfQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=XJD0qscA;
       spf=pass (google.com: domain of danielgutson@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=danielgutson@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 75-v6sor4943139ljs.2.2018.10.05.08.50.30
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Fri, 05 Oct 2018 08:50:30 -0700 (PDT)
Received-SPF: pass (google.com: domain of danielgutson@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:a2e:8ec6:: with SMTP id e6-v6mr6772377ljl.166.1538754629988;
 Fri, 05 Oct 2018 08:50:29 -0700 (PDT)
In-Reply-To: <CAHEh_GiUrVM=a7QK+iNuXqFwxXCLyMA7WiRfWmHo_qmceV9JSw@mail.gmail.com>
X-Original-Sender: danielgutson@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=XJD0qscA;       spf=pass
 (google.com: domain of danielgutson@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=danielgutson@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:40339
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40339>

--0000000000001df48005777d3b1f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

El vie., 5 de oct. de 2018 a la(s) 12:48, Rene Rivera (grafikrobot@gmail.co=
m)
escribi=C3=B3:

> While I understand, and concur, with others statements regarding code
> generation in the context of the the host program.. There are valid use
> cases for dynamic code generation. For example targeting emulators and
> GPUs. So perhaps you might want to rephrase your ideas in those terms.
>

former qemu developer here.
It is a super specific case, which should be handled by a library in the
best of cases.


>
>
> On Thu, Oct 4, 2018 at 7: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++ t=
o
>> 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 Group=
s
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n
>> 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-97=
7c-45f2-8a2f-186ee3b06bff%40isocpp.org
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/4489f889-9=
77c-45f2-8a2f-186ee3b06bff%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoo=
ter>
>> .
>>
>
>
> --
> -- Rene Rivera
> -- Grafik - Don't Assume Anything
> -- Robot Dreams - http://robot-dreams.net
>
> --
> 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/CAHEh_GiUrVM=
%3Da7QK%2BiNuXqFwxXCLyMA7WiRfWmHo_qmceV9JSw%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHEh_GiUrV=
M%3Da7QK%2BiNuXqFwxXCLyMA7WiRfWmHo_qmceV9JSw%40mail.gmail.com?utm_medium=3D=
email&utm_source=3Dfooter>
> .
>


--=20
Who=E2=80=99s got the sweetest disposition?
One guess, that=E2=80=99s who?
Who=E2=80=99d never, ever start an argument?
Who never shows a bit of temperament?
Who's never wrong but always right?
Who'd never dream of starting a fight?
Who get stuck with all the bad luck?

--=20
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 e=
mail 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/CAFdMc-1qjWOE-7xWG%2BX01x9hO0jy-97qoeP89z%2Bjf0%=
2BzuxxY-Q%40mail.gmail.com.

--0000000000001df48005777d3b1f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">El vie=
.., 5 de oct. de 2018 a la(s) 12:48, Rene Rivera (<a href=3D"mailto:grafikro=
bot@gmail.com">grafikrobot@gmail.com</a>) escribi=C3=B3:<br></div><blockquo=
te class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc so=
lid;padding-left:1ex"><div dir=3D"ltr">While I understand, and concur, with=
 others statements regarding code generation in the context of the the host=
 program.. There are valid use cases for dynamic code generation. For examp=
le targeting emulators and GPUs. So perhaps you might want to rephrase your=
 ideas in those terms.</div></blockquote><div><br></div><div>former qemu de=
veloper here.</div><div>It is a super specific case, which should be handle=
d by a library in the best of cases.</div><div>=C2=A0</div><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><div dir=3D"ltr"><div><br><br><div class=3D"gmail_quote"><di=
v dir=3D"ltr">On Thu, Oct 4, 2018 at 7:35 PM Matthew Fioravante &lt;<a href=
=3D"mailto:fmatthew5876@gmail.com" target=3D"_blank">fmatthew5876@gmail.com=
</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:=
0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><d=
iv>One big area where dynamic languages are way ahead of C++ is runtime dyn=
amic code generation or self modifying code.<br></div><div><br></div><div><=
br></div><div>One tiny example is singleton initialization. The only safe w=
ay in C++ to do non-constexpr singletons is by lazy init. <br></div><div><b=
r></div><div>The problem with lazy init is that you have to pay for a branc=
h on every access, and that usually involves an atomic check.</div><div><br=
></div><div>What if you instead you atomically overwrote the check with NOP=
S. Then the branch is gone and accessing the object is as efficient as if i=
t weren&#39;t lazy.<br></div><div><br></div><div>Has anyone considered writ=
ing proposals for 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><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"=
 class=3D"m_3651805369659113589gmail_signature" data-smartmail=3D"gmail_sig=
nature"><div dir=3D"ltr"><div><div dir=3D"ltr">-- Rene Rivera<br>-- Grafik =
- Don&#39;t Assume Anything<br>-- Robot Dreams -=C2=A0<a href=3D"http://rob=
ot-dreams.net/" target=3D"_blank">http://robot-dreams.net</a><br><br></div>=
</div></div></div></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/CAHEh_GiUrVM%3Da7QK%2BiNuXqFwxXCLyMA7=
WiRfWmHo_qmceV9JSw%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfoo=
ter" target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgid/std-p=
roposals/CAHEh_GiUrVM%3Da7QK%2BiNuXqFwxXCLyMA7WiRfWmHo_qmceV9JSw%40mail.gma=
il.com</a>.<br>
</blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"=
 class=3D"gmail_signature" data-smartmail=3D"gmail_signature">Who=E2=80=99s=
 got the sweetest disposition?<br>One guess, that=E2=80=99s who?<br>Who=E2=
=80=99d never, ever start an argument?<br>Who never shows a bit of temperam=
ent?<br>Who&#39;s never wrong but always right?<br>Who&#39;d never dream of=
 starting a fight?<br>Who get stuck with all the bad luck? </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">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/CAFdMc-1qjWOE-7xWG%2BX01x9hO0jy-97qoe=
P89z%2Bjf0%2BzuxxY-Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFdMc-1qjW=
OE-7xWG%2BX01x9hO0jy-97qoeP89z%2Bjf0%2BzuxxY-Q%40mail.gmail.com</a>.<br />

--0000000000001df48005777d3b1f--

.
