<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:12.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle25
{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="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt">
<b><span style="color:black">From: </span></b><span style="color:black">Brian Goetz <brian.goetz@oracle.com><br>
</span><span style="font-size:11.0pt;mso-fareast-language:EN-GB">That's what I thought. So, since they are only applied when you really need them, can't these be treated as "generate the classfile, and then traverse it as a classfile with the API we already
have?" This seems like it would work in all the cases when we *can* generate a classfile, which leaves the cases where we would fail to generate a classfile and therefore have nothing to analyze, which is probably a non-zero but not-large fraction of the
cases, right? <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-GB">Right, all these cases are to support generation in progress. Can we now even start transformation of a bytecode fragment that has not been
finished yet (with our current API) ?<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-GB">I think using transformations for these cases is an overkill. We just need to dynamically collect various information from the actual CodeBuilder.
These should be much tighter co-processors connected to CodeBuilder. <o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt">
<span style="font-size:11.0pt;mso-fareast-language:EN-GB">I think you misunderstood my question. I didn't mean "is this useful in transformation". I meant that, we *already* have composable transforms, where the output of one activity is piped into another;
there's a lot of similarity here (and they'll use the same underlying plumbing.) I was suggesting that you could think of teeing as being a (likely no-op) transformation on the building that is already in progress.
<br>
<br>
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-GB">Using composable transformations for example to calculate actual stack content to emit multiple stack-to-locals and locals-to-stack sequences
of instructions – that is beyond my imagination yet.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-GB">I’ve previously re-used javac stack tracker to implement this particular feature, where javac had full control of each individual instruction,
so it was able to instruct stack-to-locals and back. However such approach prevents use of any advanced CodeBuilder features. When you for example optimize the code generator to use blocks, you lose track of the exact instructions passing down to the CodeBuilder::with.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-GB">This API proposes an option to add listener of what falls down to the CodeBuilder when drop something into some of its convenience methods.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-GB">I’m open to any other proposal how to hook these code helpers. We may for example implement them internally and enable them with specific
switches. However even for the internal helpers we still need a hook to listen on CodeBuilder. Actually there is a hard-coded partial support for local variables allocation, which should also fall into this group of code-builder helpers (actually tracking
instructions related to local variables).<o:p></o:p></span></p>
</div>
</body>
</html>