Re: [Question] Could the max code size check be optional?

"Eugene Kuleshov" (via asm Mailing List) <[email protected]> Wed, 17 Mar 2021 10:53:15 -0400
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <CADFjdoVYUg579ZwLpkaayeF795SYbZvgicZEMg9eSdD8wCh0Vw@mail.gmail.com>
This is a multi-part message in MIME format...

------------=_1615992811-16935-14
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Manuel,

  If your pipeline has some optimizer in the middle, perhaps you can
write your generated bytecode into a MethodNode first, then run your
optimizer over a MethodNode and only then send it to the MethodWriter

  regards,
  Eugene


On Wed, Mar 17, 2021 at 7:10 AM Manuel Carrasco <[email protected]> wrote:
>
> Hi,
>
> How are you?
>
> I noticed that the MethodWriter currently (184aaa9f0ec4c233872087a3c4d2d9=
6a3c204ac6) throws an exception when the method size exceeds the maximum al=
lowed by the JVM. The intent is clear to me, the library wants to emit Java=
 bytecode that is legal in terms of the specification. My question is, coul=
d we make this check optional and true by default?
>
> In case that you want to perform an optimization to shrink your code, you=
 may require to have the max stack and local as well as the stack map frame=
s available. So, you execute the ClassWriter to compute them, but it will c=
rash as soon the MethodWriter verifies the maximum code size.
>
> The current implementation is limiting user optimizations on their code i=
n case it has already exceeded the maximum limit. At least, it is not allow=
ing them to compute the max stack and local as well as the map stack frames.
>
> I tested commenting the check and emitting the code. It didn't crash, and=
 I could optimize it, so it can be executed by the JVM.
>
> Considering all this, I'd like to know if you consider reasonable to make=
 the max code size check optional. Perhaps, I'm missing some other technica=
l reason that could make this impossible.
>
> Thanks in advance!
>
> Cheers,
> Manuel.
>
>
> --
> 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=3Dhelp
> OW2 mailing lists service home page: http://www.ow2.org/wws

------------=_1615992811-16935-14
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

------------=_1615992811-16935-14--