Issues with JSRInlinerAdapter and LocalVariableTable size
A client of mine got a following error: java.lang.ClassFormatError: LocalVariableTable has wrong length in class file cfdump2ecfm851157132$funcDUMPOBJECT I tracked the issue down to the JSRInlinerAdapter we use. The issue is that the failing class is a generated class (made by ColdFusion) with old file format that contains a lot of jsr/ret instructions and a lot of local variables that are all defined though the entire class. for example:
0 27121 114 t114 Ljava/lang/Throwable;
So after the inlining 478 will became 116513 items. For example:
4 27427 114 t114 Ljava/lang/Throwable;
27431 10 114 t114 Ljava/lang/Throwable;
27441 10 114 t114 Ljava/lang/Throwable;
27451 10 114 t114 Ljava/lang/Throwable;
...
My current fix is that I simply cap the size of LocalVariableTable to 65565 after JSRInlinerAdapter:
if (localVariables != null && localVariables.size() > 65535) {
localVariables = localVariables.subList(0, 65535);
}
I think it would also be possible to try to merge the new frames because currently they still cover the entire method, but they are split into pieces. We can still have the old frame and add only a single new one for the inlined part (this would reduce the number a lot), inside JSRInlinerAdapter, but this will probably be more complex.
The fix of capping the number of lines is currently sufficient fix for us. But I made this case, in case you want to make some fix into ASM for other users of the JSRInlinerAdapter.