Multiple method build in classBuilder

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Jul 26 15:17:08 UTC 2024


I think this is as expected? E.g. by default the classfile API will 
consider all jumps to be "short jumps" (e.g. "goto" instead of "goto_w").

If that fails (e.g. because the code is too big), code generation is 
"replayed", this time using "long jumps" (e.g. "goto_w" instead of "goto").

This is why you see the consumer being called twice.

Maurizio

On 26/07/2024 10:35, Øystein Myhre Andersen wrote:
> The attached code contains the building of a class with one method '_STM'.
> When the method gets too big, more than 32,767 bytes, a weird 
> situation occurs.
>
> Look at lines 93-94: Here the size of the code can be changed.
> When the code is greater than 32,767  (caseBlockSize = 13000)
> the Method 'buildMethod_STM' is called twice with different 
> CodeBuilders !!!
>
> When caseBlockSize = 10000 everything is OK.
>
> There must be something wrong here.
>
> - Øystein Myhre Andersen


More information about the classfile-api-dev mailing list