<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
For the record, at least two other implementation strategies to
address the original problem have been discussed.<br>
<br>
Option 1 (Rejected) - Explode the stack based object into individual
fields individual fields before the safepoint and store them back
into the alloca afterwards. Only the exploded SSA values would get
listed in the stackmap. This could work today, but does not meet a
functional requirement. A pointer to a stack based object can be
escaped and a callee (or another thread) can write to the field
location. As a result, the reform of the stack based object after
the safepoint can introduce writes which didn't exist in the
original program.<br>
<br>
Option 2 - Consider pointers within stack based objects (allocas in
addrspace 0) as being live and add their addresses (not values) to
the stackmap. This could be done by extending the liveness analysis
already in RewriteStatepointsForGC to consider allocas containing
pointers. There wouldn't be any addrspace casts involved since the
members of the stack based object are addrspace(1) pointers to start
with. Loading them produces an SSA value which can be relocated as
usual. I don't remember hearing a clearly expressed reason why this
doesn't work. I believe there were some concerns about the
density/size of the generated stack maps, but I haven't seen any
evaluation of this. <br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 08/26/2015 06:46 PM, Swaroop Sridhar
wrote:<br>
</div>
<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.<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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Swaroop.<o:p></o:p></p>
</div>
</blockquote>
<br>
</body>
</html>