<div dir="ltr"><div dir="ltr">Am Mi., 27. Juli 2022 um 22:34 Uhr schrieb Brian Goetz <<a href="mailto:brian.goetz@oracle.com">brian.goetz@oracle.com</a>>:<br></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>
<br>
<blockquote type="cite">
<div dir="ltr">
<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>
<blockquote type="cite">
<div dir="ltr">
<div style="font-family:arial,helvetica,sans-serif">Obviously
this is wandering dangerously close to the bikeshed
borderline, however one other real-world advantage
is that an enum constant in a more specific
`*Opcode` subtype type can store more useful
information about itself that a consumer could use;
for example, the opcode constant for `IFEQ` could
have a method `complement` which yields `IFNE`,
which can be useful for simplifying some code
generators (and I can think of specific cases both
within qbicc and within Quarkus where this would
have been useful).</div>
</div>
</blockquote>
<br>
This method exists in the library as an Opcode ->
Opcode method.<br>
</div>
</blockquote>
<div><br>
</div>
<div>
<div style="font-family:arial,helvetica,sans-serif">Ah yes, I
found it in `BytecodeHelpers`, excellent. That's in the
`impl` subpackage though, so it doesn't feel very
"public". Perhaps that class could be moved into the
`jdk.classfile` package?</div>
<br>
</div>
</div>
</div>
</blockquote>
<br>
Yes, we've been conservative about what we expose, since its easier
to expose something hidden than vice versa. <br>
<br>
What other transforms on opcodes go along with this?<br></div></blockquote><div><br></div><div>I'm using two related transforms.</div><div><br></div><div>First, a "swap sides" for comparisons mapping e.g. the LT variants to their GT companions</div><div>while being identity for EQ and NE. I use this to slide null and integer zero to the right hand side.</div><div><br></div><div>Then the second step takes two operand compares against null/zero and maps them to</div><div>their one operand counterparts.</div><div><br></div><div>-- mva</div><div><br></div></div></div>