Parametric-vm spec / unused CONSTANT_Parameter is illegal
forax at univ-mlv.fr
Wed Mar 10 21:59:49 UTC 2021
slowly reading the Parametric-vm spec.
With my ASM hat,
"As a structural constraint, it is illegal for a CONSTANT_Parameter constant to be unused."
This is different of all other CONSTANTs and doesn't work well with the idea that you can patch a classfile by copying the existing constant pool and replace only the method(s) you want, because if i replace a parametric method by a non parametric one, the existing CONSTANT_Parameter will stay in the constant pool with no reference to it anymore.
Being able to patch a classfile like this is very important in term of speed for some transformers / agents.
If the VM is able to find that a CONSTANT_Parameter is unused, instead of throwing an error, why not ignoring it ?
More information about the valhalla-spec-observers