<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 3/3/23 6:23 AM, Archie Cobbs wrote:<br>
</div>
<blockquote type="cite" cite="mid:CANSoFxt-3g+QmhNLk0W3e2SBqDPxjjbqRoB06x7=Z4vQnW4Axg@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">On Thu, Mar 2, 2023 at 5:32 PM Archie Cobbs <<a href="mailto:archie.cobbs@gmail.com" moz-do-not-send="true" class="moz-txt-link-freetext">archie.cobbs@gmail.com</a>>
wrote:</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div dir="ltr">On Tue, Feb 28, 2023 at 9:30 AM Archie
Cobbs <<a href="mailto:archie.cobbs@gmail.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">archie.cobbs@gmail.com</a>>
wrote:</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px
0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>Jon and I have been discussing <a href="https://bugs.openjdk.org/browse/JDK-8268622" target="_blank" moz-do-not-send="true">JDK-8268622</a>
via JBS comments, but it's better off being
discussed on compiler-dev, so we're moving the
discussion here...<br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Jon (and anyone else interested),</div>
<div><br>
</div>
<div>Please take a look at <a href="https://github.com/openjdk/jdk/pull/12843" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/openjdk/jdk/pull/12843</a>
and let me know what you think.</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Also here's a "sketch" of a refactoring along the lines
of <a href="https://bugs.openjdk.org/browse/JDK-8269957" moz-do-not-send="true">JDK-8269957</a> "facilitate
alternate impls of NameTable and Name".</div>
<div>
<div><br>
</div>
<div> <a href="https://github.com/openjdk/jdk/compare/master...archiecobbs:jdk:JDK-8269957" moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/openjdk/jdk/compare/master...archiecobbs:jdk:JDK-8269957</a></div>
<div><br>
</div>
</div>
<div>Let me know if this is the kind of thing you had in mind.
Note, this includes the above patch as well.<br>
</div>
<br>
<div>Overview of changes...</div>
<div>
<ul>
<li>Remove any byte-oriented methods from Name and
NameTable API's, except for those that "import" or
"export" as UTF-8.</li>
<li>Refactor SharedNameTable & UnsharedNameTable to
have a new common superclass Utf8NameTable</li>
<li>Fix bug in PoolReader, in that it was not doing any
validation when decoding "Modified UTF-8". For example,
this bug could result in duplicate Names if a classfile
contained the same name encoded two different ways.</li>
<li>Eliminated an unnecessary extra array allocation in
Convert.utf2chars()</li>
<li>Rename Name.lastIndexOf() ->
Name.lastIndexOfAscii() for safety</li>
</ul>
</div>
<div>-Archie<br>
</div>
</div>
<br>
-- <br>
<div dir="ltr" class="gmail_signature">Archie L. Cobbs<br>
</div>
</div>
</blockquote>
<p><br>
</p>
<p>Archie,</p>
<p>This is certainly along the lines I imagined, especially your
first bullet, albeit much more thorough and in depth than I had
previously considered.</p>
<p>I would give you inline code comments, except that it's not a PR
yet. I note that I generally distrust the `getMessage` for any
exception for which the message is not formally specified in some
way ... in other words, don't assume that `e.getMessage()` by
itself is interesting.</p>
<p>Is it possible to write a test for the bug fix in PoolReader?
What is an example of a name encoded in two different ways?</p>
<p>Although conceptually simple, this is a significant change for a
very low level data type. It would be worth doing more testing
than just the usual langtools tests. For example, if you build
JDK before and after this change, are the generated class files
the same?</p>
<p>-- Jon</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
</body>
</html>