<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="en-CZ" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">It seems that there are some issue delivering my replies, so forwarding to
</span><span style="font-size:11.0pt;mso-fareast-language:EN-US"> </span><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">directly:</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Brian Goetz <notifications@github.com><br>
<br>
</span><o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt">In reviewing this PR, I noticed a vestige of an earlier abandoned
<br>
direction, which is CodeElement.Kind.  There are Kind values for <br>
PARAMETER_ANNOTATION (basically unused), TYPE_ANNOTATION (misused), and <br>
you added one for STACK_MAP.  I think all three of these should be <br>
replaced with a single ATTRIBUTE kind, and the codeKind() of any <br>
attribute that extends CodeElement should be ATTRIBUTE.  The END kind is <br>
also effectively dead and should be removed (it is used only by a dead <br>
opcode.)</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">OK, I’ll work on
</span><span style="font-size:11.0pt">CodeElement.Kind</span><span lang="EN-US" style="font-size:11.0pt"> removal.</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt"><br>
<br>
This vestige is also present in your stack map attribute:<br>
<br>
        @Override<br>
        public Opcode opcode() {<br>
            return Opcode.TYPE_ANNO;<br>
        }</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">I cannot find this one.</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt"><br>
<br>
which is clearly the wrong opcode to return for stack maps, but its also <br>
the wrong thing to return for type annotation attributes as well.  <br>
Probably best to create a pseudo opcode for ATTRIBUTE to return in these <br>
places too.<br>
<br>
<br>
</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">OK, will use common pseudo opcode ATTRIBUTE.
</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt"><br>
My reading of this PR is that:<br>
<br>
 - You add a new option, PROCESS_STACK_MAP<br>
 - The behavior of PSM is to deliver the StackMap attribute whole when <br>
iterating the code elements (as we do with e.g. RVTA).<br>
 - If SM generation has been disabled, and the user has send a stack <br>
map attribute to the builder, we can write that (?)</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Yes.</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt"><br>
<br>
I like that you have to disengage the automatic stack map generation in <br>
order to be able to generate your own, but this last bullet still makes <br>
me a little uncomfortable.  I'll think about how to make this more clear.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">It is an important corner-case (<5%), so we agreed it can be a bit uncomfortable.</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt"><br>
<br>
In any case, I think you have a bug in DirectCodeBuilder::buildContent.  <br>
You either generate or reuse a stack map attribute, *and then you write <br>
all the attributes*. This looks like it may case a second SMA to be <br>
written in some cases.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">If user provides custom SMA and does not disable generation/reuse – it is overridden.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">AttributeHolder::withAttribute checks if AttributeMapper::allowMultiple and overrides the user provided SMA with the generated/reused one.
</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt"><br>
<br>
The stack map attribute is similar to the bootstrap methods attribute; <br>
while it is an attribute, it is logically part of, and tightly coupled <br>
to, something else (for BMA, the constant pool.)  When we write the <br>
Class attributes, we explicitly filter the BMA; we should probably do so <br>
here -- instead of attributes.writeTo, we should iterate the attributes <br>
and write all but a SMA.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">SMA has special treatment - it is not streamed. When SMA appears in attributes, it is always explicitly user-provided instance.
</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">If user reads or transforms a class and needs to access original SMA, it is available in the model only (not in the stream).
</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">User can manually pass original (or modified) SMA to the CodeBuilder and it will be applied only when SM generation is disabled.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">No standard transformation will pass SMA through.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">This was the latest output from our SMA-treatment discussions.</span><span style="font-size:11.0pt"><br>
<br>
<br>
</span><o:p></o:p></p>
<p><span style="font-size:12.0pt;color:#666666"> </span><o:p></o:p></p>
</div>
</body>
</html>