<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 08/26/2015 06:46 PM, Swaroop Sridhar wrote:<br>
    <blockquote
cite="mid:BY2PR03MB2217952BE00855E92A4AC80FF6F0@BY2PR03MB221.namprd03.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
h5
        {mso-style-priority:9;
        mso-style-link:"Heading 5 Char";
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:10.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.Heading5Char
        {mso-style-name:"Heading 5 Char";
        mso-style-priority:9;
        mso-style-link:"Heading 5";
        font-family:"Times New Roman",serif;
        font-weight:bold;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:445851219;
        mso-list-type:hybrid;
        mso-list-template-ids:1865181072 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-text:"%1\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1
        {mso-list-id:1141843172;
        mso-list-type:hybrid;
        mso-list-template-ids:-1336133478 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
        {mso-level-text:"%1\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">Currently, the <span
            style="font-size:10.0pt;font-family:Consolas">
            alloca</span> instruction always allocates in the generic
          address space (0).<o:p></o:p></p>
        <p class="MsoNormal">This proposal is to extend the semantics of
          <span style="font-size:10.0pt;font-family:Consolas">
            alloca</span> instruction to allow allocation in any
          specified address space.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><b>Proposed Syntax<o:p></o:p></b></p>
        <p class="MsoNormal"><span
            style="font-size:10.0pt;font-family:Consolas"><result>
            = alloca [inalloca] <type> [, <ty>
            <NumElements>] [, align <alignment>]
            <b>[, <span style="color:black;background:white">addrspace
              </span><<span style="color:black;background:white">num</span>>]</b>
            ; yields type addrspace(num)*:result<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:10.0pt;font-family:Consolas"><o:p> </o:p></span></p>
        <p class="MsoNormal"><b>Motivation<o:p></o:p></b></p>
        <p class="MsoNormal">Managed language clients typically use
          address space 1 to represent GC-pointers.</p>
      </div>
    </blockquote>
    This is not an entirely accurate statement.  There are currently one
    in tree GC strategy which uses addrspace(1) for this purpose and two
    out of tree GCs.  Its not really fair to say there's a convention
    established.  <br>
    <blockquote
cite="mid:BY2PR03MB2217952BE00855E92A4AC80FF6F0@BY2PR03MB221.namprd03.prod.outlook.com"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal"><o:p></o:p></p>
        <p class="MsoNormal">Some managed clients (CLR, in particular)
          allow construction of GC pointers to stack locations.<o:p></o:p></p>
        <p class="MsoNormal">For example, MSIL instruction ldloca (ECMA
          335, p 370) creates a GC pointer to a stack local.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Creating an <span
            style="font-size:10.0pt;font-family:Consolas">
            addrespace(1)*</span> pointer to a stack location currently
          involves two steps: the
          <span style="font-size:10.0pt;font-family:Consolas">alloca</span>,
          and an <span style="font-size:10.0pt;font-family:Consolas">
            addrspacecast</span>.<o:p></o:p></p>
        <p class="MsoNormal">Managed code transformations (ex: <span
            style="font-size:10.0pt;font-family:Consolas">
            RewriteStatepointsForGC</span>) do not handle arbitrary
          address space casting.<o:p></o:p></p>
        <p class="MsoNormal">So, it is desirable to obtain the <span
            style="font-size:10.0pt;font-family:Consolas">
            addrespace(1)*</span> pointer by construction.</p>
      </div>
    </blockquote>
    I'm not directly opposed to this proposal, but I'm not really in
    support of it either.  I think there a number of smaller engineering
    changes which could be made to RewriteStatepointsForGC to address
    this issue.  I am not convinced we need to allow addrspace on
    allocas to solve that problem.<br>
    <br>
    More generally, I'm a bit bothered by how your asserting that a
    pointer to a stack based object is the same as a managed pointer
    into the heap.  They share some properties - the GC needs to know
    about them and mark through them - but they're also moderately
    different as well - stack based objects do not get relocated, heap
    ones do.  Given this differences, it's not even entirely clear to me
    that these two classes of pointers should be treated the same.  In
    particular, I don't see why RewriteStatepointsForGC needs to insert
    explicit relocations for stack based objects.  That makes no sense
    to me.<br>
    <br>
    I think it would help if we took a step back, summarized the
    requirements, and approached this anew.  I know that some of this
    has already been discussed off list, but given this has reached the
    point of making proposals to the community as a whole, I think the
    conversation needs be in public at this time.<br>
    <br>
    (I'll also reply to a couple of specific points down thread.)<br>
    <br>
    Philip<br>
  </body>
</html>