On Fri, 31 Mar 2023 11:22:46 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> I'm not really looking for anything specific. I'm just trying to figure out >> if it's worth it to keep the `PERFORM_VERIFICATION` flag, and change it to >> call the verifier in the new impl. i.e. does it catch more errors than just >> generating and loading the class would (or does it output the errors in a >> better format). >> >> I had a brief look at the implementation, and it seems that the consumer is >> for detailed logging of the verification process. I think in this case we're >> just interested in catching errors. >> >> I already tried switching the code to call >> `Classfile.parse(newBytes).verify(null).forEach(System.err::println)`, but >> the error I artificially introduced was already being caught during class >> generation. So I'm wondering if having a separate verification pass will >> actually catch any additional errors. > > I believe that, in order to generate the actual bytecodes, the classfile API > does a full verification pass (as it needs to infer the stackmap > information). This leads me to believe that, yes, most (but probably all) > errors would be detected simply by generating code. Maybe @asotona can > clarify. Stackmap generator does not perform full verification, it only performs fast pass through the code and hits only errors preventing to construct valid stack maps (as for example stack underflow). Verifyier on the other hand does full verification similar to when the class is loaded. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13247#discussion_r1154408706