I am trying to understand dynamic linking in Java. Having read http://slurp.doc.ic.ac.uk/pubs/observing/linking.html#resolution
I don't quite understand the difference between the bytecode verifier and the resolution process. Why does the verifier not perform the checks performed by resolution?
The resolution process has to be done by the JVM to make sense of the code that you are loading. If it doesn't resolve the references the JVM cannot execute the methods. (And resolution also checks that signatures and things still match ... to guard the JVM against heap corruption, etcetera that would ensue from binary incompatibility issues.)
By contrast, the verification process is about checking that the bytecodes themselves don't do the wrong thing. This won't happen if they were produced by a correct compiler, but if the bytecodes were produced by a buggy compiler, by a buggy injection procedure ... or by some bad guy diddling bytecodes, then the verifier provides a line of defences.
The key difference is that resolution is essential, but verification is (sort of) optional. Indeed, separating resolution and verification means that verification can be turned off. There is a command line option to do it. (Whether it is a good idea to turn off verification ... under normal circumstances ... is pretty doubtful, IMO.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With