<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font size="4"><font face="monospace">See the RFR, I think I found a
place where we might end up putting TWO stack map attributes
into the builder. <br>
<br>
With this patch, I believe the treatment of stack maps is
intended to be:<br>
<br>
if (generation not disabled) { <br>
try to reuse original stackmap, if transforming and code
array/exception table is unchanged<br>
otherwise generate stack map<br>
}<br>
else { <br>
if a stack map has been sent to the builder, put that in
the class file<br>
}<br>
<br>
I am not sure this is the effect, though; since the user can
send stack maps down the pipe and they are stored as attributes
regardless of options, I think these may be written to the
classfile even if we are in generation mode. <br>
<br>
<br>
</font></font><br>
<div class="moz-cite-prefix">On 8/17/2022 11:45 AM, Adam Sotona
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CY4PR1001MB21503F39C50568FFE63C3A078C6A9@CY4PR1001MB2150.namprd10.prod.outlook.com">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style>@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}@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;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}ol
{margin-bottom:0cm;}ul
{margin-bottom:0cm;}</style>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">I
would like to ask for review of proposed change in the
Classfile API stack maps processing.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">Primary
motivation is to better align stack maps processing with the
Classfile API and to allow manual constructions and
transformations of stack maps.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">Pull
request for review is here:
<a href="https://github.com/openjdk/jdk-sandbox/pull/32" moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/openjdk/jdk-sandbox/pull/32</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">And
it includes following changes:<o:p></o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span style="font-size:11.0pt" lang="EN-US">New boolean
Classfile.Option::processStackMaps with default to false
has been added<o:p></o:p></span></li>
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span style="font-size:11.0pt">StackMapTableAttribute</span><span style="font-size:11.0pt" lang="EN-US"> become a
CodeElement processed when the above option is explicitly
enabled by user</span><span style="font-size:11.0pt"><o:p></o:p></span></li>
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span style="font-size:11.0pt">StackMapTableAttribute</span><span style="font-size:11.0pt" lang="EN-US">, StackMapFrameInfo,
VerificationTypeInfo, SimpleVerificationTypeInfo,
ObjectVerificationTypeInfo and
UninitializedVerificationTypeInfo have been simplified,
refactored to use Labels instead of offsets and equipped
with relevant static factory methods<o:p></o:p></span></li>
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span style="font-size:11.0pt" lang="EN-US">Redundant content of
the StackMapFrameInfo and its sub-classes reflecting
compressed frame forms have been removed<o:p></o:p></span></li>
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span style="font-size:11.0pt" lang="EN-US">UnboundStackMapTableAttribute
with proper serialization has been implemented<o:p></o:p></span></li>
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span style="font-size:11.0pt" lang="EN-US">CorpusTest with
RebuildingTransformations has been extended to process
stack maps using the new API<o:p></o:p></span></li>
</ul>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">New
stack maps processing option affects inflation of stack maps
and appearance of StackMapTableAttribute in the CodeElement
stream.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">Enabled
stack maps processing inflates and decompresses
StackMapTableAttribute with translated offsets to Labels and
pass it to CodeTransformation(s).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">User
can individually filter StackMapTableAttribute out or
transform it manually when explicitly enabled stack maps
processing.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">User-provided
or transformed StackMapTableAttribute passed to CodeBuilder
overrides stack maps generation process for the actual
method.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">Compressed
source form of the parsed stack map frame can be identified
from StackMapFrameInfo::tag<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">All
new created StackMapFrameInfos always represent full frames
with complete list of locals and stack.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">Compression
of StackMapTableAttribute frames is contextual operation and
it is applied at the writing phase.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">Any
NO-OP transformation of inflated and decompressed
StackMapTableAttribute may result in a different compressed
form.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">Performance
boost tricks by-passing stack maps generation for unchanged
methods are unaffected by this enhancement.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">Thanks
for your comments,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US">Adam<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt" lang="EN-US"><o:p> </o:p></span></p>
</div>
</blockquote>
<br>
</body>
</html>