Frames are re-calculated for Large Methods
For certain large methods ASM enforces re-calculation of stackmap frames even
if COMPUTE_FRAMES is not specified. This in turn causes the ClassWriter to load
some of the types used in the instrumented class due to the call of the
getCommonSuperClass() method.
In environments where the classes cannot be loaded into the JVM (or are not
available at all) this blocks the processing of certain class files.
The re-calculation is caused by this code in MethodWriter:
/*
* Resizing an existing stack map frame table is really hard.
* Not only the table must be parsed to update the offets, but
* new frames may be needed for jump instructions that were
* inserted by this method. And updating the offsets or
* inserting frames can change the format of the following
* frames, in case of packed frames. In practice the whole table
* must be recomputed. For this the frames are marked as
* potentially invalid. This will cause the whole class to be
* reread and rewritten with the COMPUTE_FRAMES option (see the
* ClassWriter.toByteArray method). This is not very efficient
* but is much easier and requires much less code than any other
* method I can think of.
*/
cw.invalidFrames = true;
As this is a "show stopper" for many users of our library (JaCoCo code
coverage) is there a chance to remove this workaround? Can we help to work on
this?
Thx,
-marc