Emit return-void-barrier when appropriate.

If SMP is enabled, and we're optimizing a constructor, and the
class in question has final fields, we replace all occurrences of
"return-void" with "return-void-barrier".

This is an "essential" optimization for SMP, meaning it will be done
regardless of the verification/optimization settings.

Also, split the updateCode() helper function into two versions (one
to update the whole 16-bit code unit, one to replace just the opcode).

Also, make the presence of a duplicate class in the bootstrap class
path a failure for optimization as well as verification.  Otherwise,
if you have "-Xdexopt:all", you could end up trying to optimize a
class loaded from a bootstrap DEX file, which doesn't work well
since those classes are mapped read-only in dexopt.

Bug 2965743.

Change-Id: I29e67133731b59beb6af5003f3cd69302c5c20f5
2 files changed