220 40338 <CAHEh_GiUrVM=a7QK+iNuXqFwxXCLyMA7WiRfWmHo_qmceV9JSw@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Rene Rivera <grafikrobot@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Runtime code generation and self modifying code
Date: Fri, 5 Oct 2018 10:48:17 -0500
Lines: 117
Approved: news@gmane.org
Message-ID: <CAHEh_GiUrVM=a7QK+iNuXqFwxXCLyMA7WiRfWmHo_qmceV9JSw@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="000000000000e641c105777d3323"
X-Trace: blaine.gmane.org 1538754385 10506 195.159.176.226 (5 Oct 2018 15:46:25 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 5 Oct 2018 15:46:25 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCTJDOM7YALBBTMP33OQKGQEZHJFX5A@isocpp.org Fri Oct 05 17:46:21 2018
Return-path: <std-proposals+bncBCTJDOM7YALBBTMP33OQKGQEZHJFX5A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qt1-f198.google.com ([209.85.160.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCTJDOM7YALBBTMP33OQKGQEZHJFX5A@isocpp.org>)
	id 1g8SJ1-0002ci-UX
	for gclcip-std-proposals@m.gmane.org; Fri, 05 Oct 2018 17:46:20 +0200
Original-Received: by mail-qt1-f198.google.com with SMTP id b55-v6sf11947964qtb.5
        for <gclcip-std-proposals@m.gmane.org>; Fri, 05 Oct 2018 08:48:30 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1538754510; cv=pass;
        d=google.com; s=arc-20160816;
        b=PayVtXW/sGLT8SPIwJJasZtu8bfaRsfGXHOOFrPVUze0vDh8hxMqosaOTckx8o1y/G
         a2I22mPMT9Sbzu1ZAm8WcccrFm1J9LXf0ViiA+/lxELroDVfdXOiE/wqUnz76RomvEnD
         w8A5piyN0Y0F3+ip+ztSUU8IxWck23iuMVzk0NbcrlS6t6a2kxAaDhIjJwoQAX1F0KLB
         biQtlsIhS3I2zxX00qBeK4Ca4x0XA9tr4OffFT5uQ+Ae08vX35ZKA16WHXILXJP/Q15D
         EeBq5J8dAtIBo7MZM8kUBCGYDvvzKEpDhURgic44Ydc3aNP7ld9oGsJGeSCy0oaCzLEq
         Bw0g==
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=bA2K7YiQg6xxE05h0NTzKukCe/1k/BrrSLmx4CXkgio=;
        b=z2Q4I67ItvRPFj1u0bUm4H25ShPWduSR21iwepPozg3/O09GdaUPGae4aCs3PWdXvU
         scNHxgA9WhrDt/vpaZmOhir87RdMBGSDDE4MQmjlQVCix1bL3JEzRXuQqcUxJeFJvyb+
         uvFmEwMqVCah/5ert/7zamvBq0uaR67KhcumRz9oQo6srkn76T3r8VrUf4LW93da1D2g
         rmAjwAga7sEuGKHhnP4F/cobdWQS87fMwfiE6BCsupTEkTZXOu75wFEfBBnZXz764c/Q
         ecMjjlJfiez0HHunrygSVd0B8OLYcgcVrhe0CghXAO/o+1GtgjzoQmn+G84Xh3M4iqOi
         X9qg==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=tE4Q2nmK;
       spf=pass (google.com: domain of grafikrobot@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=grafikrobot@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=bA2K7YiQg6xxE05h0NTzKukCe/1k/BrrSLmx4CXkgio=;
        b=EHKcw3HDLOSrGZd0nIr9qznAcKTzTNv8zsMqMWKgDimtVnvaN2Bvv+CIC81t1fVQWI
         t1kNvOsa7jXudYxqdpuSYTtRg3IBIO5jneqOyb8mk2wQSHhY3u6lT2Eev08C4uUV67ZA
         rY1ljVFTZGLbiLllDxqGnN4KRdf4fImdDKUttrvNft1/o35AC5txKybV7eCGO2jyOKGZ
         UM0v89p2KUYr8ghvMqaItisXo3bVJS6+4bva+RSi8LaK9JLPSuV+oK1LmHnlxG4Eavwv
         iigiGL6+Gs3JBPTfcHUJ0s/exQqEX+0ajd8wbBUcrVWQsLo02C0pkzhx5gh8fS1PtG13
         xdew==
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=bA2K7YiQg6xxE05h0NTzKukCe/1k/BrrSLmx4CXkgio=;
        b=LKFjmrTZgBv3lDpgYrz9Wej/58m9n5rHhSGbE4JyEly4bq0i8pTGNU48D97M1kTI0T
         IqfX0lBBrlUYfxoJeDSSupCzFzS5fQqvmidS36rookAn2XLUKMzKo/l8ouPGYSdFwwFX
         nGCWlEcjFsl6aRnm+KQ7lJP3ld1HFSWM0YeyijxqleNhvsXEwqXgsXOd/VPmAG/k9SSK
         ERrMidOMrw0SH676mHW7Sw2CFA2cbyjvuftK3lhcSfyeHJHEg+noeRwVhueDvMFHZXcq
         wza/LBRmpJY1Gr6UsB/mHG5uxWn1h5DsebJgMVq9APIUBc/xI55J/9KE+OKMnvnhhg8I
         igbg==
X-Gm-Message-State: ABuFfohgABcxsrRhU/kuUu+rJOyKZkZzPy4+FdhL6Ae8P8JAAFSn+TH4
	hu+CASxzYCFdHYlXtn5zo8r5sQ==
X-Google-Smtp-Source: ACcGV61M4rJHFSI/2/GPv28sfUxbGij+rEPtlJ2hMfZS8rK+b6CHnwE5loFdP12xHbQUC+fy5lxDSA==
X-Received: by 2002:a37:48d4:: with SMTP id v203-v6mr8500749qka.47.1538754510321;
        Fri, 05 Oct 2018 08:48:30 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a37:6105:: with SMTP id v5-v6ls3179492qkb.13.gmail; Fri, 05
 Oct 2018 08:48:29 -0700 (PDT)
X-Received: by 2002:a37:93c3:: with SMTP id v186-v6mr7795410qkd.186.1538754509421;
        Fri, 05 Oct 2018 08:48:29 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1538754509; cv=none;
        d=google.com; s=arc-20160816;
        b=D8dunkeJ0Brd9icwgoEGDt1M4Lj50tpJtuOhy8jVswgESRVdWowPh/wYQTf2FaGdXZ
         DKscsGvwl5/+gQ46YaLmk4nDhA4Qx3NJYap2lCELjId1kdpfrDiWwa4ASqyGFEoS74wH
         BKyIZmDfHDLImol7v6MTLVbozGh2rIf+lc6NE/whqzyAihz3v58ZKQsUb/8Y8eDts+VK
         /34KV5jev2vJ5G7EYc2zIoq92rnPi8JhNHLBjVL7n0F9g26W2GIZ4nn8TtUTw9vVUNKI
         v6aC4h87ZrMEMWGC8sxIGzl4bjWJ9PiQcNy9I/Bn//VaeFEQg6WtDuB++8O5udr6CJAQ
         tozw==
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=XKT7hvhdTM8B+k5iOB58INk2Bv1DpN/23bywnRu+3eE=;
        b=I38i0NOKshbEb8IFLZL3Q4KvkooF1UnL0mIiMOwLb5HdHoOjkfs5D063payyQsk3BM
         V1ykHrM/Qq8ImSq61BgC5Bohte5ODIBPKbqoZDcqS+9dOqqKiiQVQXrk/gYFIScYIaK1
         yOggDo0a+TOpXoh5TzBzsllHQNAGugwg0iRiDUnFp1XJGNWCIym3SD7ASjoLSVJBnq5k
         PWiLRGG4NHGQDrcNSXRaY8m6+HMYzzXTWmbv/amEZuOYn1zgLK4AgxBst8fvJLz4SY3s
         c5IIfSIen1YDGY+36YDk82KqgBwkzUNI0f/IgO0yL5fglJr41b+A15Woj0AwWgJ+Jdfo
         znyA==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=tE4Q2nmK;
       spf=pass (google.com: domain of grafikrobot@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=grafikrobot@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 m20-v6sor4296797qtf.49.2018.10.05.08.48.29
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Fri, 05 Oct 2018 08:48:29 -0700 (PDT)
Received-SPF: pass (google.com: domain of grafikrobot@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:ac8:435b:: with SMTP id a27-v6mr9575944qtn.295.1538754508897;
 Fri, 05 Oct 2018 08:48:28 -0700 (PDT)
In-Reply-To: <4489f889-977c-45f2-8a2f-186ee3b06bff@isocpp.org>
X-Original-Sender: grafikrobot@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=tE4Q2nmK;       spf=pass
 (google.com: domain of grafikrobot@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=grafikrobot@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:40338
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40338>

--000000000000e641c105777d3323
Content-Type: text/plain; charset="UTF-8"

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.


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++ 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>
> .
>


-- 
-- 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.

--000000000000e641c105777d3323
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">While I understand, and concur, with others statements reg=
arding code generation in the context of the the host program.. There are v=
alid use cases for dynamic code generation. For example targeting emulators=
 and GPUs. So perhaps you might want to rephrase your ideas in those terms.=
<div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Thu, Oct 4, 201=
8 at 7:35 PM Matthew Fioravante &lt;<a href=3D"mailto:fmatthew5876@gmail.co=
m">fmatthew5876@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmai=
l_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left=
:1ex"><div dir=3D"ltr"><div>One big area where dynamic languages are way ah=
ead of C++ is runtime dynamic code generation or self modifying code.<br></=
div><div><br></div><div><br></div><div>One tiny example is singleton initia=
lization. The only safe way in C++ to do non-constexpr singletons is by laz=
y init. <br></div><div><br></div><div>The problem with lazy init is that yo=
u have to pay for a branch on every access, and that usually involves an at=
omic check.</div><div><br></div><div>What if you instead you atomically ove=
rwrote the check with NOPS. Then the branch is gone and accessing the objec=
t is as efficient as if it weren&#39;t lazy.<br></div><div><br></div><div>H=
as anyone considered writing 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"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"l=
tr"><div><div dir=3D"ltr">-- Rene Rivera<br>-- Grafik - Don&#39;t Assume An=
ything<br>-- Robot Dreams -=C2=A0<a href=3D"http://robot-dreams.net/" targe=
t=3D"_blank">http://robot-dreams.net</a><br><br></div></div></div></div></d=
iv></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/CAHEh_GiUrVM%3Da7QK%2BiNuXqFwxXCLyMA7=
WiRfWmHo_qmceV9JSw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHEh_GiUrVM%=
3Da7QK%2BiNuXqFwxXCLyMA7WiRfWmHo_qmceV9JSw%40mail.gmail.com</a>.<br />

--000000000000e641c105777d3323--

.
