| Newsgroups |
gmane.comp.java.objectweb.asm |
| Message-ID |
<[email protected]> |
This is a multi-part message in MIME format...
------------=_1704659083-20613-0
Content-Type: multipart/alternative;
boundary="----=_Part_9803950_826235741.1704659042910"
------=_Part_9803950_826235741.1704659042910
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hi all,
While working on project of my own I ran into an issue related to stackfram=
es.
In MethodWriter the following exception got thrown=C2=A0 // line 781 with a=
sm 9.6
if (symbolTable.getMajorVersion() < Opcodes.V1_6) {
throw new IllegalArgumentException("Class versions V1_5 or less must use =
F_NEW frames.");
}
When I took a closer look it turned out the class file being transformed is=
really old. Java 1.1 old! So why is there a stackframe issue then with 1.1=
bytecode since there are no frame prior to java6? Here is why:
import org.junit.Assert;
import org.junit.Test;
import org.objectweb.asm.Opcodes;
public class AsmVersionProblem {
@Test
public void v1_1_smaller_than_v22() {
Assert.assertTure(Opcodes.V1_1< Opcodes.V22);
}
@Test
public void v1_1_smaller_than_v1_6() {
Assert.assertTrue(Opcodes.V1_1< Opcodes.V1_6);
}
}
I believe the mistake is in V1_1's definition. Although... the value in asm=
5 (I did not look further back) was already the same:
int V1_1 =3D 3 << 16 | 45;
int V1_2 =3D 0 << 16 | 46;
Should it not be=C2=A0 =C2=A0"0 << 16 | 45"? See the "3" vs "0". All the ot=
her versions follow the "0 << 16" pattern. Or is there a historic quirk and=
V1_1 should indeed be the 196653 int. In which case there at least one bug=
in MethodWriter.
Best regards,
Johan Parent=
------=_Part_9803950_826235741.1704659042910
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html><head></head><body><div class=3D"ydp6951d68dyahoo-style-wrap" style=
=3D"font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px=
;"><div dir=3D"ltr" data-setdir=3D"false">Hi all,</div><div dir=3D"ltr" dat=
a-setdir=3D"false"><br></div><div dir=3D"ltr" data-setdir=3D"false">While w=
orking on project of my own I ran into an issue related to stackframes.</di=
v><div dir=3D"ltr" data-setdir=3D"false"><br></div><div dir=3D"ltr" data-se=
tdir=3D"false">In MethodWriter the following exception got thrown // =
line 781 with asm 9.6</div><div dir=3D"ltr" data-setdir=3D"false"><br></div=
><div dir=3D"ltr" data-setdir=3D"false"><div><div style=3D"color: rgb(8, 8,=
8);"><pre style=3D"font-family:'JetBrains Mono',monospace;font-size:9.0pt;=
"><span style=3D"color:#0033b3;">if </span>(<span style=3D"color:#871094;">=
symbolTable</span>.getMajorVersion() < <span style=3D"color:#000000;">Op=
codes</span>.<span style=3D"color:#871094;font-style:italic;">V1_6</span>) =
{<br> <span style=3D"color:#0033b3;">throw new </span>IllegalArgumentExcep=
tion(<span style=3D"color:#067d17;">"Class versions V1_5 or less must use F=
_NEW frames."</span>);<br>}<br></pre></div></div></div><div dir=3D"ltr" dat=
a-setdir=3D"false"><br></div><div dir=3D"ltr" data-setdir=3D"false">When I =
took a closer look it turned out the class file being transformed is really=
old. Java 1.1 old! So why is there a stackframe issue then with 1.1 byteco=
de since there are no frame prior to java6? Here is why:<br><br><div><div s=
tyle=3D"color: rgb(8, 8, 8);"><pre style=3D"font-family:'JetBrains Mono',mo=
nospace;font-size:9.0pt;"><span style=3D"color:#0033b3;">import </span><spa=
n style=3D"color:#000000;">org.junit.Assert</span>;<br><span style=3D"color=
:#0033b3;">import </span><span style=3D"color:#000000;">org.junit.</span><s=
pan style=3D"color:#9e880d;">Test</span>;<br><span style=3D"color:#0033b3;"=
>import </span><span style=3D"color:#000000;">org.objectweb.asm.Opcodes</sp=
an>;<br><br><span style=3D"color:#0033b3;">public class </span><span style=
=3D"color:#000000;">AsmVersionProblem </span>{<br> <span style=3D"color:=
#9e880d;">@Test<br></span><span style=3D"color:#9e880d;"> </span><span s=
tyle=3D"color:#0033b3;">public void </span><span style=3D"color:#00627a;">v=
1_1_smaller_than_v22</span>() {<br> <span style=3D"color:#000000;">A=
ssert</span>.<span style=3D"font-style:italic;">assertTure</span>(<span sty=
le=3D"color:#000000;">Opcodes</span>.<span style=3D"color:#871094;font-styl=
e:italic;">V1_1</span>< <span style=3D"color:#000000;">Opcodes</span>.<s=
pan style=3D"color:#871094;font-style:italic;">V22</span>);<br> }<br><br=
> <span style=3D"color:#9e880d;">@Test<br></span><span style=3D"color:#9=
e880d;"> </span><span style=3D"color:#0033b3;">public void </span><span =
style=3D"color:#00627a;">v1_1_smaller_than_v1_6</span>() {<br> <span=
style=3D"color:#000000;">Assert</span>.<span style=3D"font-style:italic;">=
assertTrue</span>(<span style=3D"color:#000000;">Opcodes</span>.<span style=
=3D"color:#871094;font-style:italic;">V1_1</span>< <span style=3D"color:=
#000000;">Opcodes</span>.<span style=3D"color:#871094;font-style:italic;">V=
1_6</span>);<br> }<br>}<br></pre></div></div>I believe the mistake is in=
V1_1's definition. Although... the value in asm5 (I did not look further b=
ack) was already the same:</div><div dir=3D"ltr" data-setdir=3D"false"><br>=
</div><div dir=3D"ltr" data-setdir=3D"false"><div><div style=3D"color: rgb(=
8, 8, 8);"><pre style=3D"font-family:'JetBrains Mono',monospace;font-size:9=
.0pt;"><span style=3D"color:#0033b3;">int </span><span style=3D"color:#8710=
94;font-style:italic;">V1_1 </span>=3D <span style=3D"color:#1750eb;">3 </s=
pan><< <span style=3D"color:#1750eb;">16 </span>| <span style=3D"colo=
r:#1750eb;">45</span>;<br><span style=3D"color:#0033b3;">int </span><span s=
tyle=3D"color:#871094;font-style:italic;">V1_2 </span>=3D <span style=3D"co=
lor:#1750eb;">0 </span><< <span style=3D"color:#1750eb;">16 </span>| =
<span style=3D"color:#1750eb;">46</span>;</pre></div></div><br></div><div d=
ir=3D"ltr" data-setdir=3D"false">Should it not be "<span style=
=3D"font-family: JetBrains Mono, monospace; font-size: 9pt; white-space: pr=
e-wrap; color: rgb(23, 80, 235);"><b><u>0</u></b> </span><span style=3D"col=
or: rgb(8, 8, 8); font-family: JetBrains Mono, monospace; font-size: 9pt; w=
hite-space: pre-wrap;"><< </span><span style=3D"font-family: JetBrain=
s Mono, monospace; font-size: 9pt; white-space: pre-wrap; color: rgb(23, 80=
, 235);">16 </span><span style=3D"color: rgb(8, 8, 8); font-family: JetBrai=
ns Mono, monospace; font-size: 9pt; white-space: pre-wrap;">| </span><span =
style=3D"font-family: JetBrains Mono, monospace; font-size: 9pt; white-spac=
e: pre-wrap; color: rgb(23, 80, 235);">45"? See the "3" vs "0". All the oth=
er versions follow the "0 << 16" pattern. Or is there a historic quir=
k and V1_1 should indeed be the 196653 int. In which case there at least on=
e bug in MethodWriter.</span></div><div dir=3D"ltr" data-setdir=3D"false"><=
span style=3D"font-family: JetBrains Mono, monospace; font-size: 9pt; white=
-space: pre-wrap; color: rgb(23, 80, 235);"><br></span></div><div dir=3D"lt=
r" data-setdir=3D"false"><span style=3D"font-family: JetBrains Mono, monosp=
ace; font-size: 9pt; white-space: pre-wrap; color: rgb(23, 80, 235);">Best =
regards,</span></div><div dir=3D"ltr" data-setdir=3D"false"><span style=3D"=
font-family: JetBrains Mono, monospace; font-size: 9pt; white-space: pre-wr=
ap; color: rgb(23, 80, 235);"><br></span></div><div dir=3D"ltr" data-setdir=
=3D"false"><span style=3D"font-family: JetBrains Mono, monospace; font-size=
: 9pt; white-space: pre-wrap; color: rgb(23, 80, 235);">Johan Parent</span>=
</div></div></body></html>=
------=_Part_9803950_826235741.1704659042910--
------------=_1704659083-20613-0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
--
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
------------=_1704659083-20613-0--