What to do about dead labels?
Brian Goetz
brian.goetz at oracle.com
Wed Aug 24 20:49:34 UTC 2022
> Perhaps it comes down to an option to order such pseudo instructions or not?
I thought some more about this and I think we may not be able to do this.
The order of the exception table is significant (JVMS 2.10); it
indicates the order in which handlers are tried. This may, or may not,
correspond to the order in which the handlers appear in the code array.
(I recall we had some earlier bugs where we were not diligent about
preserving this order.)
The builder is going to write them to the exception_table in the order
they are presented. So if we perturb the presentation order, we'll be
perturbing the order of the exception table, and changing the semantics
of the classfile. And if we can't do this for exceptions, there's
little point in trying to do it for debug information or line numbers.
So I think that brings us to: it's an error if if any of these reference
dead labels. And I think this is the behavior of the code now. So I
think all we need here is (a) to remove the FIXME comments in
DirectCodeBuilder like "@@@ Filter out LVs whose boundary labels are not
defined?" and (b) write some tests for this behavior.
More information about the classfile-api-dev
mailing list